From d5b796cdea6045b18abf7f98415478e8ffaaa3ca Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Wed, 15 Apr 2026 17:33:23 +0000 Subject: [PATCH] fix(test/tap): halve expected backend conn count in test_sqlite3_pass_exts-t on 9.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to cbbd10ba7 (skip native_password backend fixtures on MySQL 9.x). The Phase-3 end-to-end loop runs RAND_USERS_GEN (100) iterations on 8.4 — 50 with mysql_native_password + 50 with caching_sha2_password — and each successful login creates one backend connection. On 9.x the native half is skipped, so only 50 actual connections are made. The post-loop assertion "Number of backend conns created should match conn attempts" was hardcoded to compare against RAND_USERS_GEN. When native was skipped, actual=50 but expected=100, producing: not ok 2113 - Number of backend conns created should match conn attempts exp:'100', act:'50' Fix: compute expected_conns based on g_mysql_supports_native_password (the same flag that gates the Phase-3 loop range) and use it both for the wait_for_cond() condition string and the assertion. Verified on a live mysql90 backend: test now reports ok 2113 - ... exp:'50', act:'50' and exits 0 (2113/2113 assertions pass in 3.4s). --- test/tap/tests/test_sqlite3_pass_exts-t.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/tap/tests/test_sqlite3_pass_exts-t.cpp b/test/tap/tests/test_sqlite3_pass_exts-t.cpp index c1b93f46d..9cef59e10 100644 --- a/test/tap/tests/test_sqlite3_pass_exts-t.cpp +++ b/test/tap/tests/test_sqlite3_pass_exts-t.cpp @@ -676,12 +676,19 @@ int main(int argc, char** argv) { mysql_close(proxy); } + // Only the iterations we actually ran produce backend connections. + // When the native_password half is skipped (MySQL 9.x), expected + // count is halved. + const uint32_t expected_conns = + g_mysql_supports_native_password ? RAND_USERS_GEN : (RAND_USERS_GEN / 2); + const string EXPECTED_CONNS_S { std::to_string(expected_conns) }; + const string SEL_POOL_CONNS { "SELECT SUM(ConnUsed + ConnFree) FROM stats.stats_mysql_connection_pool" " WHERE hostgroup=" + TAP_MYSQL8_BACKEND_HG_S }; const string COND_CONN_CREATION { - "SELECT IIF((" + SEL_POOL_CONNS + ")=" + RAND_USERS_GEN_S + ", 'TRUE', 'FALSE')" + "SELECT IIF((" + SEL_POOL_CONNS + ")=" + EXPECTED_CONNS_S + ", 'TRUE', 'FALSE')" }; wait_for_cond(admin, COND_CONN_CREATION, 10); @@ -693,9 +700,9 @@ int main(int argc, char** argv) { } ok( - RAND_USERS_GEN == cur_conns.val, + expected_conns == cur_conns.val, "Number of backend conns created should match conn attempts exp:'%u', act:'%lu'", - RAND_USERS_GEN, cur_conns.val + expected_conns, cur_conns.val ); }