polardbxengine/mysql-test/suite/x/t/mysql_session_user.test

83 lines
2.9 KiB
Plaintext

################################################################################
# This test checks the server default user for the SQL session server is not
# affected by the X plugin
################################################################################
--source include/not_valgrind.inc
--source include/mysql_upgrade_preparation.inc
--let $wait_for_tcpsocket_status = no_wait
--let $wait_for_unixsocket_status = no_wait
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
--source include/force_restart.inc
--echo #
--echo # Assert the user exist from the start
--echo #
--let $assert_text= session_user should exist before X plugin install
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1;
--source include/assert.inc
--echo #
--echo # Start X plugin and check all is OK
--echo #
--source include/xplugin_reset_and_wait.inc
--let $assert_text= session_user should exist after X plugin install
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1;
--source include/assert.inc
--echo #
--echo # Delete the user
--echo #
let $date_to_restore=`SELECT password_last_changed from mysql.user where user='mysql.session'`;
let $date_to_restore_priv=`SELECT timestamp from mysql.tables_priv where user='mysql.session'`;
DROP USER "mysql.session"@"localhost";
call mtr.add_suppression("Plugin mysqlx reported: 'Unable to switch context to user mysql.session'");
--error 1
--exec $MYSQLXTEST -ux_root --password='' --sql "SELECT CURRENT_USER()"
--echo #
--echo # Recreate the user with an upgrade and see that X plugin works
--echo #
--echo Run mysql_upgrade
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--source include/mysql_upgrade_cleanup.inc
--source include/xplugin_wait_for_interfaces.inc
--let $assert_text= session_user should exist after upgrade
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1;
--source include/assert.inc
--exec $MYSQLXTEST -ux_root --password='' --sql "SELECT CURRENT_USER()"
--source include/xplugin_drop_user.inc
--echo #
--echo # Uninstall plugin and verify that user is still there
--echo #
--let $assert_text= session_user should exist after install
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1;
--source include/assert.inc
--echo #
--echo # Cleaning
--echo #
--source include/xplugin_reset_and_wait.inc
call mtr.add_suppression("Unable to use user mysql.session context *.*");
call mtr.add_suppression("On plugin shutdown it was not possible to reset the server read mode settings. Try to reset it manually.");
--disable_query_log ONCE
--eval UPDATE mysql.tables_priv SET timestamp ='$date_to_restore_priv' WHERE USER= 'mysql.session'
--disable_query_log ONCE
--eval UPDATE mysql.user SET password_last_changed= '$date_to_restore' WHERE USER= 'mysql.session'