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

Fix some tests about accessors on partitions number, replicas and partition

table ID.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@673 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 25c190e1
......@@ -263,7 +263,7 @@ class MasterElectionTests(NeoTestBase):
conn = ClientConnection(self.app.em, self.election, addr = ("127.0.0.1", self.master_port),
connector_handler = DoNothingConnector)
args = (MASTER_NODE_TYPE, uuid, '127.0.0.1', self.master_port,
self.app.num_partitions, self.app.num_replicas, self.app.uuid)
self.app.pt.getPartitions(), self.app.pt.getReplicas(), self.app.uuid)
p = protocol.acceptNodeIdentification(*args)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
......@@ -272,8 +272,8 @@ class MasterElectionTests(NeoTestBase):
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.election.handleAcceptNodeIdentification(conn, p, STORAGE_NODE_TYPE,
uuid, "127.0.0.1", self.master_port,
self.app.num_partitions,
self.app.num_replicas,
self.app.pt.getPartitions(),
self.app.pt.getReplicas(),
self.app.uuid
)
self.assertEqual(conn.getConnector(), None)
......@@ -286,7 +286,7 @@ class MasterElectionTests(NeoTestBase):
conn = ClientConnection(self.app.em, self.election, addr = ("127.0.0.1", self.master_port),
connector_handler = DoNothingConnector)
args = (MASTER_NODE_TYPE, uuid, '127.0.0.1', self.master_port,
self.app.num_partitions, self.app.num_replicas, self.app.uuid)
self.app.pt.getPartitions(), self.app.pt.getReplicas(), self.app.uuid)
p = protocol.acceptNodeIdentification(*args)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
......@@ -295,8 +295,8 @@ class MasterElectionTests(NeoTestBase):
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.election.handleAcceptNodeIdentification(conn, p, STORAGE_NODE_TYPE,
uuid, "127.0.0.2", self.master_port,
self.app.num_partitions,
self.app.num_replicas,
self.app.pt.getPartitions(),
self.app.pt.getReplicas(),
self.app.uuid)
self.assertEqual(conn.getConnector(), None)
......@@ -306,7 +306,7 @@ class MasterElectionTests(NeoTestBase):
conn = ClientConnection(self.app.em, self.election, addr = ("127.0.0.1", self.master_port),
connector_handler = DoNothingConnector)
args = (MASTER_NODE_TYPE, uuid, '127.0.0.1', self.master_port,
self.app.num_partitions, self.app.num_replicas, self.app.uuid)
self.app.pt.getPartitions(), self.app.pt.getReplicas(), self.app.uuid)
p = protocol.acceptNodeIdentification(*args)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
......@@ -316,8 +316,8 @@ class MasterElectionTests(NeoTestBase):
self.election.handleAcceptNodeIdentification(conn, p, MASTER_NODE_TYPE,
uuid, "127.0.0.1", self.master_port,
self.app.num_partitions,
self.app.num_replicas,
self.app.pt.getPartitions(),
self.app.pt.getReplicas(),
self.app.uuid)
self.assertEqual(self.app.nm.getNodeByServer(conn.getAddress()).getUUID(), uuid)
self.assertEqual(conn.getUUID(), uuid)
......
......@@ -454,14 +454,14 @@ class MasterRecoveryTests(NeoTestBase):
packet = Packet(msg_type=ANSWER_LAST_IDS)
loid = self.app.loid
ltid = self.app.ltid
lptid = self.app.lptid
lptid = self.app.pt.getID()
# do not answer if no uuid
conn = self.getFakeConnection(None, self.storage_port)
node_list = []
self.checkIdenficationRequired(recovery.handleAnswerLastIDs, conn, packet, None, None, None)
self.assertEquals(loid, self.app.loid)
self.assertEquals(ltid, self.app.ltid)
self.assertEquals(lptid, self.app.lptid)
self.assertEquals(lptid, self.app.pt.getID())
# do not care if master node call it
master_uuid = self.identifyToMasterNode(node_type=MASTER_NODE_TYPE, port=self.master_port)
conn = self.getFakeConnection(master_uuid, self.master_address)
......@@ -469,7 +469,7 @@ class MasterRecoveryTests(NeoTestBase):
self.checkUnexpectedPacketRaised(recovery.handleAnswerLastIDs, conn, packet, None, None, None)
self.assertEquals(loid, self.app.loid)
self.assertEquals(ltid, self.app.ltid)
self.assertEquals(lptid, self.app.lptid)
self.assertEquals(lptid, self.app.pt.getID())
# send information which are later to what PMN knows, this must update target node
conn = self.getFakeConnection(uuid, self.storage_port)
node_list = []
......@@ -479,14 +479,14 @@ class MasterRecoveryTests(NeoTestBase):
new_oid = pack('!Q', oid + 1)
upper, lower = unpack('!LL', ltid)
new_tid = pack('!LL', upper, lower + 10)
self.failUnless(new_ptid > self.app.lptid)
self.failUnless(new_ptid > self.app.pt.getID())
self.failUnless(new_oid > self.app.loid)
self.failUnless(new_tid > self.app.ltid)
self.assertEquals(self.app.target_uuid, None)
recovery.handleAnswerLastIDs(conn, packet, new_oid, new_tid, new_ptid)
self.assertEquals(new_oid, self.app.loid)
self.assertEquals(new_tid, self.app.ltid)
self.assertEquals(new_ptid, self.app.lptid)
self.assertEquals(new_ptid, self.app.pt.getID())
self.assertEquals(self.app.target_uuid,uuid)
......
This diff is collapsed.
......@@ -456,14 +456,14 @@ class MasterVerificationTests(NeoTestBase):
packet = Packet(msg_type=ANSWER_LAST_IDS)
loid = self.app.loid
ltid = self.app.ltid
lptid = self.app.lptid
lptid = self.app.pt.getID()
# do not answer if no uuid
conn = self.getFakeConnection(None, self.storage_address)
node_list = []
self.checkIdenficationRequired(verification.handleAnswerLastIDs, conn, packet, None, None, None)
self.assertEquals(loid, self.app.loid)
self.assertEquals(ltid, self.app.ltid)
self.assertEquals(lptid, self.app.lptid)
self.assertEquals(lptid, self.app.pt.getID())
# do not care if master node call it
master_uuid = self.identifyToMasterNode(node_type=MASTER_NODE_TYPE, port=self.master_port)
conn = self.getFakeConnection(master_uuid, self.master_address)
......@@ -471,7 +471,7 @@ class MasterVerificationTests(NeoTestBase):
self.checkUnexpectedPacketRaised(verification.handleAnswerLastIDs, conn, packet, None, None, None)
self.assertEquals(loid, self.app.loid)
self.assertEquals(ltid, self.app.ltid)
self.assertEquals(lptid, self.app.lptid)
self.assertEquals(lptid, self.app.pt.getID())
# send information which are later to what PMN knows, this must raise
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = []
......@@ -481,13 +481,13 @@ class MasterVerificationTests(NeoTestBase):
new_oid = pack('!Q', oid + 1)
upper, lower = unpack('!LL', ltid)
new_tid = pack('!LL', upper, lower + 10)
self.failUnless(new_ptid > self.app.lptid)
self.failUnless(new_ptid > self.app.pt.getID())
self.failUnless(new_oid > self.app.loid)
self.failUnless(new_tid > self.app.ltid)
self.assertRaises(VerificationFailure, verification.handleAnswerLastIDs, conn, packet, new_oid, new_tid, new_ptid)
self.assertNotEquals(new_oid, self.app.loid)
self.assertNotEquals(new_tid, self.app.ltid)
self.assertNotEquals(new_ptid, self.app.lptid)
self.assertNotEquals(new_ptid, self.app.pt.getID())
def test_10_handleAnswerPartitionTable(self):
verification = self.verification
......
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