| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This script tests that the `PRIVILEGE_CHECKS_USER` user info is included in |
| 4 |
# the message issued upon slave starting. |
| 5 |
# |
| 6 |
# ==== Requirements ==== |
| 7 |
# |
| 8 |
# R1. Issuing `START SLAVE` for a channel with `PRIVILEGE_CHECKS_USER` will log |
| 9 |
# an informational message about slave stating that includes the applier |
| 10 |
# user information. |
| 11 |
# |
| 12 |
# R2. Starting the server that has a channel with `PRIVILEGE_CHECKS_USER` |
| 13 |
# configuration persisted will log an informational message about slave |
| 14 |
# stating that includes the applier user information. |
| 15 |
# |
| 16 |
# ==== Implementation ==== |
| 17 |
# |
| 18 |
# TC1. `START SLAVE` issues an info message that includes applier user info |
| 19 |
# ------------------------------------------------------------------------- |
| 20 |
# 1) Set `PRIVELEGE_CHECKS_USER` to a user with `REPLICATION_APPLIER` |
| 21 |
# privilege. |
| 22 |
# 2) Start the slave. |
| 23 |
# 3) Ensure that the message in the log contains the user info. |
| 24 |
# |
| 25 |
# TC2. Start server with a channel configured issues message with applier user |
| 26 |
# info |
| 27 |
# ---------------------------------------------------------------------------- |
| 28 |
# 1) Set `PRIVELEGE_CHECKS_USER` to a user with `REPLICATION_APPLIER` |
| 29 |
# privilege. |
| 30 |
# 2) Start the server. |
| 31 |
# 3) Ensure that the message in the log contains the user info. |
| 32 |
# |
| 33 |
# ==== References ==== |
| 34 |
# |
| 35 |
# WL#12966 Replication with privilege checks |
| 36 |
# |
| 37 |
|
| 38 |
--source include/have_binlog_format_row.inc |
| 39 |
|
| 40 |
--echo # |
| 41 |
--echo # TC1. `START SLAVE` issues an info message that includes applier user |
| 42 |
--echo # info |
| 43 |
--echo # -------------------------------------------------------------------- |
| 44 |
--echo # |
| 45 |
|
| 46 |
# 1) Set `PRIVELEGE_CHECKS_USER` to a user with `REPLICATION_APPLIER` |
| 47 |
# privilege. |
| 48 |
--let $rpl_privilege_checks_user= *:'u1'@'localhost' |
| 49 |
--source include/master-slave.inc |
| 50 |
|
| 51 |
# 2) Start the slave. |
| 52 |
--source include/rpl_connection_slave.inc |
| 53 |
--source include/wait_for_slave_to_start.inc |
| 54 |
|
| 55 |
# 3) Ensure that the message in the log contains the user info. |
| 56 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/rpl_priv_checks_user_start_info.2.err |
| 57 |
--let $assert_count = 1 |
| 58 |
--let $assert_select = .*Replica SQL thread.*user: 'u1'@'localhost'.* |
| 59 |
--let $assert_text = Start slave message found in log contains applier user info |
| 60 |
--source include/assert_grep.inc |
| 61 |
|
| 62 |
--echo # |
| 63 |
--echo # TC2. Start server with a channel configured issues message with applier |
| 64 |
--echo # user info |
| 65 |
--echo # ----------------------------------------------------------------------- |
| 66 |
--echo # |
| 67 |
|
| 68 |
# 1) Set `PRIVELEGE_CHECKS_USER` to a user with `REPLICATION_APPLIER` |
| 69 |
# privilege. |
| 70 |
# -> Already done, keeping the same user from previous test-case |
| 71 |
|
| 72 |
# 2) Start the server. |
| 73 |
--let $rpl_server_number = 2 |
| 74 |
--let $rpl_force_stop = 1 |
| 75 |
--let $rpl_server_parameters = --skip_replica_start=FALSE |
| 76 |
--source include/rpl_restart_server.inc |
| 77 |
--source include/wait_for_slave_to_start.inc |
| 78 |
|
| 79 |
# 3) Ensure that the message in the log contains the user info. |
| 80 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/rpl_priv_checks_user_start_info.2.err |
| 81 |
--let $assert_count = 2 |
| 82 |
--let $assert_select = .*Replica SQL thread.*user: 'u1'@'localhost'.* |
| 83 |
--let $assert_text = Start slave message with user info found twice in log, after restart |
| 84 |
--source include/assert_grep.inc |
| 85 |
|
| 86 |
# Cleanup |
| 87 |
--let $rpl_server_number = 2 |
| 88 |
--let $rpl_server_parameters = |
| 89 |
--source include/rpl_restart_server.inc |
| 90 |
--source include/start_slave.inc |
| 91 |
|
| 92 |
--source include/rpl_end.inc |