Commit 9f07b5a3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5bc146bf
...@@ -200,6 +200,9 @@ func XGetTree(db *zodb.DB, at zodb.Tid, root zodb.Oid) map[Key]string { ...@@ -200,6 +200,9 @@ func XGetTree(db *zodb.DB, at zodb.Tid, root zodb.Oid) map[Key]string {
// it is known that @at1 and @at2 the tree has kv1 and kv2 values correspondingly. // it is known that @at1 and @at2 the tree has kv1 and kv2 values correspondingly.
// it is known that for at1->at2 ZODB-level change is δZ. // it is known that for at1->at2 ZODB-level change is δZ.
func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.Tid, kv1, kv2 map[Key]string, δZ *zodb.EventCommit) { func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.Tid, kv1, kv2 map[Key]string, δZ *zodb.EventCommit) {
d12 := kvdiff(kv1, kv2)
fmt.Println("d12:", d12)
// verify transition at1->at2 for all initial states of tracked {keys} from kv1 // verify transition at1->at2 for all initial states of tracked {keys} from kv1
keyv1 := []Key{} keyv1 := []Key{}
for k1 := range kv1 { for k1 := range kv1 {
...@@ -215,13 +218,13 @@ func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb. ...@@ -215,13 +218,13 @@ func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.
keys[i] = keyv1[i] keys[i] = keyv1[i]
} }
xverifyΔBTail1(t, db, treeRoot, at1,at2, kv1,kv2, δZ, keys) xverifyΔBTail1(t, db, treeRoot, at1,at2, kv1,kv2, d12, δZ, keys)
} }
} }
// xverifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial // xverifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// tracked state defined by initialTrackedKeys. // tracked state defined by initialTrackedKeys.
func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, kv1,kv2 map[Key]string, δZ *zodb.EventCommit, initialTrackedKeys []Key) { func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, kv1,kv2, d12 map[Key]string, δZ *zodb.EventCommit, initialTrackedKeys []Key) {
X := exc.Raiseif X := exc.Raiseif
assert := require.New(t) assert := require.New(t)
fmt.Println("verify1", initialTrackedKeys) fmt.Println("verify1", initialTrackedKeys)
...@@ -249,8 +252,6 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb. ...@@ -249,8 +252,6 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
δB := δbtail.Update(δZ) δB := δbtail.Update(δZ)
assert.Equal(δB.Rev, δZ.Tid) assert.Equal(δB.Rev, δZ.Tid)
d12 := kvdiff(kv1, kv2)
fmt.Println("d12:", d12)
//if len(d12) == 0 && len(initialTrackedKeys) == 0 { //if len(d12) == 0 && len(initialTrackedKeys) == 0 {
if len(initialTrackedKeys) == 0 { if len(initialTrackedKeys) == 0 {
assert.Equal(len(δB.ByRoot), 0) assert.Equal(len(δB.ByRoot), 0)
...@@ -370,7 +371,7 @@ func TestΔBTail(t *testing.T) { ...@@ -370,7 +371,7 @@ func TestΔBTail(t *testing.T) {
at2 := δZ.Tid at2 := δZ.Tid
kv2 := XGetTree(db, at2, tg.treeRoot) kv2 := XGetTree(db, at2, tg.treeRoot)
fmt.Printf("%s -> %s\n", tree1, tree2) // XXX -> subtest? excctx? fmt.Printf("\n%s -> %s\n", tree1, tree2) // XXX -> subtest? excctx?
xverifyΔBTail(t, db, tg.treeRoot, at1,at2, kv1,kv2, δZ) xverifyΔBTail(t, db, tg.treeRoot, at1,at2, kv1,kv2, δZ)
at1 = at2 at1 = at2
......
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