MXS-1947: Add test case
The test checks that composite roles work.
This commit is contained in:
parent
889877c0ab
commit
c878146c24
@ -487,6 +487,10 @@ add_test_executable(mxs827_write_timeout.cpp mxs827_write_timeout mxs827_write_t
|
||||
# https://jira.mariadb.org/browse/MXS-872
|
||||
add_test_executable(mxs872_roles.cpp mxs872_roles replication LABELS REPL_BACKEND)
|
||||
|
||||
# MXS-1947: Composite roles are not supported
|
||||
# https://jira.mariadb.org/browse/MXS-1947
|
||||
add_test_executable(mxs1947_composite_roles.cpp mxs1947_composite_roles replication LABELS REPL_BACKEND)
|
||||
|
||||
# Block and unblock first and second slaves and check that they are recovered
|
||||
add_test_executable(mxs874_slave_recovery.cpp mxs874_slave_recovery mxs874 LABELS readwritesplit REPL_BACKEND)
|
||||
|
||||
|
55
maxscale-system-test/mxs1947_composite_roles.cpp
Normal file
55
maxscale-system-test/mxs1947_composite_roles.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* MXS-1947: Composite roles are not supported
|
||||
*
|
||||
* https://jira.mariadb.org/browse/MXS-1947
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.repl->connect();
|
||||
|
||||
auto prepare =
|
||||
{
|
||||
"DROP USER test@'%'",
|
||||
"CREATE USER test@'%' IDENTIFIED BY 'test';",
|
||||
"CREATE ROLE a;",
|
||||
"CREATE ROLE b;",
|
||||
"CREATE DATABASE db;",
|
||||
"GRANT ALL ON db.* TO a;",
|
||||
"GRANT a TO b;",
|
||||
"GRANT b TO test@'%';",
|
||||
"SET DEFAULT ROLE b FOR test@'%';"
|
||||
};
|
||||
|
||||
for (auto a : prepare)
|
||||
{
|
||||
execute_query_silent(test.repl->nodes[0], a);
|
||||
}
|
||||
|
||||
// Wait for the users to replicate
|
||||
test.repl->sync_slaves();
|
||||
|
||||
test.tprintf("Connect with a user that has a composite role as the default role");
|
||||
MYSQL* conn = open_conn_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], "db", "test", "test");
|
||||
test.assert(mysql_errno(conn) == 0, "Connection failed: %s", mysql_error(conn));
|
||||
mysql_close(conn);
|
||||
|
||||
auto cleanup =
|
||||
{
|
||||
"DROP DATABASE IF EXISTS db;",
|
||||
"DROP ROLE IF EXISTS a;",
|
||||
"DROP ROLE IF EXISTS b;",
|
||||
"DROP USER 'test'@'%';"
|
||||
};
|
||||
|
||||
for (auto a : cleanup)
|
||||
{
|
||||
execute_query_silent(test.repl->nodes[0], a);
|
||||
}
|
||||
|
||||
return test.global_result;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user