Commit 9181c5d9 authored by Kirill Smelkov's avatar Kirill Smelkov

X Restructure; verify that it marks as changed only modifed nodes

parent e71383aa
......@@ -737,12 +737,12 @@ def test_restructure():
R(z, 'T4/T2-T/T-T-T6,10/B1-B3-T-T-T/T-B7-B11/B5')
R(z, 'T/B1,3,5,7,11')
# make sure changed objects are marked as such and so included into commit
# verify changed objects are marked as such and so included into commit
# (just R also partly verifies this on every call)
z = Z(0,2,3)
transaction.commit()
def Rz(newtopo):
R(z, newtopo)
R(z, newtopo, dontcommit=True)
transaction.commit()
assert Sv(z) == newtopo
zconn.cacheMinimize() # force z state to be reloaded from storage
......@@ -755,48 +755,37 @@ def test_restructure():
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)
# XXX leads restructure to generate corrupt btrees
z = Z()
transaction.commit()
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.zcheck(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) == 'T1/B0:h-B1:b' # XXX fails here
xbtree.zcheck(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')
# make sure that only modified nodes are marked as changed.
z = Z(0,1,2,3)
R(z, 'T1/T-T2/B0-B1-B2,3')
tl, tr = assertT(z, [1], 'T','T')
b0, = assertT(tl, [], 'B')
b1, b23 = assertT(tr, [2], 'B','B')
assertB(b0, 0)
assertB(b1, 1)
assertB(b23, 2,3)
assert z._p_changed == False
assert tl._p_changed == False
assert tr._p_changed == False
assert b0._p_changed == False
assert b1._p_changed == False
assert b23._p_changed == False
R(z, 'T1/T-T3/B0-B1,2-B3', dontcommit=True) # reflow right arm
assertT(z, [1], tl, tr)
assertT(tl, [], b0)
assertT(tr, [3], b1, b23) # changed
assertB(b0, 0)
assertB(b1, 1,2) # changed
assertB(b23, 3) # changed
assert z._p_changed == False
assert tl._p_changed == False
assert tr._p_changed == True
assert b0._p_changed == False
assert b1._p_changed == True
assert b23._p_changed == True
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.zcheck(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