Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
fa838dba
Commit
fa838dba
authored
Jun 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c895576f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+17
-11
No files found.
wcfs/δbtail_test.go
View file @
fa838dba
...
...
@@ -193,11 +193,11 @@ func XGetTree(db *zodb.DB, at zodb.Tid, root zodb.Oid) map[Key]string {
}
// verifyΔBTail verifies how ΔBTail handles ZODB update for a tree with changes in between at1->at2.
//
x
verifyΔBTail verifies how ΔBTail handles ZODB update for a tree with changes in between at1->at2.
//
// 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.
func
verifyΔBTail
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
kv1
,
kv2
map
[
Key
]
string
,
δZ
*
zodb
.
EventCommit
)
{
func
x
verifyΔBTail
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
kv1
,
kv2
map
[
Key
]
string
,
δZ
*
zodb
.
EventCommit
)
{
// verify transition at1->at2 for all initial states of tracked {keys} from kv1
keyv1
:=
[]
Key
{}
for
k1
:=
range
kv1
{
...
...
@@ -212,13 +212,13 @@ func verifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.T
keys
[
i
]
=
keyv1
[
i
]
}
verifyΔBTail1
(
t
,
db
,
treeRoot
,
at1
,
at2
,
kv1
,
kv2
,
δZ
,
keys
)
x
verifyΔBTail1
(
t
,
db
,
treeRoot
,
at1
,
at2
,
kv1
,
kv2
,
δZ
,
keys
)
}
}
// verifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
//
x
verifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// tracked state defined by initialTrackedKeys.
func
verifyΔ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
x
verifyΔBTail1
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
kv1
,
kv2
map
[
Key
]
string
,
δZ
*
zodb
.
EventCommit
,
initialTrackedKeys
[]
Key
)
{
X
:=
exc
.
Raiseif
fmt
.
Println
(
"verify1"
,
initialTrackedKeys
)
...
...
@@ -244,12 +244,19 @@ func verifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.T
// δbtail <- δZ
δB
:=
δbtail
.
Update
(
δZ
)
// XXX
check δB
_
=
δB
// XXX
assert δB.keys == treeRoot
// δT = δB[treeRoot]
// all keys from d12/tracked are present in δT
//for (k,v) in d12:
// if k in initialTrackedKeys:
// assert k in δB
// assert k in δT
// assert δT[k] == v
// else:
// if k in δT:
// assert δT[k] == v
//
// XXX all keys from δT are present in d12
}
func
TestΔBTail
(
t
*
testing
.
T
)
{
...
...
@@ -289,7 +296,7 @@ func TestΔBTail(t *testing.T) {
err
:=
db
.
Close
();
X
(
err
)
}()
// XCommitTree calls tg.Commit and returns δZ corresponding to
made
transaction.
// XCommitTree calls tg.Commit and returns δZ corresponding to
committed
transaction.
XCommitTree
:=
func
(
tree
string
)
*
zodb
.
EventCommit
{
defer
exc
.
Contextf
(
"commit %s"
,
tree
)
...
...
@@ -345,10 +352,9 @@ func TestΔBTail(t *testing.T) {
for
_
,
tree
:=
range
testv
{
δZ
:=
XCommitTree
(
tree
)
// tree2
at2
:=
δZ
.
Tid
//at2, err := tg.Commit(tree); X(err) // tree2
kv2
:=
XGetTree
(
db
,
at2
,
tg
.
treeRoot
)
verifyΔBTail
(
t
,
db
,
tg
.
treeRoot
,
at1
,
at2
,
kv1
,
kv2
,
δZ
)
x
verifyΔBTail
(
t
,
db
,
tg
.
treeRoot
,
at1
,
at2
,
kv1
,
kv2
,
δZ
)
at1
=
at2
kv1
=
kv2
...
...
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