Debian Codegraph @

mysql-test/suite/sys_vars/inc/max_connect_errors_basic.inc

raw
1 ################## mysql-test\t\max_connect_errors_basic.test ###################
2 # #
3 # Variable Name: max_connect_errors #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 100 #
8 # Range: 1 - 4294967295/18446744073709551615 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable max_connect_errors #
15 # that checks the behavior of this variable in the following ways #
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity #
20 # #
21 # Modified: Pavan Naik, 2015-11-24 #
22 # Added boundary value test cases according to the type of the #
23 # server binary. #
24 # #
25 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
26 # server-system-variables.html #
27 # #
28 #################################################################################
29
30 --source include/load_sysvars.inc
31
32 ##################################################################
33 # START OF max_connect_errors TESTS #
34 ##################################################################
35
36
37 ######################################################################
38 # Saving initial value of max_connect_errors in a temporary variable #
39 ######################################################################
40
41 SET @start_value = @@global.max_connect_errors;
42 SELECT @start_value;
43
44
45 --echo '#--------------------FN_DYNVARS_073_01------------------------#'
46 ##################################################################
47 # Display the DEFAULT value of max_connect_errors #
48 ##################################################################
49
50 SET @@global.max_connect_errors = 5000;
51 SET @@global.max_connect_errors = DEFAULT;
52 SELECT @@global.max_connect_errors;
53
54 --echo '#---------------------FN_DYNVARS_073_02-------------------------#'
55 ###############################################
56 # Verify default value of variable #
57 ###############################################
58
59 SET @@global.max_connect_errors = @start_value;
60 SELECT @@global.max_connect_errors = 100;
61
62 --echo '#--------------------FN_DYNVARS_073_03------------------------#'
63 ##################################################################
64 # Change the value of max_connect_errors to a valid value #
65 ##################################################################
66
67 SET @@global.max_connect_errors = 4096;
68 SELECT @@global.max_connect_errors;
69 SET @@global.max_connect_errors = 4294967294;
70 SELECT @@global.max_connect_errors;
71 SET @@global.max_connect_errors = 4294967295;
72 SELECT @@global.max_connect_errors;
73 SET @@global.max_connect_errors = 1;
74 SELECT @@global.max_connect_errors;
75 SET @@global.max_connect_errors = 2;
76 SELECT @@global.max_connect_errors;
77
78 # Test cases for 64-bit machines
79 if($mach64)
80 {
81 --disable_warnings
82 SET @@global.max_connect_errors = 18446744073709551615;
83 --enable_warnings
84
85 # Bug#11752618 - 64-BIT WINDOWS VARIABLES LIMITED TO DIFFERENT VALUES THAN 64-BIT LINUX/SO
86 let $machine_name = `SELECT CONVERT(@@version_compile_os using latin1) IN ("Win64", "Windows")`;
87
88 if($machine_name)
89 {
90 --replace_result 4294967295 18446744073709551615
91 }
92 SELECT @@global.max_connect_errors;
93 }
94
95 --echo '#--------------------FN_DYNVARS_073_04-------------------------#'
96 #####################################################################
97 # Change the value of max_connect_errors to invalid value #
98 #####################################################################
99
100 SET @@global.max_connect_errors = -1;
101 SELECT @@global.max_connect_errors;
102 --Error ER_WRONG_TYPE_FOR_VAR
103 SET @@global.max_connect_errors = 10000.01;
104 SELECT @@global.max_connect_errors;
105 SET @@global.max_connect_errors = -1024;
106 SELECT @@global.max_connect_errors;
107 SET @@global.max_connect_errors = 0;
108 SELECT @@global.max_connect_errors;
109
110 --Error ER_WRONG_TYPE_FOR_VAR
111 SET @@global.max_connect_errors = ON;
112 SELECT @@global.max_connect_errors;
113 --Error ER_WRONG_TYPE_FOR_VAR
114 SET @@global.max_connect_errors = 'test';
115 SELECT @@global.max_connect_errors;
116
117 if($mach32)
118 {
119 SET @@global.max_connect_errors = 4294967296;
120 SELECT @@global.max_connect_errors;
121
122 SET @@global.max_connect_errors = 42949672950;
123 SELECT @@global.max_connect_errors;
124 }
125
126 if($mach64)
127 {
128 --error ER_WRONG_TYPE_FOR_VAR
129 SET @@global.max_connect_errors = 18446744073709551616;
130 SELECT @@global.max_connect_errors;
131 }
132
133 --echo '#-------------------FN_DYNVARS_073_05----------------------------#'
134 #####################################################################
135 # Test if accessing session max_connect_errors gives error #
136 #####################################################################
137
138 --Error ER_GLOBAL_VARIABLE
139 SET @@session.max_connect_errors = 4096;
140 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
141 SELECT @@session.max_connect_errors;
142
143
144 --echo '#----------------------FN_DYNVARS_073_06------------------------#'
145 ##############################################################################
146 # Check if the value in GLOBAL & SESSION Tables matches values in variable #
147 ##############################################################################
148
149 --disable_warnings
150 SELECT @@global.max_connect_errors = VARIABLE_VALUE
151 FROM performance_schema.global_variables
152 WHERE VARIABLE_NAME='max_connect_errors';
153
154 SELECT @@max_connect_errors = VARIABLE_VALUE
155 FROM performance_schema.session_variables
156 WHERE VARIABLE_NAME='max_connect_errors';
157 --enable_warnings
158
159
160 --echo '#---------------------FN_DYNVARS_073_07----------------------#'
161 ###################################################################
162 # Check if TRUE and FALSE values can be used on variable #
163 ###################################################################
164
165 SET @@global.max_connect_errors = TRUE;
166 SELECT @@global.max_connect_errors;
167 SET @@global.max_connect_errors = FALSE;
168 SELECT @@global.max_connect_errors;
169
170
171 --echo '#---------------------FN_DYNVARS_073_08----------------------#'
172 ########################################################################################################
173 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
174 ########################################################################################################
175
176 SET @@global.max_connect_errors = 5000;
177 SELECT @@max_connect_errors = @@global.max_connect_errors;
178
179
180 --echo '#---------------------FN_DYNVARS_073_09----------------------#'
181 ##########################################################################
182 # Check if max_connect_errors can be accessed with and without @@ sign #
183 ##########################################################################
184
185 --Error ER_GLOBAL_VARIABLE
186 SET max_connect_errors = 6000;
187 SELECT @@max_connect_errors;
188 --Error ER_PARSE_ERROR
189 SET local.max_connect_errors = 7000;
190 --Error ER_UNKNOWN_TABLE
191 SELECT local.max_connect_errors;
192 --Error ER_PARSE_ERROR
193 SET global.max_connect_errors = 8000;
194 --Error ER_UNKNOWN_TABLE
195 SELECT global.max_connect_errors;
196 --Error ER_BAD_FIELD_ERROR
197 SELECT max_connect_errors;
198 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
199 SELECT @@session.max_connect_errors;
200
201
202 ##############################
203 # Restore initial value #
204 ##############################
205
206 SET @@global.max_connect_errors = @start_value;
207 SELECT @@global.max_connect_errors;
208
209
210 ##################################################################
211 # END OF max_connect_errors TESTS #
212 ##################################################################
213