Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tap cleanup #2704

Merged
merged 3 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions test/tap/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ INCLUDEDIRS=-I../tap -I$(RE2_PATH) -I$(IDIR) -I$(JEMALLOC_IDIR) -I$(SQLITE3_DIR)
LDIRS=-L$(TAP_LIBDIR) -L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(LIBHTTPSERVER_LDIR) -L$(LIBINJECTION_LDIR) -L$(CURL_LDIR) -L$(EV_LDIR) -L$(SSL_LDIR)

MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -ljemalloc -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lhttpserver -lmicrohttpd -linjection -lcurl -lssl -lcrypto -lev -Wl,-Bdynamic -lgnutls -lpthread -lm -lz -lrt $(EXTRALINK)
STATIC_LIBS=$(MARIADB_LDIR)/libmariadbclient.a
STATIC_LIBS= $(SSL_LDIR)/libssl.a $(SSL_LDIR)/libcrypto.a

.PHONY: all
all: tests
Expand All @@ -77,7 +77,7 @@ all: tests
clean:
rm -f basic-t set_character_set-t charset_unsigned_int-t select_config_file-t sqlite3-t galera_1_timeout_count galera_2_timeout_no_count aurora test_set_character_results-t test_ps_large_result-t set_testing-t test_firewall-t test_default_value_transaction_isolation-t || true

OPT=-O2
OPT=-O2 -Wl,--no-as-needed

SRC=basic-t.cpp set_character_set-t.cpp charset_unsigned_int-t.cpp select_config_file-t.cpp sqlite3-t.cpp galera_1_timeout_count.cpp galera_2_timeout_no_count.cpp aurora.cpp test_set_character_results-t.cpp test_ps_large_result-t.cpp set_testing-t.cpp test_firewall-t.cpp test_default_value_transaction_isolation-t.cpp

Expand All @@ -86,40 +86,40 @@ testgalera: galera_1_timeout_count galera_2_timeout_no_count
testaurora: aurora

sqlite3-t: $(TAP_LIBDIR)/libtap.a sqlite3-t.cpp
g++ sqlite3-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl -std=c++11 -ltap -o sqlite3-t
g++ sqlite3-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl -std=c++11 -ltap $(STATIC_LIBS) -o sqlite3-t

basic-t: $(TAP_LIBDIR)/libtap.a
g++ basic-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -o basic-t
g++ basic-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap $(STATIC_LIBS) -o basic-t

set_character_set-t: set_character_set-t.cpp $(TAP_LIBDIR)/libtap.a
g++ set_character_set-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -ldl $(MYLIBS) -o set_character_set-t
g++ set_character_set-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -ldl $(MYLIBS) $(STATIC_LIBS) -o set_character_set-t

charset_unsigned_int-t: charset_unsigned_int-t.cpp $(TAP_LIBDIR)/libtap.a
g++ charset_unsigned_int-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -ldl $(MYLIBS) -o charset_unsigned_int-t
g++ charset_unsigned_int-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -ldl $(MYLIBS) $(STATIC_LIBS) -o charset_unsigned_int-t

select_config_file-t: select_config_file-t.cpp $(TAP_LIBDIR)/libtap.a
g++ select_config_file-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -ldl $(MYLIBS) -o select_config_file-t
g++ select_config_file-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -ltap -ldl $(MYLIBS) $(STATIC_LIBS) -o select_config_file-t

test_set_character_results-t: test_set_character_results-t.cpp $(TAP_LIBDIR)/libtap.a
g++ test_set_character_results-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -lssl -lcrypto -ldl -lpthread -o test_set_character_results-t
g++ test_set_character_results-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -ldl -lpthread $(STATIC_LIBS) -o test_set_character_results-t

test_ps_large_result-t: test_ps_large_result-t.cpp $(TAP_LIBDIR)/libtap.a
g++ test_ps_large_result-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -lssl -lcrypto -ldl -lpthread -o test_ps_large_result-t
g++ test_ps_large_result-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -ldl -lpthread $(STATIC_LIBS) -o test_ps_large_result-t

test_firewall-t: test_firewall-t.cpp $(TAP_LIBDIR)/libtap.a
g++ test_firewall-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -lssl -lcrypto -ldl -lpthread -o test_firewall-t
g++ test_firewall-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -ldl -lpthread $(STATIC_LIBS) -o test_firewall-t

galera_1_timeout_count: galera_1_timeout_count.cpp $(TAP_LIBDIR)/libtap.a
g++ -DTEST_GALERA -DDEBUG galera_1_timeout_count.cpp ../tap/SQLite3_Server.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(OBJ) $(MYLIBS) -ltap -ldl -o galera_1_timeout_count -DGITVERSION=\"$(GIT_VERSION)\"
g++ -DTEST_GALERA -DDEBUG galera_1_timeout_count.cpp ../tap/SQLite3_Server.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(OBJ) $(MYLIBS) -ltap -ldl $(STATIC_LIBS) -o galera_1_timeout_count -DGITVERSION=\"$(GIT_VERSION)\"

galera_2_timeout_no_count: galera_2_timeout_no_count.cpp $(TAP_LIBDIR)/libtap.a
g++ -DTEST_GALERA -DDEBUG galera_2_timeout_no_count.cpp ../tap/SQLite3_Server.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(OBJ) $(MYLIBS) -ltap -ldl -o galera_2_timeout_no_count -DGITVERSION=\"$(GIT_VERSION)\"
g++ -DTEST_GALERA -DDEBUG galera_2_timeout_no_count.cpp ../tap/SQLite3_Server.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(OBJ) $(MYLIBS) -ltap -ldl $(STATIC_LIBS) -o galera_2_timeout_no_count -DGITVERSION=\"$(GIT_VERSION)\"

aurora: aurora.cpp $(TAP_LIBDIR)/libtap.a
g++ -DTEST_AURORA -DDEBUG aurora.cpp ../tap/SQLite3_Server.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(OBJ) $(MYLIBS) -ltap -ldl -o aurora -DGITVERSION=\"$(GIT_VERSION)\"
g++ -DTEST_AURORA -DDEBUG aurora.cpp ../tap/SQLite3_Server.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(OBJ) $(MYLIBS) -ltap -ldl $(STATIC_LIBS) -o aurora -DGITVERSION=\"$(GIT_VERSION)\"

set_testing-t: set_testing-t.cpp $(TAP_LIBDIR)/libtap.a
g++ set_testing-t.cpp -Wall $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -pthread -O0 -ggdb -ldl -lssl -lcrypto -o set_testing-t
g++ set_testing-t.cpp -Wall $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -pthread -ldl $(STATIC_LIBS) -o set_testing-t

test_default_value_transaction_isolation-t: test_default_value_transaction_isolation-t.cpp $(TAP_LIBDIR)/libtap.a
g++ test_default_value_transaction_isolation-t.cpp -Wall $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -pthread -O0 -ggdb -ldl -lssl -lcrypto -o test_default_value_transaction_isolation-t
g++ test_default_value_transaction_isolation-t.cpp -Wall $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 $(MYLIBS) -ltap -pthread -ldl $(STATIC_LIBS) -o test_default_value_transaction_isolation-t
9 changes: 9 additions & 0 deletions test/tap/tests/proxysql_reference_select_config_file.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,35 @@ mysql_variables =
connect_timeout_server_max="mysql"
connection_delay_multiplex_ms="mysql"
connection_max_age_ms="mysql"
connection_warming="mysql"
connpoll_reset_queue_length="mysql"
default_CHARSET="mysql"
default_action="mysql"
default_character_set_client="mysql"
default_character_set_connection="mysql"
default_character_set_database="mysql"
default_character_set_results="mysql"
default_charset="mysql"
default_collation_connection="mysql"
default_isolation_level="mysql"
default_max_join_size="mysql"
default_max_latency_ms="mysql"
default_names="mysql"
default_net_write_timeout="mysql"
default_query_delay="mysql"
default_query_timeout="mysql"
default_reconnect="mysql"
default_schema="mysql"
default_session_track_gtids="mysql"
default_sql_auto_is_null="mysql"
default_sql_log_bin="mysql"
default_sql_mode="mysql"
default_sql_safe_updates="mysql"
default_sql_select_limit="mysql"
default_time_zone="mysql"
default_transaction_read="mysql"
default_tx_isolation="mysql"
default_wsrep_sync_wait="mysql"
enforce_autocommit_on_reads="mysql"
eventslog_default_log="mysql"
eventslog_filename="mysql"
Expand Down
7 changes: 7 additions & 0 deletions test/tap/tests/select_config_file-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,19 @@ int main(int argc, char** argv) {
#endif

MYSQL_QUERY(mysql, "load mysql variables from disk");
MYSQL_QUERY(mysql, "load mysql variables to runtime");
MYSQL_QUERY(mysql, "load admin variables from disk");
MYSQL_QUERY(mysql, "load admin variables to runtime");
MYSQL_QUERY(mysql, "load mysql users from disk");
MYSQL_QUERY(mysql, "load mysql users to runtime");
MYSQL_QUERY(mysql, "load mysql servers from disk");
MYSQL_QUERY(mysql, "load mysql servers to runtime");
MYSQL_QUERY(mysql, "load scheduler from disk");
MYSQL_QUERY(mysql, "load scheduler to runtime");
MYSQL_QUERY(mysql, "load restapi from disk");
MYSQL_QUERY(mysql, "load restapi to runtime");
MYSQL_QUERY(mysql, "load proxysql servers from disk");
MYSQL_QUERY(mysql, "load proxysql servers to runtime");

mysql_close(mysql);

Expand Down
2 changes: 1 addition & 1 deletion test/tap/tests/set_testing-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ void * my_conn_thread(void *arg) {

while(__sync_fetch_and_add(&connect_phase_completed,0) != num_threads) {
}
MYSQL *mysql;
MYSQL *mysql=NULL;
json vars;
for (j=0; j<queries; j++) {
int fr = fastrand();
Expand Down
13 changes: 11 additions & 2 deletions test/tap/tests/test_firewall-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main(int argc, char** argv) {
if(cl.getEnv())
return exit_status();

plan(3);
plan(7);
diag("Testing firewall whitelist functionality");

MYSQL* mysqladmin = mysql_init(NULL);
Expand Down Expand Up @@ -55,7 +55,7 @@ int main(int argc, char** argv) {
mysql_free_result(result);

MYSQL_QUERY(mysqladmin, "update global_variables set variable_value=1 where variable_name='mysql-firewall_whitelist_enabled'");
MYSQL_QUERY(mysqladmin, "load mysql users to runtime");
MYSQL_QUERY(mysqladmin, "load mysql variables to runtime");

// Test that firewall initialized and blocks all queries
if (mysql_query(mysql, "select @@version")) {
Expand Down Expand Up @@ -138,6 +138,15 @@ int main(int argc, char** argv) {
ok(false, "Query should be allowed by firewall, but it is blocked after active=1 update");
}

// Cleanup firewall rules
MYSQL_QUERY(mysqladmin, "load mysql firewall from disk");
MYSQL_QUERY(mysqladmin, "load mysql firewall to runtime");

// Clean up variables
MYSQL_QUERY(mysqladmin, "load mysql variables from disk");
MYSQL_QUERY(mysqladmin, "load mysql variables to runtime");


mysql_close(mysql);
mysql_close(mysqladmin);

Expand Down
3 changes: 2 additions & 1 deletion test/tap/tests/test_ps_large_result-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ int main(int argc, char** argv) {
q << "(" << k << ",'" << c.str() << "','" << pad.str() << "')";
}
MYSQL_QUERY(mysql, q.str().c_str());
ok(true, "%d row inserted", NUM_ROWS);
ok(true, "%d row inserted. Waiting for possible replication on test server 30(s)", NUM_ROWS);
sleep(30);

MYSQL_STMT *stmt1 = mysql_stmt_init(mysql);
if (!stmt1)
Expand Down