~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/t/max_user_connections_func.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
--echo '#--------------------FN_DYNVARS_114_01-------------------------#'
 
43
########################################
 
44
#Should not make more then 2 connection#
 
45
########################################
 
46
 
 
47
--echo ** Connecting conn1 using username 'root' **
 
48
CONNECT (conn1,localhost,root,,);
 
49
 
 
50
--echo ** Connecting conn2 using username 'root' **
 
51
CONNECT (conn2,localhost,root,,);
 
52
 
 
53
--echo ** Connecting conn3 using username 'root' **
 
54
--disable_query_log
 
55
--Error ER_TOO_MANY_USER_CONNECTIONS
 
56
CONNECT (conn3,localhost,root,,);
 
57
--enable_query_log
 
58
--echo Expected error "too many connections"
 
59
 
 
60
--echo ** Disconnecting conn1 **
 
61
DISCONNECT conn1;
 
62
 
 
63
--echo ** Poll till disconnected conn1 disappears from processlist
 
64
let $wait_condition= SELECT count(id) <= 2
 
65
   FROM information_schema.processlist WHERE user = 'root';
 
66
--source include/wait_condition.inc
 
67
 
 
68
--echo '#--------------------FN_DYNVARS_114_02-------------------------#'
 
69
#####################################################
 
70
#Set value to 3 and see if 3 connections can be made#
 
71
#####################################################
 
72
 
 
73
Set Global max_user_connections=3;
 
74
--echo ** Connecting conn5 using username 'root' **
 
75
CONNECT (conn5,localhost,root,,);
 
76
--echo ** Connecting conn6 using username 'root' **
 
77
CONNECT (conn6,localhost,root,,);
 
78
 
 
79
#
 
80
# Cleanup
 
81
#
 
82
 
 
83
--echo ** Connection default **
 
84
CONNECTION default;
 
85
 
 
86
--echo ** Disconnecting conn5, conn6 **
 
87
DISCONNECT conn2;
 
88
DISCONNECT conn5;
 
89
DISCONNECT conn6;
 
90
 
 
91
SET @@global.max_user_connections = @default_max_user_connections;
 
92