Skip to content

Commit 00c9c48

Browse files
committed
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.
1 parent 4513141 commit 00c9c48

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ $db = MySQLPDOTest::factory();
4040
if (!preg_match('/Uptime/i', $info))
4141
printf("[006] Can't find uptime in server info '%s'\n", $info);
4242

43-
if (isset($uptime) && !preg_match(sprintf('/Uptime: %d/i', $uptime), $info))
44-
printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
43+
if (isset($uptime)) {
44+
if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) {
45+
printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
46+
}
47+
}
4548

4649
print "done!";
4750
--EXPECT--

0 commit comments

Comments
 (0)