Commit 8509b93d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f4a90b6b
...@@ -275,10 +275,7 @@ func checkLoad(t *testing.T, zdrv zodb.IStorageDriver, xid zodb.Xid, expect objS ...@@ -275,10 +275,7 @@ func checkLoad(t *testing.T, zdrv zodb.IStorageDriver, xid zodb.Xid, expect objS
// //
// txnvOk is what data to expect to be in the database. // txnvOk is what data to expect to be in the database.
func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn, bugv ...string) { func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn, bugv ...string) {
bugs := map[string]bool{} bugs := argv2map(bugv)
for _, bug := range bugv {
bugs[bug] = true
}
// current knowledge of what was "before" for an oid as we scan over // current knowledge of what was "before" for an oid as we scan over
// data base entries // data base entries
...@@ -332,9 +329,13 @@ func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn, bugv ...s ...@@ -332,9 +329,13 @@ func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn, bugv ...s
} }
// DrvTestWatch verifies that storage driver watcher can observe commits done from outside. // DrvTestWatch verifies that storage driver watcher can observe commits done from outside.
func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener) { func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener, bugv ...string) {
X := FatalIf(t) X := FatalIf(t)
bugs := argv2map(bugv)
if bugs["nocommit"] {
t.Skip("skipping: server does not implement commit")
}
NeedPy(t, "zodbtools") NeedPy(t, "zodbtools")
u, err := url.Parse(zurl); X(err) u, err := url.Parse(zurl); X(err)
...@@ -455,6 +456,16 @@ func FatalIf(t *testing.T) func(error) { ...@@ -455,6 +456,16 @@ func FatalIf(t *testing.T) func(error) {
} }
} }
// argv2map converts ...string to map[string]bool.
// it is handy to use e.g. to convert ...bugv to bugs {}.
func argv2map(argv []string) map[string]bool {
dict := map[string]bool{}
for _, arg := range argv {
dict[arg] = true
}
return dict
}
// b is syntactic sugar for byte literals. // b is syntactic sugar for byte literals.
// //
......
...@@ -525,7 +525,7 @@ func TestLoad(t *testing.T) { ...@@ -525,7 +525,7 @@ func TestLoad(t *testing.T) {
func TestWatch(t *testing.T) { func TestWatch(t *testing.T) {
withNEOSrv(t, func(t *testing.T, nsrv NEOSrv) { withNEOSrv(t, func(t *testing.T, nsrv NEOSrv) {
xtesting.DrvTestWatch(t, nsrv.URL(), openClientByURL) xtesting.DrvTestWatch(t, nsrv.URL(), openClientByURL, nsrv.Bugs()...)
}) })
} }
......
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