| 1 |
############## mysql-test\t\require_secure_transport_basic.test ############### |
| 2 |
# # |
| 3 |
# Variable Name: require_secure_transport # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: numeric # |
| 7 |
# Default Value: 0 # |
| 8 |
# Range: - # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2015-06-12 # |
| 12 |
# Author: Todd Farmer # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable require_secure_transport # |
| 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 |
# Reference: http://dev.mysql.com/doc/refman/5.7/en/ # |
| 22 |
# server-system-variables.html # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
--source include/load_sysvars.inc |
| 26 |
|
| 27 |
|
| 28 |
############################################################################### |
| 29 |
# START OF require_secure_transport TESTS # |
| 30 |
############################################################################### |
| 31 |
|
| 32 |
|
| 33 |
############################################################################### |
| 34 |
# Saving initial value of require_secure_transport in a temporary variable # |
| 35 |
############################################################################### |
| 36 |
|
| 37 |
SET @start_value = @@global.require_secure_transport; |
| 38 |
SELECT @start_value; |
| 39 |
|
| 40 |
|
| 41 |
--echo '#--------------------FN_DYNVARS_139_01------------------------#' |
| 42 |
############################################################################### |
| 43 |
# Display the DEFAULT value of require_secure_transport # |
| 44 |
############################################################################### |
| 45 |
|
| 46 |
SET @@global.require_secure_transport = 1; |
| 47 |
SET @@global.require_secure_transport = DEFAULT; |
| 48 |
SELECT @@global.require_secure_transport; |
| 49 |
|
| 50 |
|
| 51 |
--echo '#---------------------FN_DYNVARS_139_02-------------------------#' |
| 52 |
############################################### |
| 53 |
# Verify default value of variable # |
| 54 |
############################################### |
| 55 |
|
| 56 |
SET @@global.require_secure_transport = @start_value; |
| 57 |
SELECT @@global.require_secure_transport = 0; |
| 58 |
|
| 59 |
|
| 60 |
--echo '#--------------------FN_DYNVARS_139_03------------------------#' |
| 61 |
################################################################################ |
| 62 |
# Change the value of require_secure_transport to a valid value # |
| 63 |
################################################################################ |
| 64 |
|
| 65 |
SET @@global.require_secure_transport = 0; |
| 66 |
SELECT @@global.require_secure_transport; |
| 67 |
SET @@global.require_secure_transport = 1; |
| 68 |
SELECT @@global.require_secure_transport; |
| 69 |
SET @@global.require_secure_transport = TRUE; |
| 70 |
SELECT @@global.require_secure_transport; |
| 71 |
SET @@global.require_secure_transport = FALSE; |
| 72 |
SELECT @@global.require_secure_transport; |
| 73 |
SET @@global.require_secure_transport = ON; |
| 74 |
SELECT @@global.require_secure_transport; |
| 75 |
SET @@global.require_secure_transport = OFF; |
| 76 |
SELECT @@global.require_secure_transport; |
| 77 |
|
| 78 |
--echo '#--------------------FN_DYNVARS_139_04-------------------------#' |
| 79 |
################################################################################### |
| 80 |
# Change the value of require_secure_transport to invalid value # |
| 81 |
################################################################################### |
| 82 |
|
| 83 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 84 |
SET @@global.require_secure_transport = -1; |
| 85 |
SELECT @@global.require_secure_transport; |
| 86 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 87 |
SET @@global.require_secure_transport = 4294967296; |
| 88 |
SELECT @@global.require_secure_transport; |
| 89 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 90 |
SET @@global.require_secure_transport = 10240022115; |
| 91 |
SELECT @@global.require_secure_transport; |
| 92 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 93 |
SET @@global.require_secure_transport = 10000.01; |
| 94 |
SELECT @@global.require_secure_transport; |
| 95 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 96 |
SET @@global.require_secure_transport = -1024; |
| 97 |
SELECT @@global.require_secure_transport; |
| 98 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 99 |
SET @@global.require_secure_transport = 42949672950; |
| 100 |
SELECT @@global.require_secure_transport; |
| 101 |
|
| 102 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 103 |
SET @@global.require_secure_transport = 'test'; |
| 104 |
SELECT @@global.require_secure_transport; |
| 105 |
|
| 106 |
|
| 107 |
--echo '#-------------------FN_DYNVARS_139_05----------------------------#' |
| 108 |
################################################################################### |
| 109 |
# Test if accessing session require_secure_transport gives error # |
| 110 |
################################################################################### |
| 111 |
|
| 112 |
--Error ER_GLOBAL_VARIABLE |
| 113 |
SET @@session.require_secure_transport = 0; |
| 114 |
SELECT @@require_secure_transport; |
| 115 |
|
| 116 |
|
| 117 |
--echo '#----------------------FN_DYNVARS_139_06------------------------#' |
| 118 |
############################################################################## |
| 119 |
# Check if the value in GLOBAL & SESSION Tables matches values in variable # |
| 120 |
############################################################################## |
| 121 |
|
| 122 |
--disable_warnings |
| 123 |
SELECT IF(@@global.require_secure_transport, "ON", "OFF") = VARIABLE_VALUE |
| 124 |
FROM performance_schema.global_variables |
| 125 |
WHERE VARIABLE_NAME='require_secure_transport'; |
| 126 |
|
| 127 |
SELECT IF(@@require_secure_transport, "ON", "OFF") = VARIABLE_VALUE |
| 128 |
FROM performance_schema.session_variables |
| 129 |
WHERE VARIABLE_NAME='require_secure_transport'; |
| 130 |
--enable_warnings |
| 131 |
|
| 132 |
|
| 133 |
--echo '#---------------------FN_DYNVARS_139_07----------------------#' |
| 134 |
######################################################################################################## |
| 135 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # |
| 136 |
######################################################################################################## |
| 137 |
|
| 138 |
SET @@global.require_secure_transport = 1; |
| 139 |
SELECT @@require_secure_transport = @@global.require_secure_transport; |
| 140 |
|
| 141 |
|
| 142 |
--echo '#---------------------FN_DYNVARS_139_08----------------------#' |
| 143 |
################################################################################## |
| 144 |
# Check if require_secure_transport can be accessed with and without @@ sign # |
| 145 |
################################################################################## |
| 146 |
|
| 147 |
--Error ER_GLOBAL_VARIABLE |
| 148 |
SET require_secure_transport = 1; |
| 149 |
SELECT @@require_secure_transport; |
| 150 |
--Error ER_PARSE_ERROR |
| 151 |
SET local.require_secure_transport = 1; |
| 152 |
--Error ER_UNKNOWN_TABLE |
| 153 |
SELECT local.require_secure_transport; |
| 154 |
--Error ER_PARSE_ERROR |
| 155 |
SET global.require_secure_transport = 1; |
| 156 |
--Error ER_UNKNOWN_TABLE |
| 157 |
SELECT global.require_secure_transport; |
| 158 |
--Error ER_BAD_FIELD_ERROR |
| 159 |
SELECT require_secure_transport; |
| 160 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 161 |
SELECT @@session.require_secure_transport; |
| 162 |
|
| 163 |
|
| 164 |
############################## |
| 165 |
# Restore initial value # |
| 166 |
############################## |
| 167 |
|
| 168 |
SET @@global.require_secure_transport = @start_value; |
| 169 |
SELECT @@global.require_secure_transport; |
| 170 |
|
| 171 |
|
| 172 |
################################################################################ |
| 173 |
# END OF require_secure_transport TESTS # |
| 174 |
################################################################################ |
| 175 |
|