Commit 0f21db8c authored by Grégory Wisniewski's avatar Grégory Wisniewski

Update tests according to previous commit.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@603 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1f6719db
......@@ -25,15 +25,18 @@ from neo.client.exception import NEOStorageError, NEOStorageNotFoundError, \
NEOStorageConflictError
from neo import protocol
from neo.protocol import *
from neo.pt import PartitionTable
import neo.connection
import os
def connectToPrimaryMasterNode(self):
# TODO: remove monkeypatching and properly simulate master node connection
def _getMasterConnection(self):
self.uuid = 'C' * 16
pass
Application.connectToPrimaryMasterNode_org = Application.connectToPrimaryMasterNode
Application.connectToPrimaryMasterNode = connectToPrimaryMasterNode
self.num_partitions = 10
self.num_replicas = 1
self.pt = PartitionTable(self.num_partitions, self.num_replicas)
return Mock() # master_conn
Application._getMasterConnection_ord = Application._getMasterConnection
Application._getMasterConnection = _getMasterConnection
def _waitMessage(self, conn=None, msg_id=None, handler=None):
if conn is not None and handler is not None:
......@@ -85,10 +88,7 @@ class ClientApplicationTest(NeoTestBase):
def getApp(self, master_nodes='127.0.0.1:10010', name='test',
connector='SocketConnector', **kw):
# TODO: properly simulate master node connection
app = Application(master_nodes, name, connector, **kw)
app.num_partitions = 10
app.num_replicas = 2
return app
def makeOID(self, value=None):
......
......@@ -149,12 +149,7 @@ class ClientHandlerTest(NeoTestBase):
key_2: queue_2}
dispatcher = Dispatcher()
method(dispatcher, app, handler_class, conn=conn)
# Check that master was notified of the failure
(node_list, ) = self.checkNotifyNodeInformation(app.master_conn, decode=True)
# Test sanity check
# the test below is disabled because the msg_id is now set by the connection
expected_node_list = [(STORAGE_NODE_TYPE, storage_ip, storage_port, fake_storage_node_uuid, state), ]
self.assertEquals(node_list, expected_node_list)
# The master should be notified, but this is done in app.py
# Check that failed connection got removed from connection pool
removeConnection_call_list = app.cp.mockGetNamedCalls('removeConnection')
# Test sanity check
......
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