Skip to content

Commit aad4952

Browse files
committed
Avoid spurious failures of MySQL INSERT packet overflow test
This test creates a MySQL table called 'test'. In several cases, I have seen a spurious test failure (in CI) with an error message saying: "table 'test' already exists". It seems other tests were running at the same time, against the same DB instance, and using the same table name 'test'.
1 parent 62bf0c4 commit aad4952

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/mysqli/tests/mysqli_insert_packet_overflow.phpt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ memory_limit=256M
7171
printf("[011] Failed to change max_allowed_packet");
7272
}
7373

74-
if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
74+
$table_name = 'test__mysqli_insert_packet_overflow';
75+
if (!mysqli_query($link, "CREATE TABLE {$table_name}(col_blob LONGBLOB) ENGINE=" . $engine))
7576
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
7677

77-
$query_prefix = "INSERT INTO test(col_blob) VALUES ('";
78+
$query_prefix = "INSERT INTO {$table_name}(col_blob) VALUES ('";
7879
$query_postfix = "')";
7980
$query_len = strlen($query_prefix) + strlen($query_postfix);
8081
$com_query_len = 2;
@@ -86,7 +87,7 @@ memory_limit=256M
8687
if (!mysqli_query($link, $query))
8788
printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));
8889

89-
if (!$res = mysqli_query($link, "SELECT col_blob FROM test"))
90+
if (!$res = mysqli_query($link, "SELECT col_blob FROM {$table_name}"))
9091
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
9192

9293
if (!$row = mysqli_fetch_assoc($res)) {

0 commit comments

Comments
 (0)