Blame tests/p_mysql/10_mysqld_conn_test.sh

Karanbir Singh 0b5bb2
#!/bin/sh
Karanbir Singh 0b5bb2
Karanbir Singh 64acec
t_Log "Running $0 - mysqld client can talk to mysql server."
Christoph Galuschka 9877d6
HostName=$(hostname -s)
Christoph Galuschka 9877d6
MySqlHostName=$(mysql -N -B -u root -e "show variables like 'hostname'" | cut -f 2 | cut -d . -f 1)
Christoph Galuschka a7ebfc
# printing both variables for debugging purposes
Christoph Galuschka a7ebfc
echo $HostName
Christoph Galuschka a7ebfc
echo ${MySqlHostName}
Karanbir Singh 64acec
if [ $HostName = ${MySqlHostName} ]; then
Karanbir Singh 64acec
	ret_val=0
Karanbir Singh 64acec
else
Karanbir Singh 64acec
	ret_val=1
Karanbir Singh 64acec
fi
Karanbir Singh 64acec
t_CheckExitStatus $ret_val
Karanbir Singh 2dd0be
Karanbir Singh 64acec
t_Log "Running $0 - mysqld listening test."
Karanbir Singh 64acec
grep 'skip-networking' /etc/my.cnf > /dev/null
Karanbir Singh 690eb1
if [ $? -eq 1 ]; then
Karanbir Singh 64acec
	# FIXME: Test is very basic
Karanbir Singh 64acec
	nc -d -w 1 localhost 3306 >/dev/null 2>&1
Karanbir Singh 64acec
	t_CheckExitStatus $?
Karanbir Singh 64acec
else
Karanbir Singh 64acec
	t_Log "Skipped, looks like networking is disabled for mysql"
Karanbir Singh 64acec
fi