Mxs 2226 long test (#186)

* add possibility to run named test

* remove sysbench_dir

* remove unsupported in 1.0 sysbench options

* exculed ReadConnRouter sysbench test

* fix sysbench table name
This commit is contained in:
Timofey Turenko
2018-12-31 17:27:04 +02:00
committed by GitHub
parent 0b67a22add
commit 038f4d63e1
9 changed files with 85 additions and 104 deletions

View File

@ -25,33 +25,20 @@ int main(int argc, char *argv[])
Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]); Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]);
sprintf(&sys1[0], sysbench_prepare, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0]); sprintf(&sys1[0], SYSBENCH_PREPARE, Test->maxscales->IP[0]);
Test->tprintf("Preparing sysbench tables\n%s\n", sys1); Test->tprintf("Preparing sysbench tables\n%s\n", sys1);
Test->set_timeout(10000); Test->set_timeout(10000);
Test->add_result(system(sys1), "Error executing sysbench prepare\n"); Test->add_result(system(sys1), "Error executing sysbench prepare\n");
char *readonly;
char *ro_on = (char *) "on";
char *ro_off = (char *) "off";
Test->stop_timeout(); Test->stop_timeout();
current_port = port[0]; current_port = port[0];
Test->tprintf("Trying test with port %d\n", current_port); Test->tprintf("Trying test with port %d\n", current_port);
if (current_port == Test->maxscales->readconn_slave_port[0] ) sprintf(&sys1[0], SYSBENCH_COMMAND_LONG, Test->maxscales->IP[0],
{ current_port);
readonly = ro_on;
}
else
{
readonly = ro_off;
}
sprintf(&sys1[0], sysbench_command_long, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0],
current_port, readonly);
Test->set_log_copy_interval(300); Test->set_log_copy_interval(300);
Test->tprintf("Executing sysbench \n%s\n", sys1); Test->tprintf("Executing sysbench \n%s\n", sys1);
if (system(sys1) != 0) if (system(sys1) != 0)
@ -64,6 +51,7 @@ int main(int argc, char *argv[])
printf("Dropping sysbanch tables!\n"); printf("Dropping sysbanch tables!\n");
fflush(stdout); fflush(stdout);
/*
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1");
if (!Test->smoke) if (!Test->smoke)
{ {
@ -71,8 +59,9 @@ int main(int argc, char *argv[])
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest3"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest3");
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest4"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest4");
} }
*/
//global_result += execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest"); Test->global_result += execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1");
printf("closing connections to MaxScale!\n"); printf("closing connections to MaxScale!\n");
fflush(stdout); fflush(stdout);

View File

@ -68,6 +68,11 @@ if [ $res == 0 ] ; then
mkdir build && cd build mkdir build && cd build
cmake .. -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug cmake .. -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
make make
set -x
echo ${test_set} | grep "NAME#"
if [ $? == 0 ] ; then
named_test=`echo ${test_set} | sed "s/NAME#//" | sed "s/ //g"`
fi
if [ ! -z "${named_test}" ] ; then if [ ! -z "${named_test}" ] ; then
./${named_test} ./${named_test}

View File

@ -74,7 +74,9 @@ export maxscale_IP=$maxscale_network
export maxscale_access_user=$maxscale_whoami export maxscale_access_user=$maxscale_whoami
# Sysbench directory (should be sysbench >= 0.5) # Sysbench directory (should be sysbench >= 0.5)
export sysbench_dir=${sysbench_dir:-"$HOME/sysbench_deb7/sysbench/"} sb=`which sysbench`
export sysbench_dir=$(dirname ${sb})
#export sysbench_dir=${sysbench_dir:-""}
export ssl=true export ssl=true

View File

@ -5,7 +5,6 @@
#include "testconnections.h" #include "testconnections.h"
#include "sysbench_commands.h"
#include "sql_t1.h" #include "sql_t1.h"
#include "get_com_select_insert.h" #include "get_com_select_insert.h"

View File

