Retry with shorter 5sec timeout when trying to open() fixtures
- this is intended to reduce flapping tests caused by intermittent - fixture startup issues on travis-ci
This commit is contained in:
@@ -126,8 +126,11 @@ class ZookeeperFixture(Fixture):
|
|||||||
|
|
||||||
# Party!
|
# Party!
|
||||||
self.out("Starting...")
|
self.out("Starting...")
|
||||||
self.child.start()
|
while True:
|
||||||
self.child.wait_for(r"binding to port")
|
self.child.start()
|
||||||
|
if self.child.wait_for(r"binding to port", timeout=5):
|
||||||
|
break
|
||||||
|
self.child.stop()
|
||||||
self.out("Done!")
|
self.out("Done!")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
@@ -222,8 +225,11 @@ class KafkaFixture(Fixture):
|
|||||||
self.out("Done!")
|
self.out("Done!")
|
||||||
|
|
||||||
self.out("Starting...")
|
self.out("Starting...")
|
||||||
self.child.start()
|
while True:
|
||||||
self.child.wait_for(r"\[Kafka Server %d\], Started" % self.broker_id)
|
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.out("Done!")
|
||||||
self.running = True
|
self.running = True
|
||||||
|
|
||||||
|
@@ -110,14 +110,15 @@ class SpawnedService(threading.Thread):
|
|||||||
log.exception("Received exception when killing child process")
|
log.exception("Received exception when killing child process")
|
||||||
self.dump_logs()
|
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:
|
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))
|
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:
|
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))
|
log.info("Found pattern %r in %d seconds via stderr", pattern, (t2 - t1))
|
||||||
return
|
return True
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
Reference in New Issue
Block a user