summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures.py14
-rw-r--r--test/service.py7
2 files changed, 14 insertions, 7 deletions
diff --git a/test/fixtures.py b/test/fixtures.py
index 90d01f1..4231452 100644
--- a/test/fixtures.py
+++ b/test/fixtures.py
@@ -126,8 +126,11 @@ class ZookeeperFixture(Fixture):
# Party!
self.out("Starting...")
- self.child.start()
- self.child.wait_for(r"binding to port")
+ while True:
+ self.child.start()
+ if self.child.wait_for(r"binding to port", timeout=5):
+ break
+ self.child.stop()
self.out("Done!")
def close(self):
@@ -222,8 +225,11 @@ class KafkaFixture(Fixture):
self.out("Done!")
self.out("Starting...")
- self.child.start()
- self.child.wait_for(r"\[Kafka Server %d\], Started" % self.broker_id)
+ while True:
+ self.child.start()
+ if self.child.wait_for(r"\[Kafka Server %d\], Started" % self.broker_id, timeout=5):
+ break
+ self.child.stop()
self.out("Done!")
self.running = True
diff --git a/test/service.py b/test/service.py
index 7627322..9368b85 100644
--- a/test/service.py
+++ b/test/service.py
@@ -110,14 +110,15 @@ class SpawnedService(threading.Thread):
log.exception("Received exception when killing child process")
self.dump_logs()
- raise RuntimeError("Waiting for %r timed out after %d seconds" % (pattern, timeout))
+ log.error("Waiting for %r timed out after %d seconds", pattern, timeout)
+ return False
if re.search(pattern, '\n'.join(self.captured_stdout), re.IGNORECASE) is not None:
log.info("Found pattern %r in %d seconds via stdout", pattern, (t2 - t1))
- return
+ return True
if re.search(pattern, '\n'.join(self.captured_stderr), re.IGNORECASE) is not None:
log.info("Found pattern %r in %d seconds via stderr", pattern, (t2 - t1))
- return
+ return True
time.sleep(0.1)
def start(self):