Commit ef4d58f6 authored by Julien Muchembled's avatar Julien Muchembled

qa: extend test reproducing the migration of a big ZODB to NEO

parent ab082d7e
...@@ -933,39 +933,60 @@ class ReplicationTests(NEOThreadedTest): ...@@ -933,39 +933,60 @@ class ReplicationTests(NEOThreadedTest):
def testReplicationBlockedByUnfinished2(self): def testReplicationBlockedByUnfinished2(self):
self.testReplicationBlockedByUnfinished1(True) self.testReplicationBlockedByUnfinished1(True)
@with_cluster(partitions=6, storage_count=4, start_cluster=0) @with_cluster(partitions=6, storage_count=5, start_cluster=0)
def testCloneStorage(self, cluster): def testSplitAndMakeResilientUsingClone(self, cluster):
""" """
Test cloning of storage nodes using --new-nid instead NEO replication. Test cloning of storage nodes using --new-nid instead NEO replication.
""" """
s01 = cluster.storage_list[:2] s0 = cluster.storage_list[0]
s23 = cluster.storage_list[2:] s12 = cluster.storage_list[1:3]
cluster.start(storage_list=s01) s34 = cluster.storage_list[3:]
cluster.start(storage_list=(s0,))
cluster.importZODB()(6) cluster.importZODB()(6)
self.tic() for s in s12:
with Patch(cluster, storage_list=s01): s.start()
cluster.sortStorageList() self.tic()
cluster.stop() drop_list = [s0.uuid]
cluster.storage_list[:2] = s01 self.assertRaises(SystemExit, cluster.neoctl.tweakPartitionTable,
storage_dict = {} drop_list)
for s, d in zip(s01, s23): cluster.enableStorageList(s12)
def expected(changed):
s0 = 1, CellStates.UP_TO_DATE
s = CellStates.OUT_OF_DATE if changed else CellStates.UP_TO_DATE
return changed, 3 * [[s0, (2, s)], [s0, (3, s)]]
for dry_run in True, False:
self.assertEqual(expected(True),
cluster.neoctl.tweakPartitionTable(drop_list, dry_run))
self.tic()
self.assertEqual(expected(False),
cluster.neoctl.tweakPartitionTable(drop_list))
for s, d in zip(s12, s34):
s.stop()
cluster.join((s,))
s.resetNode()
d.dm.restore(s.dm.dump()) d.dm.restore(s.dm.dump())
d.resetNode(new_nid=True) d.resetNode(new_nid=True)
storage_dict[s] = NodeStates.RUNNING s.start()
storage_dict[d] = NodeStates.DOWN d.start()
cluster.start(storage_dict) self.tic()
cluster.join(s23) self.assertEqual(cluster.getNodeState(s), NodeStates.RUNNING)
for d in s23: self.assertEqual(cluster.getNodeState(d), NodeStates.DOWN)
cluster.join((d,))
d.resetNode(new_nid=False) d.resetNode(new_nid=False)
d.start() d.start()
self.tic() self.tic()
self.checkReplicas(cluster) self.checkReplicas(cluster)
expected = '|'.join(['U.U.|.U.U'] * 3) expected = '|'.join(['UU.U.|U.U.U'] * 3)
self.assertPartitionTable(cluster, expected) self.assertPartitionTable(cluster, expected)
cluster.neoctl.setNumReplicas(1) cluster.neoctl.setNumReplicas(1)
cluster.neoctl.tweakPartitionTable() cluster.neoctl.tweakPartitionTable(drop_list)
self.tic() self.tic()
self.assertPartitionTable(cluster, expected) self.assertPartitionTable(cluster, expected)
s0.stop()
cluster.join((s0,))
cluster.neoctl.dropNode(s0.uuid)
expected = '|'.join(['U.U.|.U.U'] * 3)
self.assertPartitionTable(cluster, expected)
@with_cluster(partitions=5, replicas=2, storage_count=3) @with_cluster(partitions=5, replicas=2, storage_count=3)
def testCheckReplicas(self, cluster): def testCheckReplicas(self, cluster):
......
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