| 1 |
# Perl socket test code itself is leaking |
| 2 |
--source include/not_valgrind.inc |
| 3 |
--source include/not_asan.inc |
| 4 |
--source include/big_test.inc |
| 5 |
|
| 6 |
# Make sure that connection_control plugin can be loaded |
| 7 |
--source ../inc/have_connection_control_plugin.inc |
| 8 |
|
| 9 |
--echo # Connection delay tests for unauthenticated connections |
| 10 |
--echo # (with or without control exemption) |
| 11 |
|
| 12 |
--echo |
| 13 |
--echo # ---------------------------------------------------------------------- |
| 14 |
--echo |
| 15 |
|
| 16 |
--echo # Setup |
| 17 |
--echo # Install connection_control plugin |
| 18 |
--source ../inc/install_connection_control_plugin.inc |
| 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_exempt= @@global.connection_control_exempt_unknown_users; |
| 24 |
|
| 25 |
-- echo # Set small values for connection_control variables |
| 26 |
SET @@global.connection_control_failed_connections_threshold = 2; |
| 27 |
SET @global.connection_control_max_connection_delay = 1000; |
| 28 |
|
| 29 |
--echo # Check initial Connection_control_exempted_unknown_users - Should be 0 |
| 30 |
SHOW STATUS LIKE 'Connection_control_exempted_unknown_users'; |
| 31 |
|
| 32 |
--echo |
| 33 |
--echo # ---------------------------------------------------------------------- |
| 34 |
--echo |
| 35 |
|
| 36 |
--echo # Following attempt will not experience any delay in server response (exempt enabled) |
| 37 |
|
| 38 |
let SRV_HOST= 127.0.0.1; |
| 39 |
let SRV_PORT= `SELECT @@port`; |
| 40 |
|
| 41 |
SET @@global.connection_control_exempt_unknown_users= 1; |
| 42 |
--source ../inc/tcp_connection.inc |
| 43 |
--source ../inc/tcp_connection.inc |
| 44 |
--source ../inc/tcp_connection.inc |
| 45 |
--echo Connection_control_delay_generated should be 0 |
| 46 |
SHOW STATUS LIKE 'Connection_control_delay_generated'; |
| 47 |
--echo # Connection_control_exempted_unknown_users should be 3 |
| 48 |
SHOW STATUS LIKE 'Connection_control_exempted_unknown_users'; |
| 49 |
|
| 50 |
--echo # Following attempt will experience delay in server response (exempt disabled) |
| 51 |
|
| 52 |
SET @@global.connection_control_exempt_unknown_users= 0; |
| 53 |
--source ../inc/tcp_connection.inc |
| 54 |
--source ../inc/tcp_connection.inc |
| 55 |
--source ../inc/tcp_connection.inc |
| 56 |
--echo Connection_control_delay_generated should be 1 |
| 57 |
SHOW STATUS LIKE 'Connection_control_delay_generated'; |
| 58 |
--echo # Connection_control_exempted_unknown_users should still be 3 |
| 59 |
SHOW STATUS LIKE 'Connection_control_exempted_unknown_users'; |
| 60 |
# wait for connection delay to expire |
| 61 |
--sleep 2 |
| 62 |
|
| 63 |
--echo |
| 64 |
--echo # ---------------------------------------------------------------------- |
| 65 |
--echo |
| 66 |
|
| 67 |
--echo # Cleanup |
| 68 |
|
| 69 |
--echo # Restore original values of connection_control variables |
| 70 |
SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold; |
| 71 |
SET @@global.connection_control_max_connection_delay = @saved_max_delay; |
| 72 |
SET @@global.connection_control_exempt_unknown_users= @saved_exempt; |
| 73 |
|
| 74 |
--echo # Uninstall connection_control plugin |
| 75 |
--source ../inc/uninstall_connection_control_plugin.inc |
| 76 |
|
| 77 |
--echo |
| 78 |
--echo # ---------------------------------------------------------------------- |