@ -1,71 +1,77 @@
#ifndef SYSBENCH_COMMANDS_H #ifndef SYSBENCH_COMMANDS_H
#define SYSBENCH_COMMANDS_H #define SYSBENCH_COMMANDS_H
/*const char * sysbench_prepare = /*const char * SYSBENCH_PREPARE =
"sysbench --test=oltp \ "sysbench oltp_read_write \
--oltp-table-size=1000000 --mysql-db=test --mysql-user=skysql --mysql-password=skysql \ --mysql-db=test --mysql-user=skysql --mysql-password=skysql \
--mysql-port=4006 --mysql-host=%s prepare"; --mysql-port=4006 --mysql-host=%s prepare";
const char * sysbench_command = const char * SYSBENCH_COMMAND =
"sysbench --test=oltp \ "sysbench oltp_read_write \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \ --mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test --mysql-table-engine=innodb \ --mysql-db=test \
--num-threads=32 --oltp-table-size=1000000 --oltp-read-only=off \ --num-threads=32 \
--oltp-dist-type=uniform --oltp-skip-trx=off --init-rng=on --oltp-test-mode=complex \ --oltp-dist-type=uniform --oltp-skip-trx=off --init-rng=on --oltp-test-mode=complex \
--max-requests=0 --max-time=600 run";*/ --max-requests=0 --time=600 run";*/
const char * sysbench_prepare = const char * SYSBENCH_PREPARE =
"%s/sysbench --test=%s/tests/db/oltp.lua \ "sysbench oltp_read_write \
--oltp-table-size=1000000 --mysql-db=test --mysql-user=skysql --mysql-password=skysql \ --mysql-db=test --mysql-user=skysql --mysql-password=skysql \
--mysql-port=4006 --mysql-host=%s --oltp-tables-count=4 prepare"; --mysql-port=4006 --mysql-host=%s prepare";
const char * sysbench_command = const char * SYSBENCH_COMMAND =
"%s/sysbench --test=%s/tests/db/oltp.lua \ "sysbench oltp_read_write \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \ --mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test --mysql-table-engine=innodb --mysql-ignore-duplicates=on \ --mysql-db=test \
--num-threads=32 --oltp-table-size=1000000 --oltp-tables-count=2 --oltp-read-only=%s \ --threads=32 \
--oltp-dist-type=uniform --oltp-skip-trx=off --init-rng=on --oltp-test-mode=complex \ --max-requests=0 --report-interval=5 --time=100 run";
--max-requests=0 --report-interval=5 --max-time=100 run";
const char * SYSBENCH_PREPARE_RO =
"sysbench oltp_read_only \
--mysql-db=test --mysql-user=skysql --mysql-password=skysql \
--mysql-port=4006 --mysql-host=%s prepare";
const char * sysbench_prepare1 = const char * SYSBENCH_COMMAND_RO =
"%s/sysbench --test=%s/tests/db/oltp.lua \ "sysbench oltp_read_only \
--oltp-table-size=1000 --mysql-db=test --mysql-user=skysql --mysql-password=skysql \
--mysql-port=4006 --mysql-host=%s --oltp-tables-count=1 prepare";
const char * sysbench_command1 =
"%s/sysbench --test=%s/tests/db/oltp.lua \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test --mysql-table-engine=innodb --mysql-ignore-duplicates=on \
--num-threads=32 --oltp-table-size=1000 --oltp-tables-count=1 --oltp-read-only=%s \
--oltp-dist-type=uniform --oltp-skip-trx=off --init-rng=on --oltp-test-mode=complex \
--max-requests=0 --report-interval=5 --max-time=100 run";
const char * sysbench_command_long =
"%s/sysbench --test=%s/tests/db/oltp.lua \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \ --mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test --mysql-table-engine=innodb --mysql-ignore-duplicates=on \ --mysql-db=test \
--num-threads=32 --oltp-table-size=1000000 --oltp-tables-count=2 --oltp-read-only=%s \ --threads=32 \
--oltp-dist-type=uniform --oltp-skip-trx=off --init-rng=on --oltp-test-mode=complex \ --max-requests=0 --report-interval=5 --time=100 run";
--max-requests=0 --report-interval=5 --max-time=2592000 run";
const char * sysbench_prepare_short = const char * SYSBENCH_PREPARE1 =
"%s/sysbench --test=%s/tests/db/oltp.lua \ "sysbench oltp_read_write \
--oltp-table-size=10000 --mysql-db=test --mysql-user=skysql --mysql-password=skysql \ --mysql-db=test --mysql-user=skysql --mysql-password=skysql \
--mysql-port=4006 --mysql-host=%s --oltp-tables-count=4 prepare"; --mysql-port=4006 --mysql-host=%s prepare";
const char * sysbench_command_short = const char * SYSBENCH_COMMAND1 =
"%s/sysbench --test=%s/tests/db/oltp.lua \ "sysbench oltp_read_write \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test \
--threads=32 \
--max-requests=0 --report-interval=5 --time=100 run";
const char * SYSBENCH_COMMAND_LONG =
"sysbench oltp_read_write \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test \
--threads=32 \
--max-requests=0 --report-interval=5 --time=2592000 run";
const char * SYSBENCH_PREPARE_SHORT =
"sysbench oltp_read_write \
--mysql-db=test --mysql-user=skysql --mysql-password=skysql \
--mysql-port=4006 --mysql-host=%s prepare";
const char * SYSBENCH_COMMAND_SHORT =
"sysbench oltp_read_write \
--mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \ --mysql-host=%s --mysql-port=%d --mysql-user=skysql --mysql-password=skysql \
--mysql-db=test --mysql-table-engine=innodb --mysql-ignore-duplicates=on \ --mysql-db=test \
--num-threads=32 --oltp-table-size=10000 --oltp-tables-count=2 --oltp-read-only=%s \ --threads=32 \
--oltp-dist-type=uniform --oltp-skip-trx=off --init-rng=on --oltp-test-mode=complex \ --max-requests=0 --report-interval=5 --time=300 run";
--max-requests=0 --report-interval=5 --max-time=300 run";
#endif // SYSBENCH_COMMANDS_H #endif // SYSBENCH_COMMANDS_H

