From 797c4e4375b411c90e3eaecd233a6c47e489225a Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Sun, 1 Oct 2023 16:17:22 +0000 Subject: [PATCH] more TAP test fixes --- .github/workflows/CI-3p-mysql-connector-j.yml | 2 +- .github/workflows/CI-basictests.yml | 2 +- .github/workflows/CI-builds.yml | 2 +- .github/workflows/CI-cb_taptests.yml | 2 +- .github/workflows/CI-codeql.yml | 2 +- .github/workflows/CI-maketest.yml | 2 +- .github/workflows/CI-package-build.yml | 2 +- .github/workflows/CI-repltests.yml | 2 +- .github/workflows/CI-selftests.yml | 2 +- .github/workflows/CI-shuntest.yml | 2 +- .github/workflows/CI-taptests-groups.yml | 2 +- .github/workflows/CI-taptests-ssl.yml | 6 +++--- .github/workflows/CI-taptests.yml | 2 +- test/tap/tests/test_binlog_fast_forward-t.cpp | 9 +++++---- ...inlog_reader_uses_previous_hostgroup-t.cpp | 19 +++++++++++++++++++ 15 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/workflows/CI-3p-mysql-connector-j.yml b/.github/workflows/CI-3p-mysql-connector-j.yml index f396c15df5..9101d0194e 100644 --- a/.github/workflows/CI-3p-mysql-connector-j.yml +++ b/.github/workflows/CI-3p-mysql-connector-j.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-basictests.yml b/.github/workflows/CI-basictests.yml index 459b3a7525..a508dafef8 100644 --- a/.github/workflows/CI-basictests.yml +++ b/.github/workflows/CI-basictests.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: cache: diff --git a/.github/workflows/CI-builds.yml b/.github/workflows/CI-builds.yml index 27dcb0b700..d907710847 100644 --- a/.github/workflows/CI-builds.yml +++ b/.github/workflows/CI-builds.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-cb_taptests.yml b/.github/workflows/CI-cb_taptests.yml index c31812489a..5a6566c629 100644 --- a/.github/workflows/CI-cb_taptests.yml +++ b/.github/workflows/CI-cb_taptests.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-codeql.yml b/.github/workflows/CI-codeql.yml index 43a2a68451..368ef5409c 100644 --- a/.github/workflows/CI-codeql.yml +++ b/.github/workflows/CI-codeql.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-maketest.yml b/.github/workflows/CI-maketest.yml index ea582bd5b6..c31168d15b 100644 --- a/.github/workflows/CI-maketest.yml +++ b/.github/workflows/CI-maketest.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-package-build.yml b/.github/workflows/CI-package-build.yml index 8ed38ee32e..4ad70c2493 100644 --- a/.github/workflows/CI-package-build.yml +++ b/.github/workflows/CI-package-build.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-repltests.yml b/.github/workflows/CI-repltests.yml index bdd962edc0..401133f336 100644 --- a/.github/workflows/CI-repltests.yml +++ b/.github/workflows/CI-repltests.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-selftests.yml b/.github/workflows/CI-selftests.yml index 9461dfc966..5c96b11a86 100644 --- a/.github/workflows/CI-selftests.yml +++ b/.github/workflows/CI-selftests.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: cache: diff --git a/.github/workflows/CI-shuntest.yml b/.github/workflows/CI-shuntest.yml index 759512c9bb..6a8e11e0b4 100644 --- a/.github/workflows/CI-shuntest.yml +++ b/.github/workflows/CI-shuntest.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: run: diff --git a/.github/workflows/CI-taptests-groups.yml b/.github/workflows/CI-taptests-groups.yml index 06123a2d4f..81a6fc04d0 100644 --- a/.github/workflows/CI-taptests-groups.yml +++ b/.github/workflows/CI-taptests-groups.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: cache: diff --git a/.github/workflows/CI-taptests-ssl.yml b/.github/workflows/CI-taptests-ssl.yml index a4d1995aba..e86f07ace3 100644 --- a/.github/workflows/CI-taptests-ssl.yml +++ b/.github/workflows/CI-taptests-ssl.yml @@ -17,15 +17,15 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: cache: - uses: mirostauder/proxysql/.github/workflows/ci-builds.yml@GH-Actions + uses: sysown/proxysql/.github/workflows/ci-builds.yml@GH-Actions secrets: inherit run: needs: [ "cache" ] - uses: mirostauder/proxysql/.github/workflows/ci-taptests-ssl.yml@GH-Actions + uses: sysown/proxysql/.github/workflows/ci-taptests-ssl.yml@GH-Actions secrets: inherit diff --git a/.github/workflows/CI-taptests.yml b/.github/workflows/CI-taptests.yml index 9bb0eb4287..414cfc58ee 100644 --- a/.github/workflows/CI-taptests.yml +++ b/.github/workflows/CI-taptests.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: false +# cancel-in-progress: false jobs: cache: diff --git a/test/tap/tests/test_binlog_fast_forward-t.cpp b/test/tap/tests/test_binlog_fast_forward-t.cpp index 12d0d15dc9..24ad73a8d0 100644 --- a/test/tap/tests/test_binlog_fast_forward-t.cpp +++ b/test/tap/tests/test_binlog_fast_forward-t.cpp @@ -105,17 +105,18 @@ int setup_replication(int server_id, bool frontend_ssl, bool backend_ssl, std::v std::vector admin_queries = {}; admin_queries.push_back(std::string("SET mysql-have_ssl='") + std::string(frontend_ssl ? "true" : "false") + "'"); - admin_queries.push_back(std::string("UPDATE mysql_users SET use_ssl=") + std::string(frontend_ssl ? "1" : "0") + " WHERE username = 'root'"); admin_queries.push_back("LOAD MYSQL VARIABLES TO RUNTIME"); + admin_queries.push_back(std::string("UPDATE mysql_users SET use_ssl=") + std::string(frontend_ssl ? "1" : "0") + " WHERE username = 'root'"); + admin_queries.push_back("LOAD MYSQL USERS TO RUNTIME"); admin_queries.push_back(std::string("UPDATE mysql_servers SET use_ssl=") + std::string(backend_ssl ? "1" : "0")); admin_queries.push_back("LOAD MYSQL SERVERS TO RUNTIME"); + sleep(3); + MYSQL * mysql = mysql_init(NULL); diag("Connecting: cl.root_username='%s' frontend_ssl=%d", cl.root_username, frontend_ssl); - if (frontend_ssl || backend_ssl) { + if (frontend_ssl) mysql_ssl_set(mysql, NULL, NULL, NULL, NULL, NULL); - diag(">>> 'mysql_ssl_set(mysql, NULL, NULL, NULL, NULL, NULL);' <<<"); - } if (!mysql_real_connect(mysql, cl.host, cl.root_username, cl.root_password, NULL, cl.root_port, NULL, 0)) { fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(mysql)); return exit_status(); diff --git a/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp b/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp index 3e911d2c10..083c02d19d 100644 --- a/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp +++ b/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp @@ -26,6 +26,24 @@ const char* QUERY_CONN_CLOSED { "SELECT ConnOk - ConnFree FROM stats.stats_mysql_connection_pool WHERE hostgroup=%d" }; + +void * work(void *arg) { + sleep(30); + diag("Timeout! - exiting..."); + exit(EXIT_FAILURE); + return NULL; +} + +int run_funct_timeout(void *(*start_routine)(void *), int timeout) { + // we run the test on a separate thread because we have a built-in timeout + pthread_t thread_id; + if (pthread_create(&thread_id, NULL, start_routine, NULL)) { + fprintf(stderr, "Error calling pthread_create()"); + return EXIT_FAILURE; + } + return 0; +} + int conn_pool_hg_stat_conn_closed(MYSQL* proxy_admin, int hg_id, vector& out_stats) { MYSQL_RES* my_stats_res = NULL; @@ -77,6 +95,7 @@ int main(int argc, char** argv) { } plan(2 + 1); + run_funct_timeout(work, 30); const int destination_hostgroup = 2; string query;