Debian Codegraph @

mysql-test/suite/connection_control/t/connection_exempt_invalid_users.test

raw
1 # Same test as "connection_delay_invalid_users.test" but with
2 # exempt_unknown_users set to ON, this helped to increase
3 # the code coverage.
4
5 # Make sure that connection_control plugin can be loaded
6 --source ../inc/have_connection_control_plugin.inc
7
8 # Save the initial number of concurrent sessions
9 --source include/count_sessions.inc
10
11
12 --echo # Connection delay tests for invalid user accounts
13
14 --echo
15 --echo # ----------------------------------------------------------------------
16 --echo
17
18 --echo # Setup
19 --echo # Install connection_control plugin
20 --source ../inc/install_connection_control_plugin.inc
21
22 --echo # Save original values of connection_control variables
23 SET @saved_connections_threshold = @@global.connection_control_failed_connections_threshold;
24 SET @saved_max_delay = @@global.connection_control_max_connection_delay;
25 SET @saved_exempt= @@global.connection_control_exempt_unknown_users;
26
27 -- echo # Set small values for connection_control variables
28 SET @@global.connection_control_failed_connections_threshold = 3;
29 SET @@global.connection_control_max_connection_delay = 1000;
30
31 # Exempt users
32 SET @@global.connection_control_exempt_unknown_users= 1;
33
34 # We don't need to use client side authentication plugin for this test.
35 let $USE_AUTH_PLUGIN= 0;
36
37 --echo
38 --echo # ----------------------------------------------------------------------
39 --echo
40
41 --echo # Following attempts will not experience any delay in server respose
42
43 let $USER=u1;
44 let $PASSWORD=hoho;
45 let $SUCCESS=0;
46 let $DELAY_STATS=0;
47 --source ../inc/check_connection_delay.inc
48
49 let $USER=u2;
50 let $PASSWORD=hoho;
51 let $SUCCESS=0;
52 let $DELAY_STATS=0;
53 --source ../inc/check_connection_delay.inc
54
55 let $USER=u3;
56 let $PASSWORD=hoho;
57 let $SUCCESS=0;
58 let $DELAY_STATS=0;
59 --source ../inc/check_connection_delay.inc
60
61 let $USER=u1;
62 let $PASSWORD=hoho;
63 let $SUCCESS=0;
64 let $DELAY_STATS=0;
65 --source ../inc/check_connection_delay.inc
66
67 let $USER=u2;
68 let $PASSWORD=hoho;
69 let $SUCCESS=0;
70 let $DELAY_STATS=0;
71 --source ../inc/check_connection_delay.inc
72
73 let $USER=u3;
74 let $PASSWORD=hoho;
75 let $SUCCESS=0;
76 let $DELAY_STATS=0;
77 --source ../inc/check_connection_delay.inc
78
79 let $USER=u1;
80 let $PASSWORD=hoho;
81 let $SUCCESS=0;
82 let $DELAY_STATS=0;
83 --source ../inc/check_connection_delay.inc
84
85 let $USER=u2;
86 let $PASSWORD=hoho;
87 let $SUCCESS=0;
88 let $DELAY_STATS=0;
89 --source ../inc/check_connection_delay.inc
90
91 let $USER=u3;
92 let $PASSWORD=hoho;
93 let $SUCCESS=0;
94 let $DELAY_STATS=0;
95 --source ../inc/check_connection_delay.inc
96
97 --echo
98 --echo # Following attempts will experience delay in server respose
99
100 let $USER=u1;
101 let $PASSWORD=hoho;
102 let $SUCCESS=0;
103 let $DELAY_STATS=1;
104 --source ../inc/check_connection_delay.inc
105
106 let $USER=u2;
107 let $PASSWORD=hoho;
108 let $SUCCESS=0;
109 let $DELAY_STATS=2;
110 --source ../inc/check_connection_delay.inc
111
112 let $USER=u3;
113 let $PASSWORD=hoho;
114 let $SUCCESS=0;
115 let $DELAY_STATS=3;
116 --source ../inc/check_connection_delay.inc
117
118 --sorted_result
119 SELECT * FROM INFORMATION_SCHEMA.connection_control_failed_login_attempts;
120
121 let $USER=u3;
122 let $PASSWORD=abcd;
123 let $SUCCESS=0;
124 let $DELAY_STATS=4;
125 --source ../inc/check_connection_delay.inc
126
127 let $USER=u2;
128 let $PASSWORD=abcd;
129 let $SUCCESS=0;
130 let $DELAY_STATS=5;
131 --source ../inc/check_connection_delay.inc
132
133 let $USER=u1;
134 let $PASSWORD=abcd;
135 let $SUCCESS=0;
136 let $DELAY_STATS=6;
137 --source ../inc/check_connection_delay.inc
138
139 --sorted_result
140 SELECT * FROM INFORMATION_SCHEMA.connection_control_failed_login_attempts;
141
142 --echo
143 --echo # ----------------------------------------------------------------------
144 --echo
145
146 --echo # Cleanup
147
148 connection default;
149
150 --echo # Restore original values of conenction_control variables
151 SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold;
152 SET @@global.connection_control_max_connection_delay = @saved_max_delay;
153 SET @@global.connection_control_exempt_unknown_users= @saved_exempt;
154
155
156 --echo # Uninstall connection_control plugin
157 --source ../inc/uninstall_connection_control_plugin.inc
158
159 # Wait till all disconnects are completed.
160 --source include/wait_until_count_sessions.inc
161
162 --echo
163 --echo # ----------------------------------------------------------------------