| 1 |
#----------------------------------------------------------------------- |
| 2 |
# Setup |
| 3 |
# Install connection_control plugin |
| 4 |
INSTALL PLUGIN connection_control SONAME 'CONNECTION_CONTROL_LIB'; |
| 5 |
INSTALL PLUGIN connection_control_failed_login_attempts SONAME 'CONNECTION_CONTROL_LIB'; |
| 6 |
# Do proxy setup |
| 7 |
CALL mtr.add_suppression("Plugin test_plugin_server reported: 'Wrong password supplied for proxied'"); |
| 8 |
SET @saved_connections_threshold = @@global.connection_control_failed_connections_threshold; |
| 9 |
SET @saved_max_delay = @@global.connection_control_max_connection_delay; |
| 10 |
SET @saved_min_delay= @@global.connection_control_min_connection_delay; |
| 11 |
SET @@global.connection_control_failed_connections_threshold = 3; |
| 12 |
SET @@global.connection_control_max_connection_delay = 4000; |
| 13 |
SET @@global.connection_control_min_connection_delay = 2000; |
| 14 |
#----------------------------------------------------------------------- |
| 15 |
# Case 1 : Testss for valid user accounts |
| 16 |
# Make enough failed attempts to trigger delays |
| 17 |
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); |
| 18 |
connect(localhost,u1,haha,test,MASTER_PORT,MASTER_SOCKET); |
| 19 |
connect(localhost,u2,efgh,test,MASTER_PORT,MASTER_SOCKET); |
| 20 |
connect(localhost,u3,,test,MASTER_PORT,MASTER_SOCKET); |
| 21 |
connect(localhost,u2,haha,test,MASTER_PORT,MASTER_SOCKET); |
| 22 |
connect(localhost,u3,efgh,test,MASTER_PORT,MASTER_SOCKET); |
| 23 |
connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET); |
| 24 |
connect(localhost,u1,haha,test,MASTER_PORT,MASTER_SOCKET); |
| 25 |
connect(localhost,u3,efgh,test,MASTER_PORT,MASTER_SOCKET); |
| 26 |
# Following attempts will experience delay in server respose |
| 27 |
# Connection attempt should fail. |
| 28 |
Connection_control_delay_generated should be 1 |
| 29 |
Variable_name Value |
| 30 |
Connection_control_delay_generated 1 |
| 31 |
@server_response_time >= 2 |
| 32 |
1 |
| 33 |
# Connection attempt should fail. |
| 34 |
Connection_control_delay_generated should be 2 |
| 35 |
Variable_name Value |
| 36 |
Connection_control_delay_generated 2 |
| 37 |
@server_response_time >= 2 |
| 38 |
1 |
| 39 |
# Connection attempt should fail. |
| 40 |
Connection_control_delay_generated should be 3 |
| 41 |
Variable_name Value |
| 42 |
Connection_control_delay_generated 3 |
| 43 |
@server_response_time >= 2 |
| 44 |
1 |
| 45 |
# Connection attempt should succeed. |
| 46 |
Connection_control_delay_generated should be 4 |
| 47 |
Variable_name Value |
| 48 |
Connection_control_delay_generated 4 |
| 49 |
@server_response_time >= 2 |
| 50 |
1 |
| 51 |
# Connection attempt should succeed. |
| 52 |
Connection_control_delay_generated should be 5 |
| 53 |
Variable_name Value |
| 54 |
Connection_control_delay_generated 5 |
| 55 |
@server_response_time >= 2 |
| 56 |
1 |
| 57 |
# Connection attempt should succeed. |
| 58 |
Connection_control_delay_generated should be 6 |
| 59 |
Variable_name Value |
| 60 |
Connection_control_delay_generated 6 |
| 61 |
@server_response_time >= 2 |
| 62 |
1 |
| 63 |
# Following attempts will not experience any delay in server respose |
| 64 |
# Connection attempt should fail. |
| 65 |
Connection_control_delay_generated should be 6 |
| 66 |
Variable_name Value |
| 67 |
Connection_control_delay_generated 6 |
| 68 |
# Connection attempt should fail. |
| 69 |
Connection_control_delay_generated should be 6 |
| 70 |
Variable_name Value |
| 71 |
Connection_control_delay_generated 6 |
| 72 |
# Connection attempt should fail. |
| 73 |
Connection_control_delay_generated should be 6 |
| 74 |
Variable_name Value |
| 75 |
Connection_control_delay_generated 6 |
| 76 |
# Connection attempt should succeed. |
| 77 |
Connection_control_delay_generated should be 6 |
| 78 |
Variable_name Value |
| 79 |
Connection_control_delay_generated 6 |
| 80 |
# Connection attempt should succeed. |
| 81 |
Connection_control_delay_generated should be 6 |
| 82 |
Variable_name Value |
| 83 |
Connection_control_delay_generated 6 |
| 84 |
# Connection attempt should succeed. |
| 85 |
Connection_control_delay_generated should be 6 |
| 86 |
Variable_name Value |
| 87 |
Connection_control_delay_generated 6 |
| 88 |
#----------------------------------------------------------------------- |
| 89 |
# Cleanup |
| 90 |
SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold; |
| 91 |
SET @@global.connection_control_max_connection_delay = @saved_max_delay; |
| 92 |
SET @@global.connection_control_min_connection_delay = @saved_min_delay; |
| 93 |
# Remove user accounts |
| 94 |
# Uninstall connection_control plugin |
| 95 |
UNINSTALL PLUGIN connection_control; |
| 96 |
UNINSTALL PLUGIN connection_control_failed_login_attempts; |
| 97 |
#----------------------------------------------------------------------- |