From 032ca6511da8d871b600a0e7fd90ec17935c78c7 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sat, 7 Mar 2026 14:32:24 +0000 Subject: [PATCH] Test: Fix test_unsupported_queries for isolated CI environment Use REGULAR_INFRA_DATADIR environment variable to locate the load_data_local_datadir files in the shared volume when running in containerized CI environment. Falls back to cl.workdir for local testing. --- test/tap/tests/test_unsupported_queries-t.cpp | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/test/tap/tests/test_unsupported_queries-t.cpp b/test/tap/tests/test_unsupported_queries-t.cpp index 07afbb788..1b7beb944 100644 --- a/test/tap/tests/test_unsupported_queries-t.cpp +++ b/test/tap/tests/test_unsupported_queries-t.cpp @@ -170,9 +170,10 @@ using mysql_res_row = std::vector; void helper_test_load_data_local_infile( const CommandLine& cl, MYSQL* proxysql, int exp_err=0, bool test_for_success=true ) { - std::string datafile { - std::string { cl.workdir } + "load_data_local_datadir/insert_data.txt" - }; + const char* d_env = getenv("REGULAR_INFRA_DATADIR"); + std::string datafile = (d_env ? std::string(d_env) + "/load_data_local_datadir/insert_data.txt" + : std::string(cl.workdir) + "load_data_local_datadir/insert_data.txt"); + diag("Data file path: %s", datafile.c_str()); bool table_prep_success = true; @@ -363,9 +364,10 @@ void test_failing_load_data_local_infile( const CommandLine& cl, MYSQL* proxysql, int exp_err=0, bool test_for_success=true ) { // Supply an invalid file - std::string datafile { - std::string { cl.workdir } + "load_data_local_datadir/non_existing_file.txt" - }; + const char* d_env = getenv("REGULAR_INFRA_DATADIR"); + std::string datafile = (d_env ? std::string(d_env) + "/load_data_local_datadir/non_existing_file.txt" + : std::string(cl.workdir) + "load_data_local_datadir/non_existing_file.txt"); + diag("Data file path: %s", datafile.c_str()); bool table_prep_success = true; @@ -500,6 +502,25 @@ int main(int argc, char** argv) { return -1; } + // Verbose test header + diag("================================================================================"); + diag("Test: test_unsupported_queries-t"); + diag("================================================================================"); + diag("This test verifies that unsupported queries return the expected error codes,"); + diag("and that conditionally-enabled queries work correctly when enabled/disabled."); + diag(""); + diag("Test scenarios:"); + diag(" - Unsupported queries (LOAD DATA LOCAL INFILE) should fail with error 1047"); + diag(" - Conditionally enabled queries should work when enabled"); + diag(" - Conditionally enabled queries should fail when disabled"); + diag(""); + diag("Connection parameters:"); + diag(" - Host: %s", cl.host); + diag(" - Port: %d", cl.port); + diag(" - Admin Port: %d", cl.admin_port); + diag("================================================================================"); + diag(""); + // perform a different connection per query for (const auto& unsupported_query : unsupported_queries) { MYSQL* proxysql_mysql = mysql_init(NULL);