diff options
Diffstat (limited to 'mysql-test/t/user_limits.test')
-rw-r--r-- | mysql-test/t/user_limits.test | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test index af0f6545ac4..41af032b97e 100644 --- a/mysql-test/t/user_limits.test +++ b/mysql-test/t/user_limits.test @@ -3,9 +3,12 @@ # # Requires privileges to be enabled --- source include/not_embedded.inc +--source include/not_embedded.inc -# Prepare play-ground +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +# Prepare play-ground --disable_warnings drop table if exists t1; --enable_warnings @@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,); connection mqph; select * from t1; select * from t1; ---error 1226 +--error ER_USER_LIMIT_REACHED select * from t1; connect (mqph2, localhost, mysqltest_1,,); connection mqph2; ---error 1226 +--error ER_USER_LIMIT_REACHED select * from t1; # cleanup connection default; @@ -50,12 +53,12 @@ select * from t1; select * from t1; delete from t1; delete from t1; ---error 1226 +--error ER_USER_LIMIT_REACHED delete from t1; select * from t1; connect (muph2, localhost, mysqltest_1,,); connection muph2; ---error 1226 +--error ER_USER_LIMIT_REACHED delete from t1; select * from t1; # Cleanup @@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,); connection mcph2; select * from t1; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK ---error 1226 +--error ER_USER_LIMIT_REACHED connect (mcph3, localhost, mysqltest_1,,); # Old connection is still ok select * from t1; @@ -83,7 +86,7 @@ select * from t1; disconnect mcph1; disconnect mcph2; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK ---error 1226 +--error ER_USER_LIMIT_REACHED connect (mcph3, localhost, mysqltest_1,,); # Cleanup connection default; @@ -101,13 +104,13 @@ connect (muc2, localhost, mysqltest_1,,); connection muc2; select * from t1; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK ---error 1226 +--error ER_USER_LIMIT_REACHED connect (muc3, localhost, mysqltest_1,,); # Closing of one of connections should help disconnect muc1; connect (muc3, localhost, mysqltest_1,,); select * from t1; -# Changing of limit should also help (and immediately) +# Changing of limit should also help (and immediately) connection default; grant usage on *.* to mysqltest_1@localhost with max_user_connections 3; flush user_resources; @@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,); connection muc4; select * from t1; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK ---error 1226 +--error ER_USER_LIMIT_REACHED connect (muc5, localhost, mysqltest_1,,); # Clean up connection default; @@ -129,10 +132,10 @@ drop user mysqltest_1@localhost; select @@session.max_user_connections, @@global.max_user_connections; # Local max_user_connections variable can't be set directly # since this limit is per-account ---error 1229 -set session max_user_connections= 2; +--error ER_GLOBAL_VARIABLE +set session max_user_connections= 2; # But it is ok to set global max_user_connections -set global max_user_connections= 2; +set global max_user_connections= 2; select @@session.max_user_connections, @@global.max_user_connections; # Let us check that global limit works grant usage on *.* to mysqltest_1@localhost; @@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,); connection muca2; select * from t1; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK ---error 1203 +--error ER_TOO_MANY_USER_CONNECTIONS connect (muca3, localhost, mysqltest_1,,); # Now we are testing that per-account limit prevails over gloabl limit connection default; @@ -154,16 +157,20 @@ connect (muca3, localhost, mysqltest_1,,); connection muca3; select @@session.max_user_connections, @@global.max_user_connections; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK ---error 1226 +--error ER_USER_LIMIT_REACHED connect (muca4, localhost, mysqltest_1,,); # Cleanup connection default; disconnect muca1; disconnect muca2; disconnect muca3; -set global max_user_connections= 0; +set global max_user_connections= 0; drop user mysqltest_1@localhost; --enable_ps_protocol # Final cleanup drop table t1; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc + |