Commit df73b82a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1b962f03
......@@ -729,19 +729,64 @@ def test_restructure():
# make sure changed objects are marked as such and so included into commit
z = Z(0,2)
transaction.commit()
R(z, 'T1/B0:a-B2:c')
z = Z(0,2,3)
transaction.commit()
assert Sv(z) == 'T1/B0:a-B2:c'
zconn.cacheMinimize() # force z state to be reloaded from storage
assert Sv(z) == 'T1/B0:a-B2:c' # will fail if T or B is not marked as changed
def Rz(newtopo):
R(z, newtopo)
transaction.commit()
assert Sv(z) == newtopo
zconn.cacheMinimize() # force z state to be reloaded from storage
assert Sv(z) == newtopo # will fail if T or B is not marked as changed
xbtree._zbcheck(z)
Rz('T/B0:a,2:c,3:d')
Rz('T1/B0:a-B2:c,3:d')
Rz('T2/B0:a-B2:c,3:d')
Rz('T3/B0:a,2:c-B3:d')
Rz('T2/T-T3/B0:a-B2:c-B3:d')
"""
# XXX T/T1/T-T/B0:g-B1:e,2:d,3:h -> T1/T-T3/B0:g-T-T/B1:e,2:d-B3:h
# (commit asserts that nothing is changed)
R(z, 'T/B0:a,2:c') # one more similar check
# XXX leads restructure to generate corrupt btrees
z = Z()
transaction.commit()
assert Sv(z) == 'T/B0:a,2:c'
z[0] = xdecode('g')
z[1] = xdecode('e')
z[2] = xdecode('d')
z[3] = xdecode('h')
R(z, 'T/T1/T-T/B0:g-B1:e,2:d,3:h')
transaction.commit()
assert Sv(z) == 'T/T1/T-T/B0:g-B1:e,2:d,3:h'
zconn.cacheMinimize()
assert Sv(z) == 'T/T1/T-T/B0:g-B1:e,2:d,3:h'
xbtree._zbcheck(z)
z[0] = xdecode('h')
z[1] = xdecode('b')
del z[2]
del z[3]
R(z, 'T1/B0:h-B1:b')
transaction.commit()
assert Sv(z) == 'T1/B0:h-B1:b'
zconn.cacheMinimize()
assert Sv(z) == 'T/B0:a,2:c'
assert Sv(z) == 'T1/B0:h-B1:b' # XXX fails here
xbtree._zbcheck(z)
z[0] = xdecode('g')
z[1] = xdecode('e')
z[2] = xdecode('d')
z[3] = xdecode('h')
R(z, 'T1/T-T3/B0:g-T-T/B1:e,2:d-B3:h')
transaction.commit()
assert Sv(z) == 'T1/T-T3/B0:g-T-T/B1:e,2:d-B3:h'
zconn.cacheMinimize()
assert Sv(z) == 'T1/T-T3/B0:g-T-T/B1:e,2:d-B3:h'
xbtree._zbcheck(z)
"""
# ---- tests on automatically generated topologies ----
......
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