| 1 |
################################################################################ |
| 2 |
# This test checks the server default user for the SQL session server is not |
| 3 |
# affected by the X plugin |
| 4 |
################################################################################ |
| 5 |
|
| 6 |
--source include/not_valgrind.inc |
| 7 |
--source include/mysql_upgrade_preparation.inc |
| 8 |
--let $wait_for_tcpsocket_status = no_wait |
| 9 |
--let $wait_for_unixsocket_status = no_wait |
| 10 |
--source include/xplugin_preamble.inc |
| 11 |
--source include/xplugin_create_user.inc |
| 12 |
--source include/force_restart.inc |
| 13 |
|
| 14 |
--echo # |
| 15 |
--echo # Assert the user exist from the start |
| 16 |
--echo # |
| 17 |
|
| 18 |
--let $assert_text= session_user should exist before X plugin install |
| 19 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 20 |
--source include/assert.inc |
| 21 |
|
| 22 |
--echo # |
| 23 |
--echo # Start X plugin and check all is OK |
| 24 |
--echo # |
| 25 |
|
| 26 |
--source include/xplugin_reset_and_wait.inc |
| 27 |
|
| 28 |
--let $assert_text= session_user should exist after X plugin install |
| 29 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 30 |
--source include/assert.inc |
| 31 |
|
| 32 |
--echo # |
| 33 |
--echo # Delete the user |
| 34 |
--echo # |
| 35 |
|
| 36 |
let $date_to_restore=`SELECT password_last_changed from mysql.user where user='mysql.session'`; |
| 37 |
let $date_to_restore_priv=`SELECT timestamp from mysql.tables_priv where user='mysql.session'`; |
| 38 |
DROP USER "mysql.session"@"localhost"; |
| 39 |
call mtr.add_suppression("Plugin mysqlx reported: 'Unable to switch context to user mysql.session'"); |
| 40 |
--error 1 |
| 41 |
--exec $MYSQLXTEST -ux_root --password='' --sql "SELECT CURRENT_USER()" |
| 42 |
|
| 43 |
--echo # |
| 44 |
--echo # Recreate the user with an upgrade and see that X plugin works |
| 45 |
--echo # |
| 46 |
|
| 47 |
--echo Run mysql_upgrade |
| 48 |
--let $restart_parameters = restart:--upgrade=FORCE |
| 49 |
--let $wait_counter= 10000 |
| 50 |
--source include/restart_mysqld.inc |
| 51 |
--source include/mysql_upgrade_cleanup.inc |
| 52 |
|
| 53 |
--source include/xplugin_wait_for_interfaces.inc |
| 54 |
|
| 55 |
--let $assert_text= session_user should exist after upgrade |
| 56 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 57 |
--source include/assert.inc |
| 58 |
|
| 59 |
--exec $MYSQLXTEST -ux_root --password='' --sql "SELECT CURRENT_USER()" |
| 60 |
|
| 61 |
--source include/xplugin_drop_user.inc |
| 62 |
--echo # |
| 63 |
--echo # Uninstall plugin and verify that user is still there |
| 64 |
--echo # |
| 65 |
|
| 66 |
--let $assert_text= session_user should exist after install |
| 67 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 68 |
--source include/assert.inc |
| 69 |
|
| 70 |
--echo # |
| 71 |
--echo # Cleaning |
| 72 |
--echo # |
| 73 |
|
| 74 |
--source include/xplugin_reset_and_wait.inc |
| 75 |
--source ../include/xplugin_cleanup.inc |
| 76 |
|
| 77 |
call mtr.add_suppression("Unable to use user mysql.session context *.*"); |
| 78 |
call mtr.add_suppression("On plugin shutdown it was not possible to reset the server read mode settings. Try to reset it manually."); |
| 79 |
--disable_query_log ONCE |
| 80 |
--eval UPDATE mysql.tables_priv SET timestamp ='$date_to_restore_priv' WHERE USER= 'mysql.session' |
| 81 |
--disable_query_log ONCE |
| 82 |
--eval UPDATE mysql.user SET password_last_changed= '$date_to_restore' WHERE USER= 'mysql.session' |