Commit 3b6b372b authored by Grégory Wisniewski's avatar Grégory Wisniewski

Replace a forgotten protocolError call by a raise of ProtocolError exception.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@513 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2c0d04c7
...@@ -116,9 +116,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -116,9 +116,7 @@ class BootstrapEventHandler(StorageEventHandler):
raise protocol.NotReadyError raise protocol.NotReadyError
if name != app.name: if name != app.name:
logging.error('reject an alien cluster') logging.error('reject an alien cluster')
conn.answer(protocol.protocolError('invalid cluster name'), packet) raise protocol.ProtocolError( 'invalid cluster name')
conn.abort()
return
addr = (ip_address, port) addr = (ip_address, port)
node = app.nm.getNodeByServer(addr) node = app.nm.getNodeByServer(addr)
......
...@@ -110,6 +110,10 @@ server: 127.0.0.1:10020 ...@@ -110,6 +110,10 @@ server: 127.0.0.1:10020
def getLastUUID(self): def getLastUUID(self):
return self.uuid return self.uuid
def checkProtocolErrorRaised(self, method, *args, **kwargs):
""" Check if the ProtocolError exception was raised """
self.assertRaises(protocol.ProtocolError, method, *args, **kwargs)
def checkUnexpectedPacketRaised(self, method, *args, **kwargs): def checkUnexpectedPacketRaised(self, method, *args, **kwargs):
""" Check if the UnexpectedPacketError exception wxas raised """ """ Check if the UnexpectedPacketError exception wxas raised """
self.assertRaises(protocol.UnexpectedPacketError, method, *args, **kwargs) self.assertRaises(protocol.UnexpectedPacketError, method, *args, **kwargs)
...@@ -325,7 +329,8 @@ server: 127.0.0.1:10020 ...@@ -325,7 +329,8 @@ server: 127.0.0.1:10020
packet = Packet(msg_type=REQUEST_NODE_IDENTIFICATION) packet = Packet(msg_type=REQUEST_NODE_IDENTIFICATION)
conn = Mock({"isServerConnection": True, conn = Mock({"isServerConnection": True,
"getAddress" : ("127.0.0.1", self.master_port), }) "getAddress" : ("127.0.0.1", self.master_port), })
self.bootstrap.handleRequestNodeIdentification( self.checkProtocolErrorRaised(
self.bootstrap.handleRequestNodeIdentification,
conn=conn, conn=conn,
uuid=self.getNewUUID(), uuid=self.getNewUUID(),
packet=packet, packet=packet,
...@@ -333,7 +338,6 @@ server: 127.0.0.1:10020 ...@@ -333,7 +338,6 @@ server: 127.0.0.1:10020
node_type=MASTER_NODE_TYPE, node_type=MASTER_NODE_TYPE,
ip_address='127.0.0.1', ip_address='127.0.0.1',
name='INVALID_NAME',) name='INVALID_NAME',)
self.checkCalledAbort(conn)
self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 0) self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 0)
def test_08_handleRequestNodeIdentification4(self): def test_08_handleRequestNodeIdentification4(self):
......
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