MXS-1958: Add test case

The test case verifies that the problem exists.
This commit is contained in:
Markus Mäkelä
2018-07-04 16:22:54 +03:00
parent d301109b1a
commit bbf3909296
2 changed files with 29 additions and 0 deletions

View File

@ -946,6 +946,10 @@ add_test_executable(mxs1926_killed_server.cpp mxs1926_killed_server mxs1926_kill
# https://jira.mariadb.org/browse/MXS-1932
add_test_executable(mxs1932_hidden_cnf.cpp mxs1932_hidden_cnf replication LABELS REPL_BACKEND)
# MXS-1958: Users with insert-only privileges don't work
# https://jira.mariadb.org/browse/MXS-1958
add_test_executable(mxs1958_insert_priv.cpp mxs1958_insert_priv replication LABELS REPL_BACKEND)
configure_file(templates.h.in templates.h @ONLY)
include(CTest)

View File

@ -0,0 +1,25 @@
#include "testconnections.h"
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
test.repl->connect();
execute_query(test.repl->nodes[0], "CREATE USER 'insert_only'@'%%' IDENTIFIED BY 'insert_only'");
execute_query(test.repl->nodes[0], "CREATE DATABASE insert_db");
execute_query(test.repl->nodes[0], "CREATE TABLE insert_db.t1(id INT)");
execute_query(test.repl->nodes[0], "GRANT INSERT ON insert_db.t1 TO 'insert_only'@'%%'");
test.repl->sync_slaves();
MYSQL* conn = open_conn(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], "insert_only", "insert_only", false);
test.assert(mysql_errno(conn) == 0, "User without SELECT privileges should be allowed to connect");
mysql_close(conn);
execute_query(test.repl->nodes[0], "DROP USER 'insert_only'@'%%'");
execute_query(test.repl->nodes[0], "DROP DATABASE insert_db");
test.repl->sync_slaves();
test.repl->disconnect();
return test.global_result;
}