Debian Codegraph @

mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test

raw
1
2 #
3 # Tests for the performance_schema host_cache.
4 #
5 # Simulate failures from client / server protocol:
6 # - reported in COUNT_HANDSHAKE_ERRORS
7 # aud further causes blocking errors:
8 # - reported in SUM_CONNECT_ERRORS
9 # - reported in COUNT_HOST_BLOCKED_ERRORS
10
11 --source include/have_debug.inc
12 --source include/have_ipv6.inc
13
14 # Enforce a clean state
15 --source ../include/wait_for_pfs_thread_count.inc
16 --source ../include/hostcache_set_state.inc
17
18 select @@global.max_connect_errors into @saved_max_connect_errors;
19
20 set global max_connect_errors = 3;
21
22 create user 'root'@'santa.claus.ipv6.example.com';
23 grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
24
25 create user 'quota'@'santa.claus.ipv6.example.com' identified with 'mysql_native_password';
26 grant select on test.* to 'quota'@'santa.claus.ipv6.example.com';
27
28 connect (con1,"::1",root,,test,$MASTER_MYPORT,);
29 select "Con1 is alive";
30 select current_user();
31 disconnect con1;
32
33 --connection default
34 set global debug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply";
35
36 --disable_query_log
37 --error ER_HANDSHAKE_ERROR
38 connect (con2a,"::1",quota,,test,$MASTER_MYPORT,);
39 --enable_query_log
40
41 --connection default
42 --source ../include/hostcache_dump.inc
43
44 --disable_query_log
45 --error ER_HANDSHAKE_ERROR
46 connect (con2b,"::1",quota,,test,$MASTER_MYPORT,);
47 --enable_query_log
48
49 --connection default
50 --source ../include/hostcache_dump.inc
51
52 --disable_query_log
53 --error ER_HANDSHAKE_ERROR
54 connect (con2c,"::1",quota,,test,$MASTER_MYPORT,);
55 --enable_query_log
56
57 --connection default
58 --source ../include/hostcache_dump.inc
59
60 --disable_query_log
61 --error ER_HOST_IS_BLOCKED
62 connect (con2d,"::1",quota,,test,$MASTER_MYPORT,);
63 --enable_query_log
64
65 --connection default
66 --source ../include/hostcache_dump.inc
67
68 --disable_query_log
69 --error ER_HOST_IS_BLOCKED
70 connect (con2e,"::1",quota,,test,$MASTER_MYPORT,);
71 --enable_query_log
72
73 --connection default
74 --source ../include/hostcache_dump.inc
75
76 # Now that the host is blocked, check that flush works
77 TRUNCATE TABLE performance_schema.host_cache;
78
79 --disable_query_log
80 --error ER_HANDSHAKE_ERROR
81 connect (con3a,"::1",quota,,test,$MASTER_MYPORT,);
82 --enable_query_log
83
84 --connection default
85 --source ../include/hostcache_dump.inc
86
87 --disable_query_log
88 --error ER_HANDSHAKE_ERROR
89 connect (con3b,"::1",quota,,test,$MASTER_MYPORT,);
90 --enable_query_log
91
92 --connection default
93 --source ../include/hostcache_dump.inc
94
95 --connection default
96 set global debug= "-d,native_password_bad_reply";
97
98 --disable_query_log
99 connect (con4,"::1",quota,,test,$MASTER_MYPORT,);
100 select "Valid connection should reset SUM_CONNECT_ERROR counter" as message;
101 --disconnect con4
102 --enable_query_log
103
104 --connection default
105 set global debug= "+d,native_password_bad_reply";
106
107 --connection default
108 --source ../include/hostcache_dump.inc
109
110 --disable_query_log
111 --error ER_HANDSHAKE_ERROR
112 connect (con5a,"::1",quota,,test,$MASTER_MYPORT,);
113 --enable_query_log
114
115 --connection default
116 --source ../include/hostcache_dump.inc
117
118 --disable_query_log
119 --error ER_HANDSHAKE_ERROR
120 connect (con5b,"::1",quota,,test,$MASTER_MYPORT,);
121 --enable_query_log
122
123 --connection default
124 --source ../include/hostcache_dump.inc
125
126 --disable_query_log
127 --error ER_HANDSHAKE_ERROR
128 connect (con5c,"::1",quota,,test,$MASTER_MYPORT,);
129 --enable_query_log
130
131 --connection default
132 --source ../include/hostcache_dump.inc
133
134 --disable_query_log
135 --error ER_HOST_IS_BLOCKED
136 connect (con5d,"::1",quota,,test,$MASTER_MYPORT,);
137 --enable_query_log
138
139 --connection default
140 --source ../include/hostcache_dump.inc
141
142 --disable_query_log
143 --error ER_HOST_IS_BLOCKED
144 connect (con5e,"::1",quota,,test,$MASTER_MYPORT,);
145 --enable_query_log
146
147 --connection default
148 --source ../include/hostcache_dump.inc
149
150 revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
151 drop user 'root'@'santa.claus.ipv6.example.com';
152
153 revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com';
154 drop user 'quota'@'santa.claus.ipv6.example.com';
155
156 set global max_connect_errors = @saved_max_connect_errors;
157 set global debug= default;
158