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

This packet has been replaced by the (simpler) notifyReplicationDone (Test required).

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1478 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ec3af08c
......@@ -145,71 +145,6 @@ class MasterStorageHandlerTests(NeoTestBase):
(tid_list, ) = packet.decode()
self.assertEqual(len(tid_list), 3)
def test_14_notifyPartitionChanges(self):
service = self.service
node, conn = self.identifyToMasterNode()
uuid = node.getUUID()
packet = Packets.NotifyPartitionChanges()
# do not answer if not a storage node
client, client_conn = self.identifyToMasterNode(node_type=NodeTypes.CLIENT,
port=self.client_port)
client_uuid = client.getUUID()
self.checkUnexpectedPacketRaised(service.notifyPartitionChanges,
conn, packet, None, None)
# send a bad state, must not be take into account
storage_uuid = self.identifyToMasterNode(port=self.storage_port+1)
offset = 1
cell_list = [(offset, uuid, CellStates.FEEDING),]
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
service.notifyPartitionChanges(conn, packet, self.app.pt.getID(), cell_list)
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
# send for another node, must not be take into account
conn = self.getFakeConnection(uuid, self.storage_address)
offset = 1
cell_list = [(offset, storage_uuid, CellStates.UP_TO_DATE),]
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
service.notifyPartitionChanges(conn, packet, self.app.pt.getID(), cell_list)
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
# send for itself, must be taken into account
# and the feeding node must be removed
conn = self.getFakeConnection(uuid, self.storage_address)
cell_list = [(offset, uuid, CellStates.UP_TO_DATE),]
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
# mark the second storage node as feeding and say we are up to date
# second node must go to discarded state and first one to up to date state
self.app.pt.setCell(offset, self.app.nm.getByUUID(storage_uuid),
CellStates.FEEDING)
cell_list = [(offset, uuid, CellStates.UP_TO_DATE),]
cells = self.app.pt.getRow(offset)
for cell, state in cells:
if cell == storage_uuid:
self.assertEquals(state, CellStates.FEEDING)
else:
self.assertEquals(state, CellStates.OUT_OF_DATE)
lptid = self.app.pt.getID()
service.notifyPartitionChanges(conn, packet, self.app.pt.getID(), cell_list)
self.failUnless(lptid < self.app.pt.getID())
cells = self.app.pt.getRow(offset)
for cell, state in cells:
if cell == uuid:
self.assertEquals(state, CellStates.UP_TO_DATE)
else:
self.assertEquals(state, CellStates.DISCARDED)
def _testWithMethod(self, method, state):
service = self.service
# define two nodes
......
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