Commit a63bf12f authored by Julien Muchembled's avatar Julien Muchembled

threaded: prevent neoctl to loop forever when something went wrong during the test

parent fe487c07
...@@ -219,11 +219,12 @@ class TestSerialized(Serialized): ...@@ -219,11 +219,12 @@ class TestSerialized(Serialized):
def poll(self, timeout): def poll(self, timeout):
if timeout: if timeout:
while 1: for x in xrange(1000):
r = self._epoll.poll(0) r = self._epoll.poll(0)
if r: if r:
return r return r
Serialized.tic(step=1) Serialized.tic(step=1)
raise Exception("tic is looping forever")
return self._epoll.poll(timeout) return self._epoll.poll(timeout)
...@@ -704,7 +705,7 @@ class NEOCluster(object): ...@@ -704,7 +705,7 @@ class NEOCluster(object):
def join(self, thread_list, timeout=5): def join(self, thread_list, timeout=5):
timeout += time.time() timeout += time.time()
while thread_list: while thread_list:
assert time.time() < timeout assert time.time() < timeout, thread_list
Serialized.tic() Serialized.tic()
thread_list = [t for t in thread_list if t.is_alive()] thread_list = [t for t in thread_list if t.is_alive()]
......
...@@ -560,6 +560,9 @@ class Test(NEOThreadedTest): ...@@ -560,6 +560,9 @@ class Test(NEOThreadedTest):
cluster.stop() cluster.stop()
def testShutdown(self): def testShutdown(self):
# BUG: Due to bugs in election, master nodes sometimes crash, or they
# declare themselves primary too quickly. The consequence is
# often an endless tic loop.
cluster = NEOCluster(master_count=3, partitions=10, cluster = NEOCluster(master_count=3, partitions=10,
replicas=1, storage_count=3) replicas=1, storage_count=3)
try: try:
......
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