Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
a8648b28
Commit
a8648b28
authored
Mar 20, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We're not using byte slices.
parent
b8ce0bcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
28 deletions
+6
-28
samples/flushfs/flush_fs_test.go
samples/flushfs/flush_fs_test.go
+6
-28
No files found.
samples/flushfs/flush_fs_test.go
View file @
a8648b28
...
...
@@ -15,8 +15,6 @@
package
flushfs_test
import
(
"errors"
"fmt"
"io"
"os"
"path"
...
...
@@ -81,26 +79,6 @@ func (t *FlushFSTest) SetUp(ti *TestInfo) {
// Helpers
////////////////////////////////////////////////////////////////////////
// Match byte slices equal to the supplied string.
func
byteSliceEq
(
expected
string
)
Matcher
{
pred
:=
func
(
c
interface
{})
error
{
slice
,
ok
:=
c
.
([]
byte
)
if
!
ok
{
return
errors
.
New
(
"which is not []byte"
)
}
if
string
(
slice
)
!=
expected
{
return
fmt
.
Errorf
(
"which is string
\"
%s
\"
"
,
string
(
slice
))
}
return
nil
}
return
NewMatcher
(
pred
,
fmt
.
Sprintf
(
"byte slice equal to string
\"
%s
\"
"
,
expected
))
}
// Return a copy of the current contents of t.flushes.
//
// LOCKS_EXCLUDED(t.mu)
...
...
@@ -169,7 +147,7 @@ func (t *FlushFSTest) CloseReports_ReadWrite() {
AssertEq
(
nil
,
err
)
// Now we should have received the flush operation (but still no fsync).
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
byteSliceEq
(
"taco"
)
))
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
"taco"
))
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
}
...
...
@@ -196,7 +174,7 @@ func (t *FlushFSTest) CloseReports_ReadOnly() {
AssertEq
(
nil
,
err
)
// Now we should have received the flush operation (but still no fsync).
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
byteSliceEq
(
""
)
))
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
""
))
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
}
...
...
@@ -229,7 +207,7 @@ func (t *FlushFSTest) CloseReports_WriteOnly() {
AssertEq
(
nil
,
err
)
// Now we should have received the flush operation (but still no fsync).
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
byteSliceEq
(
"taco"
)
))
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
"taco"
))
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
}
...
...
@@ -262,7 +240,7 @@ func (t *FlushFSTest) CloseReports_MultipleTimes_NonOverlappingFileHandles() {
AssertEq
(
nil
,
err
)
// Now we should have received the flush operation (but still no fsync).
AssertThat
(
t
.
getFlushes
(),
ElementsAre
(
byteSliceEq
(
"taco"
)
))
AssertThat
(
t
.
getFlushes
(),
ElementsAre
(
"taco"
))
AssertThat
(
t
.
getFsyncs
(),
ElementsAre
())
// Open the file again.
...
...
@@ -274,7 +252,7 @@ func (t *FlushFSTest) CloseReports_MultipleTimes_NonOverlappingFileHandles() {
AssertEq
(
nil
,
err
)
AssertEq
(
1
,
n
)
AssertThat
(
t
.
getFlushes
(),
ElementsAre
(
byteSliceEq
(
"taco"
)
))
AssertThat
(
t
.
getFlushes
(),
ElementsAre
(
"taco"
))
AssertThat
(
t
.
getFsyncs
(),
ElementsAre
())
// Close the file. Now the new contents should be flushed.
...
...
@@ -282,7 +260,7 @@ func (t *FlushFSTest) CloseReports_MultipleTimes_NonOverlappingFileHandles() {
f
=
nil
AssertEq
(
nil
,
err
)
AssertThat
(
t
.
getFlushes
(),
ElementsAre
(
byteSliceEq
(
"taco"
),
byteSliceEq
(
"paco"
)
))
AssertThat
(
t
.
getFlushes
(),
ElementsAre
(
"taco"
,
"paco"
))
AssertThat
(
t
.
getFsyncs
(),
ElementsAre
())
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment