Debian Codegraph @

mysql-test/suite/sys_vars/t/max_user_connections_func.test

raw
1 ############# mysql-test\t\max_user_connections_func.test ####################
2 # #
3 # Variable Name: max_user_connections #
4 # Scope: SESSION #
5 # Access Type: Dynamic #
6 # Data Type: NUMERIC #
7 # Default Value: - #
8 # Values: 1-4294967295 #
9 # #
10 # #
11 # Creation Date: 2008-03-02 #
12 # Author: Sharique Abdullah #
13 # #
14 # Description: Test Cases of Dynamic System Variable "max_user_connections #
15 # that checks behavior of this variable in the following ways #
16 # * Functionality based on different values #
17 # #
18 # Reference: #
19 # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
20 # option_mysqld_max_user_connections #
21 # #
22 # Modified: 2008-07-10 HHUNGER: Inserted wait condition #
23 # #
24 ##############################################################################
25
26 --echo ** Setup **
27 --echo
28 #
29 # Setup
30 #
31
32 --source include/not_embedded.inc
33
34 SET @default_max_user_connections = @@global.max_user_connections;
35
36 ###################################
37 #Setting value max_user_connection#
38 ###################################
39
40 Set Global max_user_connections=2;
41
42 CREATE USER test@localhost;
43 GRANT USAGE on *.* TO test@localhost;
44
45 --echo '#--------------------FN_DYNVARS_114_01-------------------------#'
46 ########################################
47 #Should not make more then 2 connection#
48 ########################################
49
50 CONNECT (conn1,localhost,test,,);
51
52 CONNECT (conn2,localhost,test,,);
53
54 --disable_query_log
55 --Error ER_TOO_MANY_USER_CONNECTIONS
56 CONNECT (conn3,localhost,test,,);
57 --enable_query_log
58 --echo Expected error "too many connections"
59
60 DISCONNECT conn1;
61
62 --echo ** Poll till disconnected conn1 disappears from processlist
63 let $wait_condition= SELECT count(id) <= 2
64 FROM information_schema.processlist WHERE user = 'test';
65 --source include/wait_condition.inc
66
67 --echo '#--------------------FN_DYNVARS_114_02-------------------------#'
68 #####################################################
69 #Set value to 3 and see if 3 connections can be made#
70 #####################################################
71
72 connection default;
73 Set Global max_user_connections=3;
74 CONNECT (conn5,localhost,test,,);
75 CONNECT (conn6,localhost,test,,);
76
77 #
78 # Cleanup
79 #
80
81 CONNECTION default;
82
83 DISCONNECT conn2;
84 DISCONNECT conn5;
85 DISCONNECT conn6;
86
87 drop user test@localhost;
88
89 SET @@global.max_user_connections = @default_max_user_connections;