File: mysqladmin.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (128 lines) | stat: -rw-r--r-- 4,274 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
# Embedded server doesn't support external clients
--source include/not_embedded.inc
#
# Test "mysqladmin ping"
#

--exec $MYSQLADMIN --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1


#
# Bug#10608 mysqladmin breaks on "database" variable in my.cnf
#

--replace_regex /.*mariadb-admin.*: unknown/mariadb-admin: unknown/
--error 7
--exec $MYSQLADMIN --database=db1 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1

# When mysqladmin finds "loose-database" it shall print
# a warning and continue
--replace_regex /Warning: .*mariadb-admin.*: unknown/Warning: mariadb-admin: unknown/
--exec $MYSQLADMIN --loose-database=db2 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1

--echo #
--echo # Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
--echo #

--echo # Executing mysqladmin with --sleep=1 and --count=2.
--exec $MYSQLADMIN -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --sleep=1 --count=2 ping > $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
--echo # Done.
--echo # Displaying the output :
--cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp

--remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp

--echo #
--echo # BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file
--echo #                with no .cnf or .ini extension.
--echo #

--echo # Creating an empty file 'cnf_file'
--write_file $MYSQLTEST_VARDIR/tmp/cnf_file
EOF

--echo # Using --defaults-extra-file option with 'cnf_file'.
--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1

--remove_file $MYSQLTEST_VARDIR/tmp/cnf_file

#
# MDEV-7883 Segmentation failure when running mysqladmin -u root -p
#
--error 1
--exec $MYSQLADMIN -u root -p 2>&1 > /dev/null

--echo #
--echo # MDEV-33992 mariadb-admin flush-status command should do
--echo # FLUSH GLOBAL STATUS
--echo #

flush session status;
flush global status;
--connect (con1,localhost,root,)
--connect (con2,localhost,root,)
--connect (con3,localhost,root,)
--disconnect con1
--disconnect con2
--disconnect con3

--connection default
show status like 'Max_used_connections';
show global status like 'Max_used_connections';

--echo #
--echo # Running mariadb-admin flush-status
--echo #
--exec $MYSQLADMIN flush-status

show status like 'Max_used_connections';
show global status like 'Max_used_connections';

#
# MDEV-19168 Reload SSL certificate
# This test reloads server SSL certs ./mysqladmin flush-ssl, and checks that new SSL
# connection use new certificate.
# Status variable Ssl_server_not_after is used to tell the old certificate from new.
#

source include/have_ssl_communication.inc;

# Restart server with cert. files located in temp directory
# We are going to remove / replace them within the test,
# so we can't use the ones in std_data directly.

let $ssl_cert=$MYSQLTEST_VARDIR/tmp/ssl_cert.pem;
let $ssl_key=$MYSQLTEST_VARDIR/tmp/ssl_key.pem;

copy_file $MYSQL_TEST_DIR/std_data/server-key.pem $ssl_key;
copy_file $MYSQL_TEST_DIR/std_data/server-cert.pem $ssl_cert;

let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert;
--source include/restart_mysqld.inc

connect  ssl_con,localhost,root,,,,,SSL;
--disable_cursor_protocol
SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
--enable_cursor_protocol
let $ssl_not_after=`SELECT @ssl_not_after`;

remove_file $ssl_cert;
remove_file $ssl_key;

--echo # Use a different certificate ("Not after" certificate field changed)
copy_file $MYSQL_TEST_DIR/std_data/server-new-key.pem $ssl_key;
copy_file $MYSQL_TEST_DIR/std_data/server-new-cert.pem $ssl_cert;

--exec $MYSQLADMIN --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= flush-ssl 2>&1

--echo # Check new certificate used by new connection
exec $MYSQL --ssl  -e  "SELECT IF(VARIABLE_VALUE <> '$ssl_not_after', 'OK', 'FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'";

--echo # Cleanup
remove_file $ssl_cert;
remove_file $ssl_key;
# restart with usual SSL
let $restart_parameters=;
--source include/restart_mysqld.inc

--echo # End of 11.5