From 48f41aa850a1b85d3789d409dcb7f3c7cefd5d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Thu, 25 Aug 2022 09:36:27 +0200 Subject: [PATCH] rapid-cdn: c->h: Wait for the long entry to appear --- software/rapid-cdn/test/test.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/software/rapid-cdn/test/test.py b/software/rapid-cdn/test/test.py index fa788982b..d982adbc9 100644 --- a/software/rapid-cdn/test/test.py +++ b/software/rapid-cdn/test/test.py @@ -1442,10 +1442,16 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase): self.instance_path, '*', 'var', 'log', 'httpd', log_name ))[0] - with open(log_file) as fh: - self.assertRegex( - fh.readlines()[-1], - log_regexp) + # sometimes logs appear with a bit of delay, so give it a chance + for _ in range(5): + with open(log_file, 'r') as fh: + line = fh.readlines()[-1] + if re.match(log_regexp, line): + break + time.sleep(0.5) + self.assertRegex( + line, + log_regexp) class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin): -- 2.30.9