Debian Codegraph @

mysql-test/suite/client/client-env-variable.test

raw
1 -- source include/have_log_bin.inc
2
3 # Set up environment varibles for client programs
4 # The environment variables for client programs have default options file
5 # They interfere with the MTR test so I am creating new variables for them
6
7 --let MARIADBADMIN = $EXE_MYSQL-admin
8 --let MARIADBBINLOG = $EXE_MYSQL-binlog
9 --let MARIADBCHECK = $EXE_MYSQL-check
10 --let MARIADBDUMP = $EXE_MYSQL-dump
11 --let MARIADBIMPORT = $EXE_MYSQL-import
12 --let MARIADBSHOW = $EXE_MYSQL-show
13 --let MARIADBSLAP = $EXE_MYSQL-slap
14
15 # Creating a table for the client programs
16 USE test;
17 CREATE TABLE pet (name VARCHAR(20));
18
19 # Creating a data file for mysqlimport
20 write_file $MYSQL_TMP_DIR/pet;
21 buster
22 bob
23 EOF
24
25 # Options for client program
26 --let $options = --user=root --port=$MASTER_MYPORT --disable-ssl-verify-server-cert
27
28 # Positive test for client program with MARIADB_HOST
29 --let MARIADB_HOST=localhost
30 --let MYSQL_HOST=nonexistent-server
31 --echo $MARIADB_HOST
32
33 --exec $EXE_MYSQL $options -e "SHOW DATABASES;" > /dev/null 2>&1
34 --exec $MARIADBADMIN $options processlist > /dev/null 2>&1
35 --exec $MARIADBBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1
36 --exec $MARIADBCHECK $options -c --databases test > /dev/null 2>&1
37 --exec $MARIADBDUMP $options test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1
38 --exec $MARIADBIMPORT $options test --local $MYSQL_TMP_DIR/pet > /dev/null 2>&1
39 --exec $MARIADBSHOW $options test > /dev/null 2>&1
40 --exec $MARIADBSLAP $options > /dev/null 2>&1
41
42 #Set up negative test with invalid server
43 --echo ****************
44 --let MARIADB_HOST=255.255.255.255
45 --let MYSQL_HOST=localhost
46 --echo $MARIADB_HOST
47
48 # Now run the same command as in the postive test case
49 # Client programs are expected to fail since the server does not exist
50 # Some client program fails with error 1 and some fails wtih error 2
51
52 --error 1
53 --exec $EXE_MYSQL $options -e "SHOW DATABASES;" > /dev/null 2>&1
54
55 --error 1
56 --exec $MARIADBADMIN $options processlist > /dev/null 2>&1
57
58 --error 1
59 --exec $MARIADBBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1
60
61 --error 2
62 --exec $MARIADBCHECK $options -c --databases test > /dev/null 2>&1
63
64 --error 2
65 --exec $MARIADBDUMP $options test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1
66
67 --error 1
68 --exec $MARIADBIMPORT $options test $MYSQL_TMP_DIR/pet > /dev/null 2>&1
69
70 --error 1
71 --exec $MARIADBSLAP $options > /dev/null 2>&1
72
73 # Run the same command but with '--host' to verify command line input overrides env variable
74 --exec $EXE_MYSQL $options --host localhost -e "SHOW DATABASES;" > /dev/null 2>&1
75 --exec $MARIADBADMIN $options --host localhost processlist > /dev/null 2>&1
76 --exec $MARIADBBINLOG $options --host localhost --read-from-remote-server master-bin.000001 > /dev/null 2>&1
77 --exec $MARIADBCHECK $options --host localhost -c --databases test > /dev/null 2>&1
78 --exec $MARIADBDUMP $options --host localhost test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1
79 --exec $MARIADBIMPORT $options --host localhost test --local $MYSQL_TMP_DIR/pet > /dev/null 2>&1
80 --exec $MARIADBSHOW $options --host localhost test > /dev/null 2>&1
81 --exec $MARIADBSLAP $options --host localhost > /dev/null 2>&1
82
83 # Clean up
84 --echo Done
85 DROP TABLE pet;
86 --remove_file $MYSQL_TMP_DIR/tmp.sql
87 --remove_file $MYSQL_TMP_DIR/pet