Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
8fafde00
Commit
8fafde00
authored
Nov 30, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/zodb/zeo: Factor-out verifying empty database into xtesting.DrvTestEmptyDB
And use it to verify other storages.
parent
762073ee
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
go/internal/xtesting/xtesting.go
go/internal/xtesting/xtesting.go
+11
-0
go/zodb/storage/fs1/filestorage_test.go
go/zodb/storage/fs1/filestorage_test.go
+7
-0
go/zodb/storage/zeo/zeo_test.go
go/zodb/storage/zeo/zeo_test.go
+1
-7
No files found.
go/internal/xtesting/xtesting.go
View file @
8fafde00
...
...
@@ -136,6 +136,17 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err
// ---- tests for storage drivers ----
// DrvTestEmptyDB verifies that zdrv works correctly on empty database.
func
DrvTestEmptyDB
(
t
*
testing
.
T
,
zdrv
zodb
.
IStorageDriver
)
{
X
:=
FatalIf
(
t
)
ctx
:=
context
.
Background
()
head
,
err
:=
zdrv
.
Sync
(
ctx
);
X
(
err
)
headOk
:=
zodb
.
Tid
(
0
)
if
head
!=
headOk
{
t
.
Errorf
(
"head=%s ; expected %s"
,
head
,
headOk
)
}
}
// state of an object in the database for some particular revision
type
objState
struct
{
tid
zodb
.
Tid
...
...
go/zodb/storage/fs1/filestorage_test.go
View file @
8fafde00
...
...
@@ -72,6 +72,13 @@ func xfsopenopt(t testing.TB, path string, opt *zodb.DriverOptions) (*FileStorag
return
fs
,
at0
}
func
TestEmptyDB
(
t
*
testing
.
T
)
{
fs
,
_
:=
xfsopen
(
t
,
"testdata/empty.fs"
)
defer
exc
.
XRun
(
fs
.
Close
)
xtesting
.
DrvTestEmptyDB
(
t
,
fs
)
}
func
TestLoad
(
t
*
testing
.
T
)
{
fs
,
_
:=
xfsopen
(
t
,
"testdata/1.fs"
)
defer
exc
.
XRun
(
fs
.
Close
)
...
...
go/zodb/storage/zeo/zeo_test.go
View file @
8fafde00
...
...
@@ -244,13 +244,7 @@ func TestHandshake(t *testing.T) {
// verify that connection to ZEO server with empty DB works ok.
func
TestEmptyDB
(
t
*
testing
.
T
)
{
withZEO
(
t
,
func
(
t
*
testing
.
T
,
zsrv
ZEOSrv
,
z
*
zeo
)
{
X
:=
xtesting
.
FatalIf
(
t
)
ctx
:=
context
.
Background
()
head
,
err
:=
z
.
Sync
(
ctx
);
X
(
err
)
headOk
:=
zodb
.
Tid
(
0
)
if
head
!=
headOk
{
t
.
Errorf
(
"head=%s ; expected %s"
,
head
,
headOk
)
}
xtesting
.
DrvTestEmptyDB
(
t
,
z
)
})
}
...
...
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