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, \ ...@@ -25,15 +25,18 @@ from neo.client.exception import NEOStorageError, NEOStorageNotFoundError, \
NEOStorageConflictError NEOStorageConflictError
from neo import protocol from neo import protocol
from neo.protocol import * from neo.protocol import *
from neo.pt import PartitionTable
import neo.connection import neo.connection
import os import os
def connectToPrimaryMasterNode(self): def _getMasterConnection(self):
# TODO: remove monkeypatching and properly simulate master node connection
self.uuid = 'C' * 16 self.uuid = 'C' * 16
pass self.num_partitions = 10
Application.connectToPrimaryMasterNode_org = Application.connectToPrimaryMasterNode self.num_replicas = 1
Application.connectToPrimaryMasterNode = connectToPrimaryMasterNode 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): def _waitMessage(self, conn=None, msg_id=None, handler=None):
if conn is not None and handler is not None: if conn is not None and handler is not None:
...@@ -85,10 +88,7 @@ class ClientApplicationTest(NeoTestBase): ...@@ -85,10 +88,7 @@ class ClientApplicationTest(NeoTestBase):
def getApp(self, master_nodes='127.0.0.1:10010', name='test', def getApp(self, master_nodes='127.0.0.1:10010', name='test',
connector='SocketConnector', **kw): connector='SocketConnector', **kw):
# TODO: properly simulate master node connection
app = Application(master_nodes, name, connector, **kw) app = Application(master_nodes, name, connector, **kw)
app.num_partitions = 10
app.num_replicas = 2
return app return app
def makeOID(self, value=None): def makeOID(self, value=None):
......
...@@ -149,12 +149,7 @@ class ClientHandlerTest(NeoTestBase): ...@@ -149,12 +149,7 @@ class ClientHandlerTest(NeoTestBase):
key_2: queue_2} key_2: queue_2}
dispatcher = Dispatcher() dispatcher = Dispatcher()
method(dispatcher, app, handler_class, conn=conn) method(dispatcher, app, handler_class, conn=conn)
# Check that master was notified of the failure # The master should be notified, but this is done in app.py
(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)
# Check that failed connection got removed from connection pool # Check that failed connection got removed from connection pool
removeConnection_call_list = app.cp.mockGetNamedCalls('removeConnection') removeConnection_call_list = app.cp.mockGetNamedCalls('removeConnection')
# Test sanity check # 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