Debian Codegraph @

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

raw
1 # Make sure that connection_control plugin can be loaded
2 --source ../inc/have_connection_control_plugin.inc
3
4 # Save the initial number of concurrent sessions
5 --source include/count_sessions.inc
6
7 --echo # Connection delay tests for valid user accounts
8
9 --echo
10 --echo # ----------------------------------------------------------------------
11 --echo
12
13 --echo # Setup
14 --echo # Install connection_control plugin
15 --source ../inc/install_connection_control_plugin.inc
16
17 --echo # Create user account for testing
18 CREATE USER u1 IDENTIFIED BY 'abcd';
19
20 --echo # Save original values of connection_control variables
21 SET @saved_connections_threshold = @@global.connection_control_failed_connections_threshold;
22 SET @saved_max_delay = @@global.connection_control_max_connection_delay;
23 SET @saved_min_delay = @@global.connection_control_min_connection_delay;
24
25 -- echo # Set small values for connection_control variables
26 SET @@global.connection_control_failed_connections_threshold = 3;
27 SET @@global.connection_control_max_connection_delay = 4000;
28 SET @@global.connection_control_min_connection_delay = 2000;
29
30 # We don't need to use client side authentication plugin for this test.
31 let $USE_AUTH_PLUGIN= 0;
32
33 --echo
34 --echo # ----------------------------------------------------------------------
35 --echo
36
37 --echo # Make enough failed attempts to trigger delays
38
39 disable_result_log;
40
41 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
42 --error ER_ACCESS_DENIED_ERROR
43 connect(fail_con_u1, localhost, u1,,,,,);
44 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
45 --error ER_ACCESS_DENIED_ERROR
46 connect(fail_con_u1, localhost, u1,haha,,,,);
47 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
48 --error ER_ACCESS_DENIED_ERROR
49 connect(fail_con_u1, localhost, u1,haha,,,,);
50
51 enable_result_log;
52
53 --echo
54 --echo # Following attempts will experience delay in server respose
55
56 # Trying with invalid passwords
57
58 --source ../inc/set_before_marker.inc
59
60 let $USER=u1;
61 let $PASSWORD=hoho;
62 let $SUCCESS=0;
63 let $DELAY_STATS=1;
64 --source ../inc/check_connection_delay.inc
65
66 let $SERVER_RESPONSE_TIME= 2;
67 --source ../inc/set_after_marker.inc
68
69 --source ../inc/set_before_marker.inc
70 let $USER=u1;
71 let $PASSWORD=hoho;
72 let $SUCCESS=0;
73 let $DELAY_STATS=2;
74 --source ../inc/check_connection_delay.inc
75
76 let $SERVER_RESPONSE_TIME= 2;
77 --source ../inc/set_after_marker.inc
78
79 --source ../inc/set_before_marker.inc
80 let $USER=u1;
81 let $PASSWORD=hoho;
82 let $SUCCESS=0;
83 let $DELAY_STATS=3;
84 --source ../inc/check_connection_delay.inc
85
86 let $SERVER_RESPONSE_TIME= 3;
87 --source ../inc/set_after_marker.inc
88
89 --source ../inc/set_before_marker.inc
90 let $USER=u1;
91 let $PASSWORD=hoho;
92 let $SUCCESS=0;
93 let $DELAY_STATS=4;
94 --source ../inc/check_connection_delay.inc
95
96 let $SERVER_RESPONSE_TIME= 4;
97 --source ../inc/set_after_marker.inc
98
99 # Trying with valid passwords
100
101 --source ../inc/set_before_marker.inc
102 let $USER=u1;
103 let $PASSWORD=abcd;
104 let $SUCCESS=1;
105 let $DELAY_STATS=5;
106 --source ../inc/check_connection_delay.inc
107
108 let $SERVER_RESPONSE_TIME= 4;
109 --source ../inc/set_after_marker.inc
110
111 --echo
112 --echo # Following attempts will not experience any delay in server respose
113
114 let $USER=u1;
115 let $PASSWORD=hoho;
116 let $SUCCESS=0;
117 let $DELAY_STATS=5;
118 --source ../inc/check_connection_delay.inc
119
120 let $USER=u1;
121 let $PASSWORD=abcd;
122 let $SUCCESS=1;
123 let $DELAY_STATS=5;
124 --source ../inc/check_connection_delay.inc
125
126 --echo
127 --echo # ----------------------------------------------------------------------
128 --echo
129
130 --echo # Cleanup
131
132 connection default;
133
134 --echo # Restore original values of conenction_control variables
135 SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold;
136 SET @@global.connection_control_max_connection_delay = @saved_max_delay;
137 SET @@global.connection_control_min_connection_delay = @saved_min_delay;
138
139 --echo # Remove user account created for the test
140 DROP USER u1;
141
142 --echo # Uninstall connection_control plugin
143 --source ../inc/uninstall_connection_control_plugin.inc
144
145 # Wait till all disconnects are completed.
146 --source include/wait_until_count_sessions.inc
147
148 --echo
149 --echo # ----------------------------------------------------------------------