Commit a1ceb162 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2a95e448
......@@ -169,27 +169,50 @@ func TestWatch(t *testing.T) {
})
}
// TestBaseMutate verifies that demo detect if base mutates.
func TestBaseMutate(t *testing.T) {
// withDemoBaseMutated tests f with demo: client connected to Storage and base
// just mutated with new commit.
func withDemoBaseMutated(t *testing.T, f func(t *testing.T, ddrv *Storage)) {
withDemo(t, func(t *testing.T, ddat *DemoData, ddrv *Storage) {
X := xtesting.FatalIf(t)
/* XXX kill?
head, err := ddrv.Sync(context.Background())
if !(head == 0 && err == nil) {
t.Fatalf("sync0: head=%s err=%s", head, err)
}
*/
_, err = xtesting.ZPyCommitRaw(ddat.base, 0, xtesting.ZRawObject{
Oid: 1,
Data: []byte("ZZZ"),
}); X(err)
head, err = ddrv.Sync(context.Background())
f(t, ddrv)
})
}
// TestSync_vs_BaseMutate verifies Sync wrt base mutation.
func TestSync_vs_BaseMutate(t *testing.T) {
withDemoBaseMutated(t, func(t *testing.T, ddrv *Storage) {
X := xtesting.FatalIf(t)
head, err := ddrv.Sync(context.Background())
// XXX verify err
})
}
// TestWatchLoad_vs_BaseMutate verifies Watch and Load wrt base mutation.
func TestLoad_vs_BaseMutate(t *testing.T) {
withDemoBaseMutated(t, func(t *testing.T, ddrv *Storage) {
X := xtesting.FatalIf(t)
// XXX first wait for error from watchq
data, serial, err := ddrv.Load(context.Background(), ...)
// XXX verify err
})
}
func demoOpen(zurl string, opt *zodb.DriverOptions) (_ *Storage, at0 zodb.Tid, err error) {
defer xerr.Contextf(&err, "opendemo %s", zurl)
u, err := url.Parse(zurl)
......
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