Debian Codegraph @

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

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