Debian Codegraph @

mysql-test/suite/group_replication/t/gr_user_admin.test

raw
1 ################################################################################
2 # BUG#24357947 - MOVE TESTS THAT NEED GR PLUGIN TO GROUP REPLICATION TREE
3 #
4 # This test check operations over user accounts
5 #
6 # Test:
7 # 0. The test requires one server
8 #
9 # Phase 1: Validate administration of users operations
10 # 1. Remove all users will be used in the test
11 # 2. Create user
12 # 3. Verify in log event plaintext password replaced by ciphertext
13 # 4. Rename user
14 # 5. Drop user
15 # 6. WL2392: "Change Password at next login" (initial default for root)
16 # 7. Show binlog events on master
17
18 --source include/not_have_privilege_checks_user.inc
19 --source include/have_group_replication_plugin.inc
20 --source include/group_replication.inc
21
22 # Test create user
23 connection master;
24 create user 'foo'@'fakehost';
25 --error ER_CANNOT_USER
26 create user 'foo'@'fakehost', 'bar'@'fakehost';
27 --error ER_CANNOT_USER
28 create user 'foo'@'fakehost', 'bar'@'fakehost';
29
30 # In log event, Plaintext password 'foo1' is replaced by ciphertext.
31 create user 'foo1'@'fakehost' IDENTIFIED BY 'foo1', 'foo2'@'fakehost'
32 IDENTIFIED WITH 'mysql_native_password' AS '*1111111111111111111111111111111111111111',
33 'foo3'@'fakehost';
34 --source include/sync_slave_sql_with_master.inc
35 select Host,User from mysql.user where Host='fakehost';
36
37 # Test rename user
38 connection master;
39 rename user 'foo'@'fakehost' to 'foofoo'@'fakehost';
40 --error ER_CANNOT_USER
41 rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost';
42 --error ER_CANNOT_USER
43 rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'not_exist_user2'@'fakehost' to 'barfoo'@'fakehost';
44
45 --source include/sync_slave_sql_with_master.inc
46 select Host,User from mysql.user where Host='fakehost';
47
48 # Test drop user
49 connection master;
50 drop user 'foofoo'@'fakehost';
51 drop user 'foo1'@'fakehost', 'foo2'@'fakehost', 'foo3'@'fakehost';
52 --error ER_CANNOT_USER
53 drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost';
54 --error ER_CANNOT_USER
55 drop user 'not_exist_user1'@'fakehost', 'not_exist_user2'@'fakehost';
56
57 --source include/sync_slave_sql_with_master.inc
58 select Host,User from mysql.user where Host='fakehost';
59
60
61 --echo #
62 --echo # WL2392: "Change Password at next login" (initial default for root)
63 --echo #
64
65 connection master;
66 CREATE USER must_change2@localhost IDENTIFIED BY 'aha';
67 ALTER USER must_change2@localhost PASSWORD EXPIRE;
68 --source include/sync_slave_sql_with_master.inc
69 select Host,User,password_expired from mysql.user where user='must_change2';
70
71 connect(must_change_con_slave,localhost,must_change2,aha,test,$SLAVE_MYPORT,);
72 connection must_change_con_slave;
73 --echo # must throw an error
74 --error ER_MUST_CHANGE_PASSWORD
75 SELECT USER();
76 connection master;
77 disconnect must_change_con_slave;
78
79 connect(must_change_con_master,localhost,must_change2,aha);
80 connection must_change_con_master;
81 --echo # setting a password unlocks it
82 SET PASSWORD = 'aha2';
83 connection master;
84 disconnect must_change_con_master;
85
86 --source include/sync_slave_sql_with_master.inc
87 connection master;
88
89 connect(must_change_con_slave,localhost,must_change2,aha2,test,$SLAVE_MYPORT,);
90 connection must_change_con_slave;
91 --echo # must not throw an error
92 SELECT USER();
93 connection master;
94 disconnect must_change_con_slave;
95
96 DROP USER must_change2@localhost;
97
98 --source include/sync_slave_sql_with_master.inc
99 connection master;
100
101 # show the binlog events on the master
102 connection master;
103 --let $mask_user_password_events=1
104 source include/show_binlog_events.inc;
105 --let $mask_user_password_events=0
106
107 --source include/group_replication_end.inc