Debian Codegraph @

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

raw
1 ################################################################################
2 # This test verify changed values are accepted between
3 # group_replication_ip_whitelist and group_replication_ip_allowlist.
4 # group_replication_ip_allowlist has high precendence over
5 # group_replication_ip_whitelist.
6 #
7 # Test:
8 # 0. The test requires two servers.
9 # 1. Bootstrap M1.
10 # 2. Set group_replication_ip_whitelist as AUTOMATIC and
11 # group_replication_ip_allowlist as AUTOMATIC.
12 # M2 join the group.
13 # 3. Set group_replication_ip_whitelist as incorrect_ip and
14 # group_replication_ip_allowlist as AUTOMATIC.
15 # M2 does not join the group, changed value of whitelist is used.
16 # 4. Set group_replication_ip_whitelist as AUTOMATIC and
17 # group_replication_ip_allowlist as incorrect_ip.
18 # M2 does not join the group, changed value of allowlist is used.
19 # 5. Set group_replication_ip_whitelist as incorrect_ip and
20 # group_replication_ip_allowlist as correct_ip.
21 # M2 joins the group, allowlist take precedence over whitelist.
22 # 6. Cleanup.
23 ################################################################################
24 --let $group_replication_group_name= 8a94f357-aabb-ccdc-8899-cccaaff29573
25 --source include/have_group_replication_plugin.inc
26 --let $rpl_skip_group_replication_start= 1
27 --source include/group_replication.inc
28
29 --let $_incorrect_gr_ip_whitelist="192.256.1.20"
30 --let $_correct_gr_ip_whitelist="127.0.0.1/8"
31
32 --echo # 1. Bootstrap M1.
33 --let $rpl_connection_name= server1
34 --source include/rpl_connection.inc
35 --source include/start_and_bootstrap_group_replication.inc
36
37 --echo # 2. Set group_replication_ip_whitelist as AUTOMATIC and
38 --echo # group_replication_ip_allowlist as AUTOMATIC.
39 --echo # M2 join the group.
40 --let $rpl_connection_name= server2
41 --source include/rpl_connection.inc
42 --eval SET GLOBAL group_replication_group_name="$group_replication_group_name"
43 SET @saved_gr_ip_whitelist = @@GLOBAL.group_replication_ip_whitelist;
44 SET @saved_gr_ip_allowlist = @@GLOBAL.group_replication_ip_allowlist;
45
46 SET GLOBAL group_replication_ip_whitelist="AUTOMATIC";
47 SET GLOBAL group_replication_ip_allowlist="AUTOMATIC";
48 --source include/start_group_replication.inc
49 --source include/stop_group_replication.inc
50
51 --echo # 3. Set group_replication_ip_whitelist as incorrect_ip and
52 --echo # group_replication_ip_allowlist as AUTOMATIC.
53 --echo # M2 does not join the group, changed value of whitelist is used.
54
55 --eval SET GLOBAL group_replication_ip_whitelist=$_incorrect_gr_ip_whitelist
56 --error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
57 START GROUP_REPLICATION;
58
59 --echo # 4. Set group_replication_ip_whitelist as AUTOMATIC and
60 --echo # group_replication_ip_allowlist as incorrect_ip.
61 --echo # M2 does not join the group, changed value of allowlist is used.
62
63 SET GLOBAL group_replication_ip_whitelist="AUTOMATIC";
64 --eval SET GLOBAL group_replication_ip_allowlist=$_incorrect_gr_ip_whitelist
65 --error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
66 START GROUP_REPLICATION;
67
68 --echo # 5. Set group_replication_ip_whitelist as incorrect_ip and
69 --echo # group_replication_ip_allowlist as correct_ip.
70 --echo # M2 joins the group, allowlist take precedence over whitelist.
71
72 --eval SET GLOBAL group_replication_ip_whitelist=$_incorrect_gr_ip_whitelist
73 --eval SET GLOBAL group_replication_ip_allowlist=$_correct_gr_ip_whitelist
74 --source include/start_group_replication.inc
75 --source include/stop_group_replication.inc
76
77 --echo # 6. Cleanup.
78
79 SET @@GLOBAL.group_replication_ip_whitelist = @saved_gr_ip_whitelist;
80 SET @@GLOBAL.group_replication_ip_allowlist = @saved_gr_ip_allowlist;
81
82 SET SESSION sql_log_bin = 0;
83 call mtr.add_suppression("Unable to initialize the group communication engine");
84 call mtr.add_suppression("Error on group communication engine initialization");
85 call mtr.add_suppression("\\[GCS\\] Invalid IP or subnet mask in the allowlist:*");
86 call mtr.add_suppression("\\[GCS\\] Automatically adding IPv. localhost address to the allowlist. It is mandatory that it is added.");
87 call mtr.add_suppression("\\[GCS\\] Connection attempt from IP address*");
88 SET SESSION sql_log_bin = 1;
89
90 --source include/group_replication_end.inc