Commit b007451a authored by Grégory Wisniewski's avatar Grégory Wisniewski

Update test for storage/bootstrap.py to follow changes on num_replicas.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@462 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f5726ab1
...@@ -475,20 +475,29 @@ server: 127.0.0.1:10020 ...@@ -475,20 +475,29 @@ server: 127.0.0.1:10020
} }
self.app.num_partitions = 1 self.app.num_partitions = 1
self.app.num_replicas = 1 self.app.num_replicas = 1
# partition number as changed -> error
self.assertRaises( self.assertRaises(
RuntimeError, RuntimeError,
self.bootstrap.handleAcceptNodeIdentification, self.bootstrap.handleAcceptNodeIdentification,
num_partitions=self.app.num_partitions + 1, num_partitions=self.app.num_partitions + 2,
num_replicas=self.num_replicas, num_replicas=self.app.num_replicas,
**args) **args)
self.assertRaises( self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 0)
RuntimeError, self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.bootstrap.handleAcceptNodeIdentification, self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
# create a new partition table
self.bootstrap.handleAcceptNodeIdentification(
num_partitions=self.app.num_partitions, num_partitions=self.app.num_partitions,
num_replicas=self.num_replicas + 1, num_replicas=self.num_replicas + 1,
**args) **args)
self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 0) #self.assertEquals(self.app.num_partitions, self.num_partitions)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0) self.assertEquals(self.app.num_replicas, self.num_replicas + 1)
self.assertEqual(self.app.num_partitions, self.app.dm.getNumPartitions())
self.assertTrue(isinstance(self.app.pt, PartitionTable))
self.assertEquals(self.app.ptid, self.app.dm.getPTID())
self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 1)
def test_09_handleAcceptNodeIdentification5(self): def test_09_handleAcceptNodeIdentification5(self):
# no errors # no errors
...@@ -515,7 +524,7 @@ server: 127.0.0.1:10020 ...@@ -515,7 +524,7 @@ server: 127.0.0.1:10020
# check PT # check PT
self.assertEquals(self.app.num_partitions, self.num_partitions) self.assertEquals(self.app.num_partitions, self.num_partitions)
self.assertEquals(self.app.num_replicas, self.num_replicas) self.assertEquals(self.app.num_replicas, self.num_replicas)
self.assertEqual(self.num_partitions, self.app.dm.getNumPartitions()) self.assertEqual(self.app.num_partitions, self.app.dm.getNumPartitions())
self.assertTrue(isinstance(self.app.pt, PartitionTable)) self.assertTrue(isinstance(self.app.pt, PartitionTable))
self.assertEquals(self.app.ptid, self.app.dm.getPTID()) self.assertEquals(self.app.ptid, self.app.dm.getPTID())
# uuid # uuid
......
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