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

The client never send this packet too.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1480 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 821efe8d
......@@ -68,76 +68,6 @@ class MasterClientHandlerTests(NeoTestBase):
return uuid
# Tests
def test_05_notifyNodeInformation(self):
service = self.service
uuid = self.identifyToMasterNode()
packet = Packets.NotifyNodeInformation()
# tell the master node that is not running any longer, it must raises
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.MASTER, ('127.0.0.1', self.master_port),
self.app.uuid, NodeStates.DOWN),]
self.assertRaises(RuntimeError, service.notifyNodeInformation, conn, packet, node_list)
# tell the master node that it's running, nothing change
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.MASTER, ('127.0.0.1', self.master_port),
self.app.uuid, NodeStates.RUNNING),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
# notify about a client node, don't care
new_uuid = self.getNewUUID()
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.CLIENT, ('127.0.0.1', self.client_port),
new_uuid, NodeStates.BROKEN),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
# notify about an unknown node, don't care
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.STORAGE, ('127.0.0.1', 11010), new_uuid,
NodeStates.BROKEN),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
# notify about a known node but with bad address, don't care
self.app.nm.createStorage(
address=("127.0.0.1", 11011),
uuid=self.getNewUUID(),
)
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.STORAGE, ('127.0.0.1', 11012), uuid, NodeStates.BROKEN),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
# notify node is running, as PMN already know it, nothing is done
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.STORAGE, ('127.0.0.1', self.storage_port), uuid,
NodeStates.RUNNING),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
# notify node is temp down, must be taken into account
ptid = self.app.pt.getID()
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.STORAGE, ('127.0.0.1', self.storage_port), uuid,
NodeStates.TEMPORARILY_DOWN),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
sn = self.app.nm.getStorageList()[0]
self.assertEquals(sn.getState(), NodeStates.TEMPORARILY_DOWN)
self.assertEquals(ptid, self.app.pt.getID())
# notify node is broken, must be taken into account and partition must changed
conn = self.getFakeConnection(uuid, self.storage_address)
node_list = [(NodeTypes.STORAGE, ('127.0.0.1', self.storage_port), uuid,
NodeStates.BROKEN),]
service.notifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
sn = self.app.nm.getStorageList()[0]
self.assertEquals(sn.getState(), NodeStates.BROKEN)
self.failUnless(ptid < self.app.pt.getID())
def test_07_askBeginTransaction(self):
service = self.service
uuid = self.identifyToMasterNode()
......
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