Commit c744c005 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1621b543
...@@ -138,6 +138,17 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err ...@@ -138,6 +138,17 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err
// ---- tests for storage drivers ---- // ---- 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 // state of an object in the database for some particular revision
type objState struct { type objState struct {
tid zodb.Tid tid zodb.Tid
......
...@@ -183,3 +183,11 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv)) { // XXX +optv ...@@ -183,3 +183,11 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv)) { // XXX +optv
// TODO NEO/go // TODO NEO/go
} }
// XXX withNeo
func TestEmptyDB(t *testing.T) {
withNEO(t, func(t *testing.T, nsrv NEOSrv, n *Client) {
xtesting.DrvTestEmptyDB(t, n)
})
}
...@@ -247,13 +247,7 @@ func TestHandshake(t *testing.T) { ...@@ -247,13 +247,7 @@ func TestHandshake(t *testing.T) {
// verify that connection to ZEO server with empty DB works ok. // verify that connection to ZEO server with empty DB works ok.
func TestEmptyDB(t *testing.T) { func TestEmptyDB(t *testing.T) {
withZEO(t, func(t *testing.T, zsrv ZEOSrv, z *zeo) { withZEO(t, func(t *testing.T, zsrv ZEOSrv, z *zeo) {
X := xtesting.FatalIf(t) xtesting.DrvTestEmptyDB(t, z)
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)
}
}) })
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment