Skip to content

Commit

Permalink
Increase fixture wait timeout to 30s; add wait-time logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Dana Powers committed Aug 13, 2014
1 parent 4796d58 commit a6200f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def dump_logs(self):
for line in self.captured_stdout:
logging.critical(line.rstrip())

def wait_for(self, pattern, timeout=10):
def wait_for(self, pattern, timeout=30):
t1 = time.time()
while True:
t2 = time.time()
Expand All @@ -91,11 +91,13 @@ def wait_for(self, pattern, timeout=10):
logging.exception("Received exception when killing child process")
self.dump_logs()

raise RuntimeError("Waiting for %r timed out" % pattern)
raise RuntimeError("Waiting for %r timed out after %d seconds" % (pattern, timeout))

if re.search(pattern, '\n'.join(self.captured_stdout), re.IGNORECASE) is not None:
logging.info("Found pattern %r in %d seconds via stdout", pattern, (t2 - t1))
return
if re.search(pattern, '\n'.join(self.captured_stderr), re.IGNORECASE) is not None:
logging.info("Found pattern %r in %d seconds via stderr", pattern, (t2 - t1))
return
time.sleep(0.1)

Expand Down

0 comments on commit a6200f2

Please sign in to comment.