| 1 |
################# mysql-test\t\connect_timeout_basic.test ###################### |
| 2 |
# # |
| 3 |
# Variable Name: connect_timeout # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: Numeric # |
| 7 |
# Default Value: 5 # |
| 8 |
# Range: 2 - 31536000 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Salman Rawala # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable "connect_timeout" # |
| 15 |
# that checks behavior of this variable in the following ways # |
| 16 |
# * Default Value # |
| 17 |
# * Valid & Invalid values # |
| 18 |
# * Scope & Access method # |
| 19 |
# * Data Integrity . # |
| 20 |
# # |
| 21 |
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # |
| 22 |
# server-system-variables.html#option_mysqld_connect_timeout # |
| 23 |
# # |
| 24 |
################################################################################ |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
|
| 28 |
############################################################### |
| 29 |
# START OF connect_timeout TESTS # |
| 30 |
############################################################### |
| 31 |
|
| 32 |
####################################################################### |
| 33 |
# Saving initial value of connect_timeout in a temporary variable # |
| 34 |
####################################################################### |
| 35 |
|
| 36 |
SET @start_value = @@global.connect_timeout; |
| 37 |
SELECT @start_value; |
| 38 |
|
| 39 |
--echo '#--------------------FN_DYNVARS_019_01------------------------#' |
| 40 |
####################################################################### |
| 41 |
# Display the DEFAULT value of connect_timeout # |
| 42 |
####################################################################### |
| 43 |
|
| 44 |
SET @@global.connect_timeout = 100; |
| 45 |
SET @@global.connect_timeout = DEFAULT; |
| 46 |
SELECT @@global.connect_timeout; |
| 47 |
|
| 48 |
|
| 49 |
--echo '#---------------------FN_DYNVARS_019_02-------------------------#' |
| 50 |
############################################### |
| 51 |
# Verify default value of variable # |
| 52 |
############################################### |
| 53 |
|
| 54 |
SET @@global.connect_timeout = @start_value; |
| 55 |
SELECT @@global.connect_timeout = 5; |
| 56 |
|
| 57 |
|
| 58 |
--echo '#--------------------FN_DYNVARS_019_03------------------------#' |
| 59 |
####################################################################### |
| 60 |
# Change the value of connect_timeout to a valid value # |
| 61 |
####################################################################### |
| 62 |
|
| 63 |
SET @@global.connect_timeout = 2; |
| 64 |
SELECT @@global.connect_timeout; |
| 65 |
SET @@global.connect_timeout = 10000; |
| 66 |
SELECT @@global.connect_timeout; |
| 67 |
SET @@global.connect_timeout = 21221204; |
| 68 |
SELECT @@global.connect_timeout; |
| 69 |
SET @@global.connect_timeout = 31536000; |
| 70 |
SELECT @@global.connect_timeout; |
| 71 |
|
| 72 |
|
| 73 |
--echo '#--------------------FN_DYNVARS_019_04-------------------------#' |
| 74 |
########################################################################## |
| 75 |
# Change the value of connect_timeout to invalid value # |
| 76 |
########################################################################## |
| 77 |
|
| 78 |
SET @@global.connect_timeout = 1; |
| 79 |
SELECT @@global.connect_timeout; |
| 80 |
SET @@global.connect_timeout = -1024; |
| 81 |
SELECT @@global.connect_timeout; |
| 82 |
SET @@global.connect_timeout = 31536001; |
| 83 |
SELECT @@global.connect_timeout; |
| 84 |
SET @@global.connect_timeout = 42949672950; |
| 85 |
SELECT @@global.connect_timeout; |
| 86 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 87 |
SET @@global.connect_timeout = 21221204.10; |
| 88 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 89 |
SET @@global.connect_timeout = ON; |
| 90 |
|
| 91 |
|
| 92 |
--echo '#-------------------FN_DYNVARS_019_05----------------------------#' |
| 93 |
########################################################################## |
| 94 |
# Test if accessing session connect_timeout gives error # |
| 95 |
########################################################################## |
| 96 |
|
| 97 |
--Error ER_GLOBAL_VARIABLE |
| 98 |
SET @@session.connect_timeout = 0; |
| 99 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 100 |
SELECT @@session.connect_timeout; |
| 101 |
|
| 102 |
|
| 103 |
--echo '#----------------------FN_DYNVARS_019_06------------------------#' |
| 104 |
#################################################################### |
| 105 |
# Check if the value in GLOBAL Tables matches values in variable # |
| 106 |
#################################################################### |
| 107 |
|
| 108 |
--disable_warnings |
| 109 |
SELECT @@global.connect_timeout = VARIABLE_VALUE |
| 110 |
FROM performance_schema.global_variables |
| 111 |
WHERE VARIABLE_NAME='connect_timeout'; |
| 112 |
--enable_warnings |
| 113 |
|
| 114 |
--echo '#---------------------FN_DYNVARS_019_07----------------------#' |
| 115 |
################################################################### |
| 116 |
# Check if TRUE and FALSE values can be used on variable # |
| 117 |
################################################################### |
| 118 |
|
| 119 |
SET @@global.connect_timeout = TRUE; |
| 120 |
SELECT @@global.connect_timeout; |
| 121 |
SET @@global.connect_timeout = FALSE; |
| 122 |
SELECT @@global.connect_timeout; |
| 123 |
|
| 124 |
|
| 125 |
--echo '#---------------------FN_DYNVARS_019_08----------------------#' |
| 126 |
############################################################################### |
| 127 |
# Check if accessing variable without SCOPE points to same global variable # |
| 128 |
############################################################################### |
| 129 |
|
| 130 |
SET @@global.connect_timeout = 5; |
| 131 |
SELECT @@connect_timeout = @@global.connect_timeout; |
| 132 |
|
| 133 |
--echo '#---------------------FN_DYNVARS_019_09----------------------#' |
| 134 |
######################################################################### |
| 135 |
# Check if connect_timeout can be accessed with and without @@ sign # |
| 136 |
######################################################################### |
| 137 |
|
| 138 |
--Error ER_GLOBAL_VARIABLE |
| 139 |
SET connect_timeout = 1; |
| 140 |
--Error ER_PARSE_ERROR |
| 141 |
SET global.connect_timeout = 1; |
| 142 |
--Error ER_UNKNOWN_TABLE |
| 143 |
SELECT global.connect_timeout; |
| 144 |
--Error ER_BAD_FIELD_ERROR |
| 145 |
SELECT connect_timeout; |
| 146 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 147 |
SELECT @@session.connect_timeout; |
| 148 |
|
| 149 |
############################## |
| 150 |
# Restore initial value # |
| 151 |
############################## |
| 152 |
|
| 153 |
SET @@global.connect_timeout = @start_value; |
| 154 |
SELECT @@global.connect_timeout; |
| 155 |
|
| 156 |
|
| 157 |
######################################################### |
| 158 |
# END OF connect_timeout TESTS # |
| 159 |
######################################################### |
| 160 |
|