Debian Codegraph @

mysql-test/suite/sys_vars/t/password_history_basic.test

raw
1 ###############################################################################
2 # #
3 # Variable name: password_history #
4 # Scope : GLOBAL #
5 # Access Type : Dynamic #
6 # Data type : Integer #
7 # Default value: 0 #
8 # Minimum Value: 0 #
9 # Maximum value: 4294967295 #
10 # #
11 # #
12 # Creation Date: 29-Nov-2017 #
13 # Author : Mohit Joshi #
14 # #
15 # Description : Test case added for dynamic server variable password_history #
16 # We check the behaviour of this variable for: #
17 # * Default values #
18 # * Valid and invalid values #
19 # * Scope and access method #
20 # #
21 # References: Reference: http://dev.mysql.com/doc/refman/8.0/en/ #
22 # server-system-variables.html #
23 # #
24 ###############################################################################
25
26 ################################################################
27 # Saving initial values of password_history variable in #
28 # a temporary variable #
29 ################################################################
30
31 SET @password_history_save = @@global.password_history;
32 SELECT @password_history_save;
33
34 ################################################################
35 # Display the DEFAULT value of password_history #
36 ################################################################
37
38 --echo Default value must be 0 for global scope
39 SET @@global.password_history = 1;
40 SET @@global.password_history = DEFAULT;
41 SELECT @@global.password_history;
42
43 --error ER_GLOBAL_VARIABLE
44 SET @@session.password_history = 2;
45 --error ER_GLOBAL_VARIABLE
46 SET @@session.password_history = DEFAULT;
47 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
48 SELECT @@session.password_history;
49
50 ################################################################
51 # Check if NULL or empty value is accepted #
52 ################################################################
53
54 --error ER_WRONG_TYPE_FOR_VAR
55 SET @@global.password_history = NULL;
56
57 --error ER_WRONG_TYPE_FOR_VAR
58 SET @@global.password_history = '';
59
60 --error ER_WRONG_TYPE_FOR_VAR
61 SET @@global.password_history = ' ';
62
63 --error ER_GLOBAL_VARIABLE
64 SET @@session.password_history = NULL;
65
66 --error ER_GLOBAL_VARIABLE
67 SET @@session.password_history = '';
68
69 --error ER_GLOBAL_VARIABLE
70 SET @@session.password_history = ' ';
71
72 ##############################################################################
73 # Change the value of password_history to a valid value for GLOBAL scope #
74 ##############################################################################
75
76 SET @@global.password_history = 0;
77 SELECT @@global.password_history;
78
79 SET @@global.password_history = 1;
80 SELECT @@global.password_history;
81
82 SET @@global.password_history = TRUE;
83 SELECT @@global.password_history;
84
85 SET @@global.password_history = FALSE;
86 SELECT @@global.password_history;
87
88 SET @@global.password_history = 4294967295;
89 SELECT @@global.password_history;
90
91 SET @@global.password_history = DEFAULT;
92 SELECT @@global.password_history;
93
94 #############################################################################
95 # Change the value of password_history to an invalid value for GLOBAL scope #
96 #############################################################################
97
98 SET @@global.password_history = -1;
99 SELECT @@global.password_history;
100
101 --error ER_WRONG_TYPE_FOR_VAR
102 SET @@global.password_history = 'ABC';
103 SELECT @@global.password_history;
104
105 --error ER_WRONG_TYPE_FOR_VAR
106 SET @@global.password_history = ON;
107 SELECT @@global.password_history;
108
109 --error ER_WRONG_TYPE_FOR_VAR
110 SET @@global.password_history = 'OFF';
111 SELECT @@global.password_history;
112
113 --error ER_WRONG_TYPE_FOR_VAR
114 SET @@global.password_history = 2.14;
115 SELECT @@global.password_history;
116
117 --error ER_WRONG_TYPE_FOR_VAR
118 SET @@global.password_history = NONE;
119 SELECT @@global.password_history;
120
121 SET @@global.password_history = -4294967295;
122 SELECT @@global.password_history;
123
124 SET @@global.password_history = 4294967296;
125 SELECT @@global.password_history;
126
127 #############################################################################
128 # Check if the value in GLOBAL Table matches value in variable #
129 #############################################################################
130
131 --echo Must return 1
132 --disable_warnings
133 SELECT @@global.password_history = VARIABLE_VALUE
134 FROM performance_schema.global_variables
135 WHERE VARIABLE_NAME='password_history';
136 --enable_warnings
137
138 ###############################################################################
139 # Check if password_history variable can be accessed with and without @@ sign #
140 ###############################################################################
141
142 SET GLOBAL password_history = 1;
143 SET @@global.password_history = 1;
144
145 --error ER_PARSE_ERROR
146 SET global.password_history = 1;
147
148 --error ER_GLOBAL_VARIABLE
149 SET @@password_history = 1;
150
151 --error ER_GLOBAL_VARIABLE
152 SET password_history = 1;
153
154 --error ER_UNKNOWN_TABLE
155 SELECT global.password_history;
156
157 --error ER_BAD_FIELD_ERROR
158 SELECT GLOBAL password_history;
159
160 SELECT @@password_history;
161
162 #############################################################################
163 # Restoring the original value of password_history variable #
164 #############################################################################
165
166 SET @@global.password_history = @password_history_save;