File: max_user_connections_func.test

package info (click to toggle)
mariadb-10.0 10.0.32-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 476,064 kB
  • sloc: cpp: 1,400,131; ansic: 832,140; perl: 54,391; sh: 41,304; pascal: 32,365; yacc: 14,921; xml: 5,257; sql: 4,667; cs: 4,647; makefile: 4,555; ruby: 4,465; python: 2,292; lex: 1,427; java: 941; asm: 295; awk: 54; php: 22; sed: 16
file content (97 lines) | stat: -rw-r--r-- 3,785 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
############# mysql-test\t\max_user_connections_func.test ####################
#                                                                            #
# Variable Name: max_user_connections                                        #
# Scope: SESSION                                                             #
# Access Type: Dynamic                                                       #
# Data Type: NUMERIC                                                         #
# Default Value: -                                                           #
# Values:       1-4294967295                                                 #
#                                                                            #
#                                                                            #
# Creation Date: 2008-03-02                                                  #
# Author:  Sharique Abdullah                                                 #
#                                                                            #
# Description: Test Cases of Dynamic System Variable "max_user_connections   #
#              that checks behavior of this variable in the following ways   #
#              * Functionality based on different values                     #
#                                                                            #
# Reference:                                                                 #
#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html     #
# option_mysqld_max_user_connections                                         #
#                                                                            #
# Modified: 2008-07-10 HHUNGER: Inserted wait condition                      #
#                                                                            #
##############################################################################

--echo ** Setup **
--echo
#
# Setup
#

--source include/not_embedded.inc

SET @default_max_user_connections = @@global.max_user_connections;

###################################
#Setting value max_user_connection#
###################################

Set Global max_user_connections=2;

GRANT USAGE on *.* TO test@localhost;

--echo '#--------------------FN_DYNVARS_114_01-------------------------#'
########################################
#Should not make more then 2 connection#
########################################

--echo ** Connecting conn1 using username 'test' **
CONNECT (conn1,localhost,test,,);

--echo ** Connecting conn2 using username 'test' **
CONNECT (conn2,localhost,test,,);

--echo ** Connecting conn3 using username 'test' **
--disable_query_log
--Error ER_TOO_MANY_USER_CONNECTIONS
CONNECT (conn3,localhost,test,,);
--enable_query_log
--echo Expected error "too many connections"

--echo ** Disconnecting conn1 **
DISCONNECT conn1;

--echo ** Poll till disconnected conn1 disappears from processlist
let $wait_condition= SELECT count(id) <= 2
   FROM information_schema.processlist WHERE user = 'test';
--source include/wait_condition.inc

--echo '#--------------------FN_DYNVARS_114_02-------------------------#'
#####################################################
#Set value to 3 and see if 3 connections can be made#
#####################################################

connection default;
Set Global max_user_connections=3;
--echo ** Connecting conn5 using username 'test' **
CONNECT (conn5,localhost,test,,);
--echo ** Connecting conn6 using username 'test' **
CONNECT (conn6,localhost,test,,);

#
# Cleanup
#

--echo ** Connection default **
CONNECTION default;

--echo ** Disconnecting conn5, conn6 **
DISCONNECT conn2;
DISCONNECT conn5;
DISCONNECT conn6;

drop user test@localhost;

SET @@global.max_user_connections = @default_max_user_connections;