Files
MaxScale/maxscale-system-test/mxs1457_ignore_deleted.cpp
Niclas Antti c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00

62 lines
2.2 KiB
C++

/**
* MXS-1457: Deleted servers are not ignored when users are loaded
*
* Check that a corrupt and deleted server is not used to load users
*/
#include "testconnections.h"
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
test.set_timeout(60);
test.repl->connect();
execute_query(test.repl->nodes[0], "CREATE USER 'auth_test'@'%%' IDENTIFIED BY 'test'");
execute_query(test.repl->nodes[0], "GRANT ALL ON *.* to 'auth_test'@'%%'");
test.repl->sync_slaves();
test.repl->close_connections();
/**
* The monitor needs to be stopped before the slaves are stopped to prevent
* it from detecting the broken replication.
*/
test.maxscales->ssh_node(0, "maxadmin shutdown monitor \"MySQL Monitor\"", true);
// Stop slaves and drop the user on the master
test.repl->stop_slaves();
test.repl->connect();
execute_query(test.repl->nodes[0], "DROP USER 'auth_test'@'%%'");
test.repl->close_connections();
test.set_timeout(60);
MYSQL* conn = open_conn_db(test.maxscales->rwsplit_port[0],
test.maxscales->ip(0),
"test",
"auth_test",
"test",
false);
test.add_result(mysql_errno(conn) == 0, "Connection with users from master should fail");
mysql_close(conn);
test.maxscales->ssh_node(0, "maxadmin remove server server1 \"RW-Split-Router\"", true);
conn = open_conn_db(test.maxscales->rwsplit_port[0],
test.maxscales->ip(0),
"test",
"auth_test",
"test",
false);
test.add_result(mysql_errno(conn), "Connection should be OK: %s", mysql_error(conn));
test.try_query(conn, "SELECT 1");
mysql_close(conn);
test.set_timeout(60);
test.repl->connect();
execute_query(test.repl->nodes[1], "START SLAVE");
execute_query(test.repl->nodes[2], "START SLAVE");
execute_query(test.repl->nodes[3], "START SLAVE");
test.repl->sync_slaves();
test.repl->close_connections();
return test.global_result;
}