File: mysql_config_editor.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (289 lines) | stat: -rw-r--r-- 10,169 bytes parent folder | download
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289

--echo #
--echo # Testing mysql_config_editor utility.
--echo #

# Note : a) mtr sets the 'MYSQL_TEST_LOGIN_FILE' environment
#           variable to "$opt_tmpdir/.mylogin.cnf".
#        b) The --password option in not tested as its
#           value cannot be specified at command line.

--echo ################################################
--echo # Tests for mysql_config_editor's insert command
--echo ################################################
--echo #
--echo # Default login path (client)
--exec $MYSQL_CONFIG_EDITOR set --user=test_user1 --host=localhost
--echo # done..
--echo # 'test-login-path1'
--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path1 --user=test_user2 --host=127.0.0.1 
--echo # done..
--echo # 'test-login-path2'
--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path2 --user=test_user3 --host=www.mysql.com
--echo # done..
--echo # 'test-login-path3'
--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path3 --user=test_user4 --host=127.0.0.1 --socket=/tmp/configtest.sock --port=15000
--echo # done..

--echo
--echo ################################################
--echo # Tests for mysql_config_editor's print command
--echo ################################################
--echo #
--echo # Default path
--exec $MYSQL_CONFIG_EDITOR print 2>&1
--echo
--echo #
--echo # test-login-path1
--exec $MYSQL_CONFIG_EDITOR print --login-path=test-login-path1 2>&1
--echo
--echo #
--echo # test-login-path2
--exec $MYSQL_CONFIG_EDITOR print --login-path=test-login-path2 2>&1
--echo
--echo #
--echo # all the paths
--exec $MYSQL_CONFIG_EDITOR print --all 2>&1
--echo 
--echo #
--echo # Overwrite existing paths, test-login-path2 & default
--exec $MYSQL_CONFIG_EDITOR set --user=test_user4 --login-path=test-login-path2 --skip-warn
--exec $MYSQL_CONFIG_EDITOR set --user=test_user5 --skip-warn
--echo #
--echo # all the paths again
--exec $MYSQL_CONFIG_EDITOR print --all 2>&1

--echo 
--echo ################################################
--echo # Tests for mysql_config_editor's remove command
--echo ################################################
--echo #
--echo # Default path
--exec $MYSQL_CONFIG_EDITOR remove --skip-warn
--echo # done..
--echo # test-login-path1
--exec $MYSQL_CONFIG_EDITOR remove --login-path=test-login-path1
--echo # done..
--echo # test-login-path3
--exec $MYSQL_CONFIG_EDITOR remove --login-path=test-login-path3 --socket --port
--echo # done..

--echo
--echo ########################
--echo # Printing the leftovers
--echo ########################
--echo #
--echo # using all
--exec $MYSQL_CONFIG_EDITOR print --all

--echo
--echo ###############################################
--echo # Tests for mysql_config_editor's reset command
--echo ###############################################
--exec $MYSQL_CONFIG_EDITOR reset
--echo # done..
--echo # Print-all to check if everything got deleted.
--exec $MYSQL_CONFIG_EDITOR print --all

--echo
--echo ##############################################
--echo # Tests for mysql_config_editor's help command
--echo ##############################################
--replace_regex /.*mysql_config_editor.*\n// /.*Output debug log.*\n// /.*This is a non.debug version.*\n//
--exec $MYSQL_CONFIG_EDITOR help 2>&1
--echo # done..

--echo
--echo ######################
--echo # Testing client tools
--echo ######################
--echo #
--echo # Inserting login paths default & test-login-path1
--exec $MYSQL_CONFIG_EDITOR --verbose set --user=test_user1 --host=localhost 2>&1
--exec $MYSQL_CONFIG_EDITOR --verbose set --login-path=test-login-path1 --user=test_user2 --host=127.0.0.1 2>&1
--exec $MYSQL_CONFIG_EDITOR --verbose set --login-path=test-login-path2 --user=test_user3 --host=127.0.0.1 --socket=/tmp/configtest.sock --port=15000 2>&1
--echo # done..
--echo
--echo # Connecting using 'test_user1'
--echo #
--error 1
--exec $MYSQL 2>&1
--echo
--echo # Connecting using 'test_user2'
--echo #
--error 1
--exec $MYSQL --login-path=test-login-path1 2>&1

--echo # Creating user 'test_user1'
CREATE USER test_user1;
--echo # Creating user 'test_user2'
CREATE USER test_user2;
FLUSH PRIVILEGES;
--echo #
--echo # Now trying to connect again..
--echo # Connecting using 'test_user1'
--echo #
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--echo
--echo # Connecting using 'test_user2'
--echo #
--exec $MYSQLADMIN --no-defaults --login-path=test-login-path1 --port=$MASTER_MYPORT ping 2>&1
--exec $MYSQLADMIN --no-defaults --login-path=test-login-path1 --port=$MASTER_MYPORT ping 2>&1

--echo #
--echo # Inserting a login path to test group suffix (client_suffix1)
--exec $MYSQL_CONFIG_EDITOR set --user=test_user3 --login-path=client_suffix1
--echo
--echo # Printing all the paths..
--exec $MYSQL_CONFIG_EDITOR print --all 2>&1
--echo
--echo # Now trying to connect using 'test_user3'
--echo # Note : In this case options from login
--echo #        paths 'client' (default) and 
--echo #        client_suffix1 will be read..
--error 1 
--exec $MYSQL --defaults-group-suffix=_suffix1 2>&1

