Commit 14e700b4 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Update tests for storage according to commit #416


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@424 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 57227400
...@@ -410,7 +410,8 @@ server: 127.0.0.1:10020 ...@@ -410,7 +410,8 @@ server: 127.0.0.1:10020
ip_address='127.0.0.1', ip_address='127.0.0.1',
port=self.master_port, port=self.master_port,
num_partitions=self.app.num_partitions, num_partitions=self.app.num_partitions,
num_replicas=self.app.num_replicas) num_replicas=self.app.num_replicas,
your_uuid=self.getNewUUID())
self.checkCalledAbort(conn) self.checkCalledAbort(conn)
def test_09_handleAcceptNodeIdentification2(self): def test_09_handleAcceptNodeIdentification2(self):
...@@ -431,7 +432,8 @@ server: 127.0.0.1:10020 ...@@ -431,7 +432,8 @@ server: 127.0.0.1:10020
node_type=STORAGE_NODE_TYPE, node_type=STORAGE_NODE_TYPE,
ip_address='127.0.0.1', ip_address='127.0.0.1',
num_partitions=self.num_partitions, num_partitions=self.num_partitions,
num_replicas=self.app.num_replicas) num_replicas=self.app.num_replicas,
your_uuid=self.getNewUUID())
self.assertTrue(server not in self.app.nm.server_dict) self.assertTrue(server not in self.app.nm.server_dict)
self.assertEquals(len(conn.mockGetNamedCalls("close")), 1) self.assertEquals(len(conn.mockGetNamedCalls("close")), 1)
...@@ -449,7 +451,8 @@ server: 127.0.0.1:10020 ...@@ -449,7 +451,8 @@ 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',
num_partitions=self.num_partitions, num_partitions=self.num_partitions,
num_replicas=self.app.num_replicas) num_replicas=self.app.num_replicas,
your_uuid=self.getNewUUID())
server = ('127.0.0.1', self.master_port) server = ('127.0.0.1', self.master_port)
self.assertTrue(server not in self.app.nm.server_dict) self.assertTrue(server not in self.app.nm.server_dict)
self.assertEquals(len(conn.mockGetNamedCalls("close")), 1) self.assertEquals(len(conn.mockGetNamedCalls("close")), 1)
...@@ -468,6 +471,7 @@ server: 127.0.0.1:10020 ...@@ -468,6 +471,7 @@ server: 127.0.0.1:10020
'port':self.master_port, 'port':self.master_port,
'node_type':MASTER_NODE_TYPE, 'node_type':MASTER_NODE_TYPE,
'ip_address':'127.0.0.1', 'ip_address':'127.0.0.1',
'your_uuid': self.getNewUUID()
} }
self.app.num_partitions = 1 self.app.num_partitions = 1
self.app.num_replicas = 1 self.app.num_replicas = 1
...@@ -488,7 +492,7 @@ server: 127.0.0.1:10020 ...@@ -488,7 +492,7 @@ server: 127.0.0.1:10020
def test_09_handleAcceptNodeIdentification5(self): def test_09_handleAcceptNodeIdentification5(self):
# no PT # no PT
uuid = self.getNewUUID() uuid, your_uuid = self.getNewUUID(), self.getNewUUID()
self.app.num_partitions = None self.app.num_partitions = None
self.app.num_replicas = None self.app.num_replicas = None
conn = Mock({"isListeningConnection": False, conn = Mock({"isListeningConnection": False,
...@@ -505,7 +509,8 @@ server: 127.0.0.1:10020 ...@@ -505,7 +509,8 @@ 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',
num_partitions=self.num_partitions, num_partitions=self.num_partitions,
num_replicas=self.num_replicas) num_replicas=self.num_replicas,
your_uuid=your_uuid)
# check PT # check PT
self.assertEquals(self.app.num_partitions, self.num_partitions) self.assertEquals(self.app.num_partitions, self.num_partitions)
self.assertEquals(self.app.num_replicas, self.num_replicas) self.assertEquals(self.app.num_replicas, self.num_replicas)
...@@ -529,7 +534,7 @@ server: 127.0.0.1:10020 ...@@ -529,7 +534,7 @@ server: 127.0.0.1:10020
"getAddress" : ("127.0.0.1", self.master_port), }) "getAddress" : ("127.0.0.1", self.master_port), })
self.app.trying_master_node = self.trying_master_node self.app.trying_master_node = self.trying_master_node
packet = Packet(msg_id=1, msg_type=ACCEPT_NODE_IDENTIFICATION) packet = Packet(msg_id=1, msg_type=ACCEPT_NODE_IDENTIFICATION)
uuid = self.getNewUUID() uuid, your_uuid = self.getNewUUID(), self.getNewUUID()
self.assertNotEquals(self.app.trying_master_node.getUUID(), uuid) self.assertNotEquals(self.app.trying_master_node.getUUID(), uuid)
self.bootstrap.handleAcceptNodeIdentification( self.bootstrap.handleAcceptNodeIdentification(
conn=conn, conn=conn,
...@@ -539,7 +544,8 @@ server: 127.0.0.1:10020 ...@@ -539,7 +544,8 @@ 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',
num_partitions=self.num_partitions, num_partitions=self.num_partitions,
num_replicas=self.num_replicas) num_replicas=self.num_replicas,
your_uuid=your_uuid)
# uuid # uuid
self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 1) self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 1)
call = conn.mockGetNamedCalls("setUUID")[0] call = conn.mockGetNamedCalls("setUUID")[0]
......
...@@ -467,7 +467,9 @@ server: 127.0.0.1:10020 ...@@ -467,7 +467,9 @@ server: 127.0.0.1:10020
ip_address='127.0.0.1', ip_address='127.0.0.1',
port=self.master_port, port=self.master_port,
num_partitions=self.app.num_partitions, num_partitions=self.app.num_partitions,
num_replicas=self.app.num_replicas) num_replicas=self.app.num_replicas,
your_uuid=INVALID_UUID,
)
def test_10_handleAcceptNodeIdentification2(self): def test_10_handleAcceptNodeIdentification2(self):
# server connection rejected # server connection rejected
...@@ -480,7 +482,8 @@ server: 127.0.0.1:10020 ...@@ -480,7 +482,8 @@ server: 127.0.0.1:10020
ip_address='127.0.0.1', ip_address='127.0.0.1',
port=self.master_port, port=self.master_port,
num_partitions=self.app.num_partitions, num_partitions=self.app.num_partitions,
num_replicas=self.app.num_replicas num_replicas=self.app.num_replicas,
your_uuid=INVALID_UUID,
) )
def test_11_handleAnswerPrimaryMaster(self): def test_11_handleAnswerPrimaryMaster(self):
......
...@@ -301,7 +301,7 @@ server: 127.0.0.1:10020 ...@@ -301,7 +301,7 @@ server: 127.0.0.1:10020
p = Packet(msg_id=1, msg_type=ACCEPT_NODE_IDENTIFICATION) p = Packet(msg_id=1, msg_type=ACCEPT_NODE_IDENTIFICATION)
self.verification.handleAcceptNodeIdentification(conn, p, CLIENT_NODE_TYPE, self.verification.handleAcceptNodeIdentification(conn, p, CLIENT_NODE_TYPE,
self.getNewUUID(),"127.0.0.1", self.client_port, self.getNewUUID(),"127.0.0.1", self.client_port,
1009, 2) 1009, 2, uuid)
self.checkCalledAbort(conn) self.checkCalledAbort(conn)
def test_07_handleAnswerPrimaryMaster(self): def test_07_handleAnswerPrimaryMaster(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