Debian Codegraph @

mysql-test/suite/x/t/connection_multi_bind_address_ipv6.test

raw
1 ## This is test file for verification binding on multiple addresses
2 ##
3 --source include/not_windows.inc
4 --source include/check_ipv6.inc
5 --source ../include/have_performance_schema_threads.inc
6 --source include/xplugin_preamble.inc
7
8
9 ## Tests starting here
10
11 --echo
12 --echo
13 --echo
14 --echo ## Table of testing
15 --echo #
16 --echo # 1. localhost bindings
17 --echo # 2. "skip-networking" bindings
18 --echo # 3. "not existing hosts" bindings
19 --echo # 4. skipped "*" binding
20 --echo # 5. skipped "::" binding
21 --echo # 6. skipped "empty address" binding
22 --echo # 7. skipped "empty network namespace" binding
23 --echo # 8. skipped "wildcard with namespace" binding
24 --echo # 9. skipped "wrong network namespace" binding
25 --echo # 10. skipped "distanthost" binding
26 --echo # 11. "ifconfig" bindings
27 --echo # 12. default bindings
28 --echo #
29
30 --echo
31 --echo #
32 --echo # 1. localhost bindings
33 --let $expect_bind_address=localhost,::1
34 --let $expect_address=127.0.0.1,::1
35 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
36 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
37
38
39
40 --echo
41 --echo #
42 --echo # 2. "skip-networking" bindings
43 --let $expect_bind_address=localhost,::1
44 --let $expect_address=UNDEFINED
45 --let $wait_for_tcpsocket_status = undefined_value
46 --let $restart_parameters = restart: --skip-networking --mysqlx_bind_address=$expect_bind_address
47 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
48
49
50
51 --echo
52 --echo #
53 --echo # 3. "not existing hosts" bindings
54 --let $expect_bind_address=otherhost,anotherhost
55 --let $expect_address=UNDEFINED
56 --let $wait_for_tcpsocket_status = undefined_value
57 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
58 call mtr.add_suppression("Plugin mysqlx reported: 'Value 'otherhost' set to `Mysqlx_bind_address`, X Plugin can't bind to it. Skipping this value.'");
59 call mtr.add_suppression("Plugin mysqlx reported: 'Setup of bind-address: 'otherhost' port: [0-9]* failed, can't resolve `hostname`'");
60 call mtr.add_suppression("Plugin mysqlx reported: 'Value 'anotherhost' set to `Mysqlx_bind_address`, X Plugin can't bind to it. Skipping this value.'");
61 call mtr.add_suppression("Plugin mysqlx reported: 'Setup of bind-address: 'anotherhost' port: [0-9]* failed, can't resolve `hostname`'");
62 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
63
64
65
66 --echo
67 --echo #
68 --echo # 4. skipped "*" binding
69 --let $expect_bind_address=*,::1
70 --let $expect_address=::1
71 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
72 call mtr.add_suppression("Plugin mysqlx reported: 'Validation of value '\\*' set to `Mysqlx_bind_address` failed: wildcards are not allowed when there are more than one address. Skipping this value.'");
73 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
74
75
76
77 --echo
78 --echo #
79 --echo # 5. skipped "::" binding
80 --let $expect_bind_address=::,::1
81 --let $expect_address=::1
82 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
83 call mtr.add_suppression("Plugin mysqlx reported: 'Validation of value '::' set to `Mysqlx_bind_address` failed: wildcards are not allowed when there are more than one address. Skipping this value.'");
84 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
85
86
87
88 --echo
89 --echo #
90 --echo # 6. skipped "empty address" binding
91 --let $expect_bind_address=,::1
92 --let $expect_address=::1
93 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
94 call mtr.add_suppression("Plugin mysqlx reported: 'Validation of value '' set to `Mysqlx_bind_address` failed: wildcards are not allowed when there are more than one address. Skipping this value.'");
95 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
96
97
98
99 --echo
100 --echo #
101 --echo # 7. skipped "empty network namespace" binding
102 --let $expect_bind_address=::1/,::1
103 --let $expect_address=::1
104 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
105 call mtr.add_suppression("Plugin mysqlx reported: 'Validation of value '::1/' set to `Mysqlx_bind_address` failed: can't be parsed as an address. Skipping this value.'");
106 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
107
108
109
110 --echo
111 --echo #
112 --echo # 8. skipped "wildcard with namespace" binding
113 --let $expect_bind_address=::/wrong,::1
114 --let $expect_address=::1
115 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
116 call mtr.add_suppression("Plugin mysqlx reported: 'Validation of value '::/wrong' set to `Mysqlx_bind_address` failed: network namespace are not allowed for wildcards. Skipping this value.'");
117 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
118
119
120
121 --echo
122 --echo #
123 --echo # 9. skipped "wrong network namespace" binding
124 --let $expect_bind_address=::1/wrong,::1
125 --let $expect_address=::1
126 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
127 call mtr.add_suppression("Plugin mysqlx reported: 'Value '::1/wrong' set to `Mysqlx_bind_address`, X Plugin can't bind to it. Skipping this value.'");
128 call mtr.add_suppression("Plugin mysqlx reported: 'Setup of bind-address: '::1/wrong' port: [0-9]* failed, '");
129 call mtr.add_suppression("Unknown network namespace 'wrong'");
130 call mtr.add_suppression("Plugin mysqlx reported: 'Network Namespaces is not supported on this platform'");
131 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
132
133
134
135 --echo
136 --echo #
137 --echo # 10. skipped "distanthost" binding
138 --let $expect_bind_address=distanthost,::1
139 --let $expect_address=::1
140 --let $restart_parameters = restart: --mysqlx_bind_address=$expect_bind_address
141 call mtr.add_suppression("Plugin mysqlx reported: 'Value 'distanthost' set to `Mysqlx_bind_address`, X Plugin can't bind to it. Skipping this value.'");
142 call mtr.add_suppression("Plugin mysqlx reported: 'Setup of bind-address: 'distanthost' port: [0-9]* failed, can't resolve `hostname`'");
143 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
144
145
146
147 --echo
148 --echo #
149 --echo # 11. "ifconfig" bindings
150
151 --perl
152 my $tmpdir = $ENV{MYSQL_TMP_DIR} or die "Need $MYSQL_TMP_DIR";
153 my @ip_addresses = split (/\n/, `ifconfig -a | grep 'inet6 '`);
154 my $insert = 0;
155
156 open(FILE, ">", "$tmpdir/tmp_localhost_ip.inc") or die;
157 print FILE "CREATE TABLE test.ip(ip VARCHAR(50));\n";
158 foreach $ip (@ip_addresses) {
159 if ($ip =~ m/inet6( addr:)? ([0-9a-f:]{3,})/) {
160 print FILE "INSERT INTO test.ip VALUES('$2');\n";
161 $insert++;
162 }
163 }
164 if (! $insert) {
165 print FILE "INSERT INTO test.ip VALUES('::1');\n";
166 }
167 close(FILE);
168 EOF
169
170 --disable_query_log
171 --source $MYSQL_TMP_DIR/tmp_localhost_ip.inc
172 --enable_query_log
173 --remove_file $MYSQL_TMP_DIR/tmp_localhost_ip.inc
174
175 --let $IP_ADDRESSES=`SELECT GROUP_CONCAT(ip SEPARATOR ',') FROM test.ip`
176
177
178 call mtr.add_suppression("Plugin mysqlx reported: 'Value '[0-9a-f,:]+' set to `Mysqlx_bind_address`, X Plugin can't bind to it. Skipping this value.'");
179 call mtr.add_suppression("Plugin mysqlx reported: 'Setup of bind-address: '[0-9a-f,:]+' port: [0-9]* failed, `bind\\(\\)` failed with error: .+ \\([0-9]+\\). Do you already have another mysqld server running with Mysqlx \\?'");
180 --replace_regex /=[0-9a-f,:]+/=$IPs/
181 --let $restart_parameters = restart: --mysqlx_bind_address=$IP_ADDRESSES
182 --source include/restart_mysqld.inc
183
184 SELECT variable_value FROM performance_schema.global_status WHERE variable_name LIKE "Mysqlx_address" INTO @MYSQLX_ADDRESSES;
185
186 --let $assert_cond= [SELECT count(*) > 0 AS value FROM test.ip WHERE LOCATE(ip, @MYSQLX_ADDRESSES) > 0] = 1
187 --let $assert_text= There status variable must point some of \$IPs
188 --source include/assert.inc
189
190 --let $assert_cond= [SELECT @@global.Mysqlx_bind_address = "$IP_ADDRESSES"] = 1
191 --let $assert_text= There variable must point to \$IPs
192 --source include/assert.inc
193
194
195
196 --echo
197 --echo #
198 --echo # 12. default bindings
199 --let $expect_bind_address=*
200 --let $expect_address=::
201 --let $restart_parameters = restart:
202 --source ../include/restart_mysqld_and_verify_bind_addresses.inc
203
204
205 ## Cleanup
206 DROP TABLE test.ip;