--echo ## Running my_print_defaults ##
--echo #
--echo # (a) With --no-defaults option..
--echo # It should print the options under the default
--echo # login path 'client'.
--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults client 2>&1
--echo
--echo # (b) With --no-defaults & --login-path
--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path1 client 2>&1
--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path2 client 2>&1
--echo
--echo # (c) With --no-defaults & --defaults-group-suffix
--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --defaults-group-suffix=_suffix1 client 2>&1
--echo
--echo # (d) With --no-defaults, --login-path & --defaults-group-suffix
--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path --defaults-group-suffix=1 client 2>&1
#--exec xterm -e gdb --args $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path --defaults-group-suffix=1 client 2>&1

# Cleanup
--echo
--echo # Dropping users 'test_user1' & 'test_user2'
DROP USER test_user1, test_user2;
--echo
--echo ###############################
--echo # Resetting the test login file
--echo ###############################
--exec $MYSQL_CONFIG_EDITOR reset
--echo # done..

--echo
--echo ####################################
--echo # Testing with an invalid login file
--echo ####################################
--remove_file $MYSQL_TEST_LOGIN_FILE
--copy_file std_data/.mylogin.cnf $MYSQL_TEST_LOGIN_FILE
--cat_file $MYSQL_TEST_LOGIN_FILE

--echo # The 'invalid' login file should not cause
--echo # any problem.
--echo #
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -uroot ping 2> /dev/null

--echo ###############################
--echo # Dropping the test login file
--echo ###############################
--remove_file $MYSQL_TEST_LOGIN_FILE
--echo
--echo #################################
--echo # Testing with login file removed
--echo #################################
--echo # Even if login file does not exist, the
--echo # tools should be able to continue
--echo # normally.
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -uroot ping 2>&1

--echo
--echo ######################
--echo # WL#2284 Testing client tools with 32 user name
--echo ######################
--echo #
--echo # Inserting login paths default & test-login-path_user_26
--exec $MYSQL_CONFIG_EDITOR --verbose set --user=user_name_len_25_01234567 --host=localhost 2>&1
--exec $MYSQL_CONFIG_EDITOR --verbose set --login-path=test-login-path_user_26 --user=user_name_len_26_012345678 --host=127.0.0.1 2>&1
--echo # done..
--echo
--echo # Creating users for login
CREATE USER user_name_len_25_01234567@localhost;
CREATE USER user_name_len_26_012345678@localhost;

--echo # Connecting using 'user_name_len_25_01234567'
--echo #
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--echo
--echo # Connecting using 'user_name_len_26_012345678'
--echo #
--exec $MYSQLADMIN --no-defaults --login-path=test-login-path_user_26 --port=$MASTER_MYPORT ping 2>&1
--exec $MYSQLADMIN --no-defaults --login-path=test-login-path_user_26 --port=$MASTER_MYPORT ping 2>&1

# Cleanup
--echo
--echo # Dropping users 'user_name_len_25_01234567@localhost' & 'CREATE USER user_name_len_26_012345678@localhost'
DROP USER user_name_len_25_01234567@localhost,user_name_len_26_012345678@localhost;
--echo
--echo ###############################
--echo # Resetting the test login file
--echo ###############################
--exec $MYSQL_CONFIG_EDITOR reset
--echo # done..


--echo #### End of test ####


--echo #
--echo # Bug #24557925: MYSQL_CONFIG_EDITOR CAN MAKE SERVER UNBOOTABLE
--echo #


--exec $MYSQL_CONFIG_EDITOR set --login-path=mysqld --host=test_user5

--echo # Restarting the server. Should work
--source include/restart_mysqld.inc

--echo # Cleanup
--exec $MYSQL_CONFIG_EDITOR remove --login-path=mysqld
--remove_file $MYSQL_TEST_LOGIN_FILE

--echo #
--echo # Bug#29861961: MYSQL_CONFIG_EDITOR CAN NOT DEAL PASSWORD WITH "#"
--echo #

CREATE USER 'test#user1'@'localhost';
--exec $MYSQL_CONFIG_EDITOR set --login-path=test --user=test#user1 --host=127.0.0.1 2>&1

--exec $MYSQLADMIN --no-defaults --login-path=test --port=$MASTER_MYPORT ping 2>&1

--echo # Cleanup
DROP USER 'test#user1'@'localhost';
--exec $MYSQL_CONFIG_EDITOR remove --login-path=test
--remove_file $MYSQL_TEST_LOGIN_FILE

--echo # End of 5.6 tests

--echo #
--echo # Bug #19953349: MYSQL_CONFIG_EDITOR DOES NOT ESCAPE STRINGS
--echo #

CREATE USER 'test1 test1'@'localhost';

--exec $MYSQL_CONFIG_EDITOR set --login-path=test11 --user="test1 test1" --host=127.0.0.1 2>&1
--echo test: must contain space
--exec $MYSQL_CONFIG_EDITOR print --login-path=test11

--echo # test: must not fail with a space in the name
--exec $MYSQLADMIN --no-defaults --login-path=test11 --port=$MASTER_MYPORT ping 2>&1

--echo # cleanup
DROP USER 'test1 test1'@'localhost';
--remove_file $MYSQL_TEST_LOGIN_FILE

--echo # End of 8.0 tests