Debian Codegraph @

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

raw
1 #
2 # Validate that replication channels configured with SSL work
3 # properly together with MySQL GCS with SSL enabled.
4 #
5 # Steps:
6 # 1. Setup the members with a recovery user that does
7 # require SSL.
8 # 2. Start Group Replication on both members and assert that
9 # GCS SSL is enabled.
10 # 3. Stop and start Group Replication on member 2 to stress
11 # SSL destroy and initialization procedures
12 # 4. Execute some transactions to validate that group is
13 # properly working.
14 # 5. Clean up.
15 #
16 --source include/big_test.inc
17 --source include/have_group_replication_plugin.inc
18 --let $rpl_skip_group_replication_start= 1
19 --source include/group_replication.inc
20
21
22 --echo
23 --echo ############################################################
24 --echo # 1. Setup the members with a recovery user that does
25 --echo # require SSL.
26 --let $rpl_connection_name= server1
27 --source include/rpl_connection.inc
28 SET SESSION sql_log_bin=0;
29 CREATE USER 'rec_ssl_user'@'%' REQUIRE SSL;
30 GRANT replication slave ON *.* TO 'rec_ssl_user'@'%';
31 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'rec_ssl_user'@'%';
32 FLUSH PRIVILEGES;
33 SET SESSION sql_log_bin=1;
34
35 --let $rpl_connection_name= server2
36 --source include/rpl_connection.inc
37
38 SET SESSION sql_log_bin=0;
39 CREATE USER 'rec_ssl_user'@'%' REQUIRE SSL;
40 GRANT replication slave ON *.* TO 'rec_ssl_user'@'%';
41 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'rec_ssl_user'@'%';
42 FLUSH PRIVILEGES;
43 SET SESSION sql_log_bin=1;
44
45 --disable_warnings
46 CHANGE REPLICATION SOURCE TO SOURCE_USER="rec_ssl_user" FOR CHANNEL "group_replication_recovery";
47 --enable_warnings
48
49
50 --echo
51 --echo ############################################################
52 --echo # 2. Start Group Replication on both members and assert that
53 --echo # GCS SSL is enabled.
54 --let $rpl_connection_name= server1
55 --source include/rpl_connection.inc
56 --source include/start_and_bootstrap_group_replication.inc
57
58 --let $grep_file= $MYSQLTEST_VARDIR/tmp/group_replication_recovery_ssl_and_ssl_mode.1.err
59 --let $grep_pattern= Group communication SSL configuration: group_replication_ssl_mode: "REQUIRED"
60 --let $grep_output= print_count
61 --source include/grep_pattern.inc
62
63 --let $rpl_connection_name= server2
64 --source include/rpl_connection.inc
65 --source include/start_group_replication.inc
66
67 --let $grep_file= $MYSQLTEST_VARDIR/tmp/group_replication_recovery_ssl_and_ssl_mode.2.err
68 --let $grep_pattern= Group communication SSL configuration: group_replication_ssl_mode: "REQUIRED"
69 --let $grep_output= print_count
70 --source include/grep_pattern.inc
71
72 --echo
73 --echo ############################################################
74 --echo # 3. Stop and start Group Replication on member 2 to stress
75 --echo # SSL destroy and initialization procedures
76 --let $rpl_connection_name= server2
77 --source include/rpl_connection.inc
78 --source include/stop_group_replication.inc
79 --source include/start_group_replication.inc
80
81 --let $grep_file= $MYSQLTEST_VARDIR/tmp/group_replication_recovery_ssl_and_ssl_mode.2.err
82 --let $grep_pattern= Group communication SSL configuration: group_replication_ssl_mode: "REQUIRED"
83 --let $grep_output= print_count
84 --source include/grep_pattern.inc
85
86
87 --echo
88 --echo ############################################################
89 --echo # 4. Execute some transactions to validate that group is
90 --echo # properly working.
91 --let $rpl_connection_name= server1
92 --source include/rpl_connection.inc
93 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
94 INSERT INTO t1 VALUES (1);
95 --source include/rpl_sync.inc
96
97 --let $rpl_connection_name= server2
98 --source include/rpl_connection.inc
99 INSERT INTO t1 VALUES (2);
100 --source include/rpl_sync.inc
101
102 --let $rpl_connection_name= server1
103 --source include/rpl_connection.inc
104 --let $assert_text= 'There are 2 values on table t1'
105 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
106 --source include/assert.inc
107
108 --let $rpl_connection_name= server2
109 --source include/rpl_connection.inc
110 --let $assert_text= 'There are 2 values on table t1'
111 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
112 --source include/assert.inc
113
114
115 --echo
116 --echo ############################################################
117 --echo # 5. Clean up.
118 --let $rpl_connection_name= server1
119 --source include/rpl_connection.inc
120 DROP TABLE t1;
121
122 SET SESSION sql_log_bin=0;
123 DROP USER 'rec_ssl_user';
124 SET SESSION sql_log_bin=1;
125
126 --let $rpl_connection_name= server2
127 --source include/rpl_connection.inc
128
129 SET SESSION sql_log_bin=0;
130 DROP USER 'rec_ssl_user';
131 SET SESSION sql_log_bin=1;
132
133 --source include/group_replication_end.inc