diff --git a/test/tap/test_helpers/test_init.cpp b/test/tap/test_helpers/test_init.cpp index b3af46f82..08261b2ef 100644 --- a/test/tap/test_helpers/test_init.cpp +++ b/test/tap/test_helpers/test_init.cpp @@ -173,24 +173,24 @@ void test_cleanup_query_processor() { // ============================================================================ int test_init_hostgroups() { - if (MyHGM != nullptr || PgHGM != nullptr) { - return 0; - } - // HostGroups Manager constructors register Prometheus metrics. if (GloVars.prometheus_registry == nullptr) { GloVars.prometheus_registry = std::make_shared(); } - MyHGM = new MySQL_HostGroups_Manager(); - // NOTE: We intentionally do NOT call MyHGM->init() here. - // init() starts background threads (HGCU_thread, GTID_syncer) - // that run forever and would cause the test process to hang on - // exit. The constructor alone sets up the internal SQLite3 - // database and all data structures needed for unit testing. + if (MyHGM == nullptr) { + MyHGM = new MySQL_HostGroups_Manager(); + // NOTE: We intentionally do NOT call MyHGM->init() here. + // init() starts background threads (HGCU_thread, GTID_syncer) + // that run forever and would cause the test process to hang on + // exit. The constructor alone sets up the internal SQLite3 + // database and all data structures needed for unit testing. + } - PgHGM = new PgSQL_HostGroups_Manager(); - // PgHGM->init() is a no-op, but we skip it for consistency. + if (PgHGM == nullptr) { + PgHGM = new PgSQL_HostGroups_Manager(); + // PgHGM->init() is a no-op, but we skip it for consistency. + } return 0; } diff --git a/test/tap/test_helpers/test_init.h b/test/tap/test_helpers/test_init.h index 6895630e3..5818bde0b 100644 --- a/test/tap/test_helpers/test_init.h +++ b/test/tap/test_helpers/test_init.h @@ -127,6 +127,5 @@ int test_init_hostgroups(); * Destroys MyHGM and PgHGM, setting them back to nullptr. */ void test_cleanup_hostgroups(); -void test_cleanup_query_processor(); #endif /* TEST_INIT_H */