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

A storage must never send this packet to the master node. The master has a...

A storage must never send this packet to the master node. The master has a view of all nodes and detect itself any breakage.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1477 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent de257d64
......@@ -65,77 +65,6 @@ class MasterStorageHandlerTests(NeoTestBase):
conn = self.getFakeConnection(node.getUUID(),node.getAddress())
return (node, conn)
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(), CellStates.BROKEN)
self.failUnless(ptid < self.app.pt.getID())
def test_10_notifyInformationLocked(self):
service = self.service
node, conn = self.identifyToMasterNode(port=10020)
......
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