Commit 8e2007e6 authored by Julien Muchembled's avatar Julien Muchembled

tests: fix random failures in ReplicationTests.testCheckReplicas

parent b2a20553
......@@ -706,6 +706,7 @@ class ClientConnection(Connection):
self._closure()
else:
self._connectionCompleted()
self.writable()
def _connectionCompleted(self):
self.writable = super(ClientConnection, self).writable
......
......@@ -154,6 +154,11 @@ class SerializedEventManager(EventManager):
Serialized.pending = timeout = 0
EventManager._poll(self, timeout)
def addReader(self, conn):
EventManager.addReader(self, conn)
if type(Serialized.pending) is not frozenset:
Serialized.pending = 1
class Node(object):
......@@ -674,10 +679,13 @@ class NEOCluster(object):
@staticmethod
def tic(force=False):
# XXX: Should we automatically switch client in slave mode if it isn't ?
neo.lib.logging.info('tic ...')
if force:
Serialized.tic()
neo.lib.logging.info('forced tic')
while Serialized.pending:
Serialized.tic()
neo.lib.logging.info('tic')
def getNodeState(self, node):
uuid = node.uuid
......
......@@ -27,7 +27,7 @@ from neo.storage.transactions import TransactionManager, \
from neo.lib.connection import MTClientConnection
from neo.lib.protocol import CellStates, ClusterStates, NodeStates, Packets, \
ZERO_OID, ZERO_TID, MAX_TID
from neo.lib.util import p64
from neo.lib.util import dump, p64
from . import NEOCluster, NEOThreadedTest, Patch, predictable_random
from neo.client.pool import CELL_CONNECTED, CELL_GOOD
......@@ -239,6 +239,8 @@ class ReplicationTests(NEOThreadedTest):
def corrupt(offset):
s0, s1, s2 = (storage_dict[cell.getUUID()]
for cell in cluster.master.pt.getCellList(offset, True))
neo.lib.logging.info('corrupt partition %u of %s',
offset, dump(s1.uuid))
s1.dm.deleteObject(p64(np+offset), p64(corrupt_tid))
return s0.uuid
def check(expected_state, expected_count):
......
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