View File

@ -21,7 +21,7 @@ int main(int argc, char *argv[])
fflush(stdout); fflush(stdout);
Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]); Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]);
sprintf(&sys1[0], sysbench_prepare_short, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0]); sprintf(&sys1[0], SYSBENCH_PREPARE_SHORT, Test->maxscales->IP[0]);
Test->tprintf("Preparing sysbench tables\n%s\n", sys1); Test->tprintf("Preparing sysbench tables\n%s\n", sys1);
Test->set_timeout(10000); Test->set_timeout(10000);
@ -29,8 +29,8 @@ int main(int argc, char *argv[])
Test->stop_timeout(); Test->stop_timeout();
sprintf(&sys1[0], sysbench_command_short, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0], sprintf(&sys1[0], SYSBENCH_COMMAND_SHORT, Test->maxscales->IP[0],
Test->maxscales->rwsplit_port[0], "off"); Test->maxscales->rwsplit_port[0]);
Test->set_log_copy_interval(300); Test->set_log_copy_interval(300);
Test->tprintf("Executing sysbench \n%s\n", sys1); Test->tprintf("Executing sysbench \n%s\n", sys1);
if (system(sys1) != 0) if (system(sys1) != 0)
@ -43,6 +43,7 @@ int main(int argc, char *argv[])
printf("Dropping sysbanch tables!\n"); printf("Dropping sysbanch tables!\n");
fflush(stdout); fflush(stdout);
/*
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1");
if (!Test->smoke) if (!Test->smoke)
{ {
@ -50,8 +51,9 @@ int main(int argc, char *argv[])
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest3"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest3");
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest4"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest4");
} }
*/
//global_result += execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest"); Test->global_result += execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1");
printf("closing connections to MaxScale!\n"); printf("closing connections to MaxScale!\n");
fflush(stdout); fflush(stdout);

View File

@ -28,49 +28,36 @@ int main(int argc, char *argv[])
port[0] = Test->maxscales->rwsplit_port[0]; port[0] = Test->maxscales->rwsplit_port[0];
port[1] = Test->maxscales->readconn_master_port[0]; port[1] = Test->maxscales->readconn_master_port[0];
port[2] = Test->maxscales->readconn_slave_port[0]; //port[2] = Test->maxscales->readconn_slave_port[0];
Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]); Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]);
if (Test->smoke) if (Test->smoke)
{ {
sprintf(&sys1[0], sysbench_prepare1, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0]); sprintf(&sys1[0], SYSBENCH_PREPARE1, Test->maxscales->IP[0]);
} }
else else
{ {
sprintf(&sys1[0], sysbench_prepare, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0]); sprintf(&sys1[0], SYSBENCH_PREPARE, Test->maxscales->IP[0]);
} }
Test->tprintf("Preparing sysbench tables\n%s\n", sys1); Test->tprintf("Preparing sysbench tables\n%s\n", sys1);
Test->set_timeout(5000); Test->set_timeout(5000);
Test->add_result(system(sys1), "Error executing sysbench prepare\n"); Test->add_result(system(sys1), "Error executing sysbench prepare\n");
char *readonly;
char *ro_on = (char *) "on";
char *ro_off = (char *) "off";
Test->set_timeout(2000); Test->set_timeout(2000);
for (int k = 0; k < 3; k++) for (int k = 0; k < 2; k++)
{ {
Test->tprintf("Trying test with port %d\n", port[k]); Test->tprintf("Trying test with port %d\n", port[k]);
pthread_create( &kill_vm_thread1, NULL, kill_vm_thread, NULL); pthread_create( &kill_vm_thread1, NULL, kill_vm_thread, NULL);
if (port[k] == Test->maxscales->readconn_slave_port[0] )
{
readonly = ro_on;
}
else
{
readonly = ro_off;
}
if (Test->smoke) if (Test->smoke)
{ {
sprintf(&sys1[0], sysbench_command1, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0], port[k], sprintf(&sys1[0], SYSBENCH_COMMAND1, Test->maxscales->IP[0], port[k]);
readonly);
} }
else else
{ {
sprintf(&sys1[0], sysbench_command, Test->sysbench_dir, Test->sysbench_dir, Test->maxscales->IP[0], port[k], sprintf(&sys1[0], SYSBENCH_COMMAND, Test->maxscales->IP[0], port[k]);
readonly);
} }
Test->tprintf("Executing sysbench tables\n%s\n", sys1); Test->tprintf("Executing sysbench tables\n%s\n", sys1);
if (system(sys1) != 0) if (system(sys1) != 0)
@ -94,6 +81,7 @@ int main(int argc, char *argv[])
printf("Dropping sysbanch tables!\n"); printf("Dropping sysbanch tables!\n");
fflush(stdout); fflush(stdout);
/*
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1");
if (!Test->smoke) if (!Test->smoke)
{ {
@ -101,6 +89,8 @@ int main(int argc, char *argv[])
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest3"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest3");
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest4"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest4");
} }
*/
Test->global_result += execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE sbtest1");
printf("closing connections to MaxScale!\n"); printf("closing connections to MaxScale!\n");
fflush(stdout); fflush(stdout);

View File

@ -431,12 +431,6 @@ void TestConnections::read_env()
//env = getenv("get_logs_command"); if (env != NULL) {sprintf(get_logs_command, "%s", env);} //env = getenv("get_logs_command"); if (env != NULL) {sprintf(get_logs_command, "%s", env);}
env = getenv("sysbench_dir");
if (env != NULL)
{
sprintf(sysbench_dir, "%s", env);
}
//env = getenv("test_dir"); if (env != NULL) {sprintf(test_dir, "%s", env);} //env = getenv("test_dir"); if (env != NULL) {sprintf(test_dir, "%s", env);}
ssl = false; ssl = false;

View File

@ -27,7 +27,6 @@ typedef std::set<std::string> StringSet;
* - KillVMCommand - Command to kill a node (should handle one parameter: IP address of virtual machine to kill) * - KillVMCommand - Command to kill a node (should handle one parameter: IP address of virtual machine to kill)
* - StartVMCommand - Command to restart virtual machine (should handle one parameter: IP address of virtual machine to kill) * - StartVMCommand - Command to restart virtual machine (should handle one parameter: IP address of virtual machine to kill)
* - GetLogsCommand - Command to copy log files from node virtual machines (should handle one parameter: IP address of virtual machine to kill) * - GetLogsCommand - Command to copy log files from node virtual machines (should handle one parameter: IP address of virtual machine to kill)
* - SysbenchDir - path to SysBench directory (sysbanch should be >= 0.5)
* - node_N - Number of Master/Slave setup nodes * - node_N - Number of Master/Slave setup nodes
* - node_NNN - IP address of node NNN (NNN - 3 digits node index starting from 000) * - node_NNN - IP address of node NNN (NNN - 3 digits node index starting from 000)
* - node_port_NNN - MariaDB port for node NNN * - node_port_NNN - MariaDB port for node NNN
@ -117,11 +116,6 @@ public:
*/ */
bool use_snapshots; bool use_snapshots;
/**
* @brief SysbenchDir path to SysBench directory (sysbanch should be >= 0.5)
*/
char sysbench_dir[4096];
/** /**
* @brief copy_mariadb_logs copies MariaDB logs from backend * @brief copy_mariadb_logs copies MariaDB logs from backend
* @param repl Mariadb_nodes object * @param repl Mariadb_nodes object