Skip to content

Commit

Permalink
more TAP test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder committed Oct 1, 2023
1 parent 0bbeef6 commit 87c9789
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/tap/tests/test_binlog_fast_forward-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ int setup_replication(int server_id, bool frontend_ssl, bool backend_ssl, std::v

std::vector<std::string> 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");

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);' <<<");
}
Expand Down
19 changes: 19 additions & 0 deletions test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>& out_stats) {
MYSQL_RES* my_stats_res = NULL;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 87c9789

Please sign in to comment.