Make test more robust

Time flies, so obviously the reported uptime may differ a bit (as
already occasionally noticed on CI); we cater to that by allowing a
delay of up to one second.
This commit is contained in:
Christoph M. Becker 2019-11-04 12:16:05 +01:00
parent 451314111b
commit 00c9c480eb

View file

@ -40,8 +40,11 @@ $db = MySQLPDOTest::factory();
if (!preg_match('/Uptime/i', $info))
printf("[006] Can't find uptime in server info '%s'\n", $info);
if (isset($uptime) && !preg_match(sprintf('/Uptime: %d/i', $uptime), $info))
printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
if (isset($uptime)) {
if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) {
printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
}
}
print "done!";
--EXPECT--