MDEV-14978 fix client.client-env-variable test

* fix paths to work when installed and not only from the source dir
* don't use a cnf file (no need to restart the server for this)
* set MYSQL_HOST to a valid hostname when testing an invalid MARIADB_HOST
* use invalid ip to have clients fail quickly and not waste time
  on resolving the invalid hostname

followup for eedbb901e5
This commit is contained in:
Sergei Golubchik 2024-10-18 13:58:37 +02:00
parent a812dba6dc
commit 15a291e4e0
3 changed files with 16 additions and 21 deletions

View file

@ -1,5 +0,0 @@
!include include/default_my.cnf
[ENV]
MARIADB_HOST=localhost
MYSQL_HOST=some_server

View file

@ -2,6 +2,6 @@ USE test;
CREATE TABLE pet (name VARCHAR(20));
localhost
****************
nonexistent-server
255.255.255.255
Done
DROP TABLE pet;

View file

@ -4,14 +4,13 @@
# The environment variables for client programs have default options file
# They interfere with the MTR test so I am creating new variables for them
--let MARIADB = $MYSQL_BINDIR/client//mariadb
--let MARIADBADMIN = $MYSQL_BINDIR/client//mariadb-admin
--let MARIADBBINLOG = $MYSQL_BINDIR/client//mariadb-binlog
--let MARIADBCHECK = $MYSQL_BINDIR/client//mariadb-check
--let MARIADBDUMP = $MYSQL_BINDIR/client//mariadb-dump
--let MARIADBIMPORT = $MYSQL_BINDIR/client//mariadb-import
--let MARIADBSHOW = $MYSQL_BINDIR/client//mariadb-show
--let MARIADBSLAP = $MYSQL_BINDIR/client//mariadb-slap
--let MARIADBADMIN = $EXE_MYSQL-admin
--let MARIADBBINLOG = $EXE_MYSQL-binlog
--let MARIADBCHECK = $EXE_MYSQL-check
--let MARIADBDUMP = $EXE_MYSQL-dump
--let MARIADBIMPORT = $EXE_MYSQL-import
--let MARIADBSHOW = $EXE_MYSQL-show
--let MARIADBSLAP = $EXE_MYSQL-slap
# Creating a table for the client programs
USE test;
@ -26,12 +25,12 @@ EOF
# Options for client program
--let $options = --user=root --port=$MASTER_MYPORT --disable-ssl-verify-server-cert
# Check to see if environment variable is defined
# MARIADB_HOST is defined in client-env-variable.cnf
# Positive test for client program with MARIADB_HOST
--let MARIADB_HOST=localhost
--let MYSQL_HOST=nonexistent-server
--echo $MARIADB_HOST
# Positive test for client program with MARIADB_HOST
--exec $MARIADB $options -e "SHOW DATABASES;" > /dev/null 2>&1
--exec $EXE_MYSQL $options -e "SHOW DATABASES;" > /dev/null 2>&1
--exec $MARIADBADMIN $options processlist > /dev/null 2>&1
--exec $MARIADBBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1
--exec $MARIADBCHECK $options -c --databases test > /dev/null 2>&1
@ -42,7 +41,8 @@ EOF
#Set up negative test with invalid server
--echo ****************
--let MARIADB_HOST=nonexistent-server
--let MARIADB_HOST=255.255.255.255
--let MYSQL_HOST=localhost
--echo $MARIADB_HOST
# Now run the same command as in the postive test case
@ -50,7 +50,7 @@ EOF
# Some client program fails with error 1 and some fails wtih error 2
--error 1
--exec $MARIADB $options -e "SHOW DATABASES;" > /dev/null 2>&1
--exec $EXE_MYSQL $options -e "SHOW DATABASES;" > /dev/null 2>&1
--error 1
--exec $MARIADBADMIN $options processlist > /dev/null 2>&1
@ -71,7 +71,7 @@ EOF
--exec $MARIADBSLAP $options > /dev/null 2>&1
# Run the same command but with '--host' to verify command line input overrides env variable
--exec $MARIADB $options --host localhost -e "SHOW DATABASES;" > /dev/null 2>&1
--exec $EXE_MYSQL $options --host localhost -e "SHOW DATABASES;" > /dev/null 2>&1
--exec $MARIADBADMIN $options --host localhost processlist > /dev/null 2>&1
--exec $MARIADBBINLOG $options --host localhost --read-from-remote-server master-bin.000001 > /dev/null 2>&1
--exec $MARIADBCHECK $options --host localhost -c --databases test > /dev/null 2>&1