Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
8ddf6ada
Commit
8ddf6ada
authored
Dec 02, 2019
by
Adin Schmahmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing: add basic sync test to test suite
parent
2b236dbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
test/basic_tests.go
test/basic_tests.go
+30
-0
test/suite.go
test/suite.go
+1
-0
No files found.
test/basic_tests.go
View file @
8ddf6ada
...
...
@@ -176,6 +176,36 @@ func SubtestManyKeysAndQuery(t *testing.T, ds dstore.Datastore) {
subtestQuery
(
t
,
ds
,
dsq
.
Query
{
KeysOnly
:
true
},
100
)
}
func
SubtestBasicSync
(
t
*
testing
.
T
,
ds
dstore
.
Datastore
)
{
if
err
:=
ds
.
Sync
(
dstore
.
NewKey
(
"foo"
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
ds
.
Put
(
dstore
.
NewKey
(
"/foo"
),
[]
byte
(
"foo"
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
ds
.
Sync
(
dstore
.
NewKey
(
"/foo"
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
ds
.
Put
(
dstore
.
NewKey
(
"/foo/bar"
),
[]
byte
(
"bar"
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
ds
.
Sync
(
dstore
.
NewKey
(
"/foo"
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
ds
.
Sync
(
dstore
.
NewKey
(
"/foo/bar"
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
ds
.
Sync
(
dstore
.
NewKey
(
""
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
// need a custom test filter to test the "fallback" filter case for unknown
// filters.
type
testFilter
struct
{}
...
...
test/suite.go
View file @
8ddf6ada
...
...
@@ -19,6 +19,7 @@ var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
SubtestFilter
,
SubtestManyKeysAndQuery
,
SubtestReturnSizes
,
SubtestBasicSync
,
}
// BatchSubtests is a list of all basic batching datastore tests.
...
...
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