Run MaxCtrl test suite in the regression test suite

The MaxCtrl test suite is now a part of the regression test suite. The
cluster tests are expected to fail as that is yet to be implemented.

Also fixed the return value of TestConnections::ssh_maxscale.
This commit is contained in:
Markus Mäkelä 2017-10-11 08:52:56 +03:00
parent 6e4cb3b293
commit 9617b55905
5 changed files with 231 additions and 1 deletions

View File

@ -636,6 +636,9 @@ add_test_executable(temporal_tables.cpp temporal_tables replication LABELS readw
# Test routing hints
add_test_executable(test_hints.cpp test_hints hints2 LABELS hintfilter LIGHT REPL_BACKEND)
# Run MaxCtrl test suite
add_test_executable(test_maxctrl.cpp test_maxctrl maxctrl LABELS REPL_BACKEND)
# Binlogrouter tests, these heavily alter the replication so they are run last
add_test_executable(avro.cpp avro avro LABELS avrorouter binlogrouter LIGHT BREAKS_REPL)
add_test_executable(avro_alter.cpp avro_alter avro LABELS avrorouter binlogrouter LIGHT BREAKS_REPL)

View File

@ -0,0 +1,131 @@
[maxscale]
threads=4
admin_auth=false
log_info=1
[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
monitor_interval=10000
[RW Split Router]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
max_slave_connections=100%
[SchemaRouter Router]
type=service
router=schemarouter
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
auth_all_servers=1
[RW Split Hint Router]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
max_slave_connections=100%
filters=Hint
[Read Connection Router]
type=service
router=readconnroute
router_options=master
servers=server1
user=maxskysql
password=skysql
filters=QLA
[Hint]
type=filter
module=hintfilter
[recurse3]
type=filter
module=tee
service=RW Split Router
[recurse2]
type=filter
module=tee
service=Read Connection Router
[recurse1]
type=filter
module=tee
service=RW Split Hint Router
[QLA]
type=filter
module=qlafilter
log_type=unified
append=false
flush=true
filebase=/tmp/qla.log
[CLI]
type=service
router=cli
[Read Connection Listener]
type=listener
service=Read Connection Router
protocol=MySQLClient
port=4008
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
[SchemaRouter Listener]
type=listener
service=SchemaRouter Router
protocol=MySQLClient
port=4010
[RW Split Hint Listener]
type=listener
service=RW Split Hint Router
protocol=MySQLClient
port=4009
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend

View File

@ -0,0 +1,26 @@
/**
* Run MaxCtrl test suite on the MaxScale machine
*/
#include "testconnections.h"
int main(int argc, char *argv[])
{
TestConnections test(argc, argv);
test.copy_to_maxscale("test_maxctrl.sh", "~");
// TODO: Don't handle test dependencies in tests
test.tprintf("Installing NPM");
test.ssh_maxscale(true,"yum -y install epel-release;yum -y install npm;");
test.tprintf("Starting test");
test.verbose = true;
int rv = test.ssh_maxscale(false, "./test_maxctrl.sh");
test.verbose = false;
test.tprintf("Removing NPM");
test.ssh_maxscale(true, "yum -y remove npm epel-release");
return rv;
}

View File

@ -0,0 +1,70 @@
#!/bin/bash
# Check branch name
ref=$(maxscale --version-full 2>&1|grep -o ' - .*'|sed 's/ - //')
if [ -z "$ref" ]
then
echo "Error: No commit ID in --version-full output"
exit 1
fi
if [ ! -d MaxScale ]
then
git clone https://www.github.com/mariadb-corporation/MaxScale.git
fi
cd MaxScale
git checkout $ref
cd maxctrl
cat <<EOF > start_maxscale.sh
#!/bin/sh
sudo systemctl start maxscale
EOF
cat <<EOF >start_double_maxscale.sh
#!/bin/sh
exit 1
EOF
cat <<EOF >stop_maxscale.sh
#!/bin/sh
sudo systemctl stop maxscale
sudo rm -rf /var/lib/maxscale/*
sudo rm -rf /var/cache/maxscale/*
sudo rm -rf /var/run/maxscale/*
if [ -f /tmp/maxadmin.sock ]
then
sudo rm /tmp/maxadmin.sock
fi
EOF
cat <<EOF >stop_double_maxscale.sh
#!/bin/sh
sudo systemctl stop maxscale
sudo rm -rf /var/lib/maxscale/*
sudo rm -rf /var/cache/maxscale/*
sudo rm -rf /var/run/maxscale/*
if [ -f /tmp/maxadmin.sock ]
then
sudo rm /tmp/maxadmin.sock
fi
EOF
chmod +x *.sh
npm i
# Export the value for --basedir where maxscale binaries are located
export MAXSCALE_DIR=/usr
./stop_maxscale.sh
npm test

View File

@ -1484,7 +1484,7 @@ int TestConnections::ssh_maxscale(bool sudo, const char* format, ...)
free(sys);
free(cmd);
return rc;
return WEXITSTATUS(rc);
}
int TestConnections::copy_to_maxscale(const char* src, const char* dest)