Skip to content

Commit 00ebd2d

Browse files
committed
Fix flaky connection count in mysqli test
Use connection ID instead of count to check whether we're using a persistent connection. This allows the test to be run in parallel with the other tests, but also protects against the possibility that some other service connects to the mysql server. Closes GH-18040
1 parent 858c378 commit 00ebd2d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

ext/mysqli/tests/bug73462.phpt

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@ mysqli
55
--SKIPIF--
66
<?php
77
require_once('skipifconnectfailure.inc');
8-
/*
9-
* TODO: this test is flaky with persistent connections on PPC CI runner
10-
* [001] Expected '8711' got '8712'.
11-
*/
12-
if (gethostname() == "php-ci-ppc64be") {
13-
die("SKIP test is flaky");
14-
}
158
?>
169
--FILE--
1710
<?php
1811
require_once("connect.inc");
1912

2013
/* Initial persistent connection */
2114
$mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db, $port);
22-
$result = $mysql_1->query("SHOW STATUS LIKE 'Connections'");
15+
$result = $mysql_1->query("SELECT CONNECTION_ID()");
2316
$c1 = $result->fetch_row();
2417
$result->free();
2518
$mysql_1->close();
@@ -35,7 +28,7 @@ if (gethostname() == "php-ci-ppc64be") {
3528
/* Re-use persistent connection */
3629
$mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db, $port);
3730
$error = mysqli_connect_errno();
38-
$result = $mysql_3->query("SHOW STATUS LIKE 'Connections'");
31+
$result = $mysql_3->query("SELECT CONNECTION_ID()");
3932
$c3 = $result->fetch_row();
4033
$result->free();
4134
$mysql_3->close();

0 commit comments

Comments
 (0)