From ceb89fb915b93aacfd9b6319a2d9afae16c4ef2a Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sat, 21 Feb 2026 23:40:26 +0000 Subject: [PATCH] test: inject background noise into multiple TAP tests Integrated various background noise routines (Admin Pinger, Stats Poller, MySQL/PgSQL Traffic, REST Prometheus Poller) into: - admin_various_commands-t - pgsql-basic_tests-t - test_auth_methods-t - admin_show_create_table-t - kill_connection-t - mysql-last_insert_id-t Updated the test plans to correctly account for the noise tools when enabled. --- test/tap/tests/admin_show_create_table-t.cpp | 10 +++++++++- test/tap/tests/admin_various_commands-t.cpp | 10 +++++++++- test/tap/tests/kill_connection-t.cpp | 18 +++++++++++++----- test/tap/tests/mysql-last_insert_id-t.cpp | 10 +++++++++- test/tap/tests/pgsql-basic_tests-t.cpp | 4 +++- test/tap/tests/test_auth_methods-t.cpp | 4 +++- 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/test/tap/tests/admin_show_create_table-t.cpp b/test/tap/tests/admin_show_create_table-t.cpp index 5a995b1a6..ac9a1f9c7 100644 --- a/test/tap/tests/admin_show_create_table-t.cpp +++ b/test/tap/tests/admin_show_create_table-t.cpp @@ -11,6 +11,7 @@ #include "tap.h" #include "command_line.h" +#include "noise_utils.h" #include "utils.h" using std::string; @@ -29,6 +30,9 @@ int main() { return -1; } + spawn_internal_noise(cl, internal_noise_admin_pinger); + spawn_internal_noise(cl, internal_noise_stats_poller); + MYSQL* proxysql_admin = mysql_init(NULL); // Initialize connections @@ -65,7 +69,11 @@ int main() { mysql_free_result(proxy_res); } mysql_close(proxysql_admin); - plan(tables.size() + 1); + if (cl.use_noise) { + plan(tables.size() + 1 + 2); + } else { + plan(tables.size() + 1); + } ok(tables.size() > 40 , "Number of tables to check: %ld" , tables.size()); diff --git a/test/tap/tests/admin_various_commands-t.cpp b/test/tap/tests/admin_various_commands-t.cpp index 003356fc1..fdb3c9ace 100644 --- a/test/tap/tests/admin_various_commands-t.cpp +++ b/test/tap/tests/admin_various_commands-t.cpp @@ -11,6 +11,7 @@ #include "tap.h" #include "command_line.h" +#include "noise_utils.h" #include "utils.h" using std::string; @@ -28,6 +29,9 @@ int main() { return -1; } + spawn_internal_noise(cl, internal_noise_admin_pinger); + spawn_internal_noise(cl, internal_noise_random_stats_poller); + MYSQL* proxysql_admin = mysql_init(NULL); // Initialize connections @@ -93,7 +97,11 @@ int main() { { , "" }, */ }; - plan(1+queries.size()); + if (cl.use_noise) { + plan(1+queries.size() + 2); + } else { + plan(1+queries.size()); + } proxysql_admin = mysql_init(NULL); diff --git a/test/tap/tests/kill_connection-t.cpp b/test/tap/tests/kill_connection-t.cpp index b6e2c76ef..18ef75b96 100644 --- a/test/tap/tests/kill_connection-t.cpp +++ b/test/tap/tests/kill_connection-t.cpp @@ -7,6 +7,7 @@ #include "tap.h" #include "command_line.h" +#include "noise_utils.h" #include "utils.h" @@ -26,16 +27,23 @@ const int NUM_CONNS = 5; int main(int argc, char** argv) { CommandLine cl; + if (cl.getEnv()) { + diag("Failed to get the required environmental variables."); + return -1; + } + + spawn_internal_noise(cl, internal_noise_mysql_traffic); + spawn_internal_noise(cl, internal_noise_rest_prometheus_poller, {{"enable_rest_api", "true"}}); + int np = NUM_CONNS ; // for last insert id np += NUM_CONNS -1 ; // to compare all last insert id np += NUM_CONNS ; // to get connection id np += NUM_CONNS -1 ; // failed query on killed connection - plan(np); - - if (cl.getEnv()) { - diag("Failed to get the required environmental variables."); - return -1; + if (cl.use_noise) { + plan(np + 2); + } else { + plan(np); } MYSQL * conns[NUM_CONNS]; diff --git a/test/tap/tests/mysql-last_insert_id-t.cpp b/test/tap/tests/mysql-last_insert_id-t.cpp index 660f1264d..6ca510b13 100644 --- a/test/tap/tests/mysql-last_insert_id-t.cpp +++ b/test/tap/tests/mysql-last_insert_id-t.cpp @@ -9,6 +9,7 @@ #include "tap.h" #include "command_line.h" +#include "noise_utils.h" #include "utils.h" @@ -28,7 +29,14 @@ int main(int argc, char** argv) { if(cl.getEnv()) return exit_status(); - plan(8); + spawn_internal_noise(cl, internal_noise_mysql_traffic); + spawn_internal_noise(cl, internal_noise_random_stats_poller); + + if (cl.use_noise) { + plan(8 + 2); + } else { + plan(8); + } MYSQL* mysql = mysql_init(NULL); if (!mysql) diff --git a/test/tap/tests/pgsql-basic_tests-t.cpp b/test/tap/tests/pgsql-basic_tests-t.cpp index 831d73320..8b4466277 100644 --- a/test/tap/tests/pgsql-basic_tests-t.cpp +++ b/test/tap/tests/pgsql-basic_tests-t.cpp @@ -650,9 +650,11 @@ int main(int argc, char** argv) { spawn_internal_noise(cl, internal_noise_mysql_traffic); spawn_internal_noise(cl, internal_noise_prometheus_poller); + spawn_internal_noise(cl, internal_noise_pgsql_traffic); + spawn_internal_noise(cl, internal_noise_rest_prometheus_poller, {{"enable_rest_api", "true"}}); if (cl.use_noise) { - plan(176 + 2); + plan(176 + 4); } else { plan(176); } diff --git a/test/tap/tests/test_auth_methods-t.cpp b/test/tap/tests/test_auth_methods-t.cpp index e270384fd..8871c3ed1 100644 --- a/test/tap/tests/test_auth_methods-t.cpp +++ b/test/tap/tests/test_auth_methods-t.cpp @@ -1088,6 +1088,8 @@ int main(int argc, char** argv) { spawn_internal_noise(cl, internal_noise_admin_pinger); spawn_internal_noise(cl, internal_noise_mysql_traffic); + spawn_internal_noise(cl, internal_noise_random_stats_poller); + spawn_internal_noise(cl, internal_noise_rest_prometheus_poller, {{"enable_rest_api", "true"}}); MYSQL* mysql = mysql_init(NULL); @@ -1218,7 +1220,7 @@ int main(int argc, char** argv) { + non_warmup_tests_fail_count * NUM_CLIENT_THREADS + non_warmup_tests_scs_count * NUM_CLIENT_THREADS * 2 + non_warmup_tests_scs_ratio - + (cl.use_noise ? 2 : 0) + + (cl.use_noise ? 4 : 0) ); // sequential; verify correctness in the procedure; KNOWN passwords