Blame tests/p_mysql/60_mysqld55_conn_test.sh

Christoph Galuschka 72f89d
#!/bin/sh
Christoph Galuschka 72f89d
Christoph Galuschka 72f89d
t_Log "Running $0 - mysqld client can talk to mysql server."
Christoph Galuschka 110e92
Christoph Galuschka 110e92
if [ $centos_ver -gt 6 ]
Christoph Galuschka 110e92
then
Christoph Galuschka 110e92
  t_Log 'mysql is only supported on C5 and C6, skipping'
Christoph Galuschka 110e92
  t_CheckExitStatus 0       
Christoph Galuschka 110e92
  exit 0
Christoph Galuschka 110e92
fi
Christoph Galuschka 110e92
Christoph Galuschka 72f89d
HostName=$(hostname -s)
Christoph Galuschka 72f89d
MySqlHostName=$(mysql -N -B -u root -e "show variables like 'hostname'" | cut -f 2 | cut -d . -f 1)
Christoph Galuschka 72f89d
# printing both variables for debugging purposes
Christoph Galuschka 72f89d
echo $HostName
Christoph Galuschka 72f89d
echo ${MySqlHostName}
Christoph Galuschka 72f89d
if [ $HostName = ${MySqlHostName} ]; then
Christoph Galuschka 72f89d
	ret_val=0
Christoph Galuschka 72f89d
else
Christoph Galuschka 72f89d
	ret_val=1
Christoph Galuschka 72f89d
fi
Christoph Galuschka 72f89d
t_CheckExitStatus $ret_val
Christoph Galuschka 72f89d
Christoph Galuschka 72f89d
t_Log "Running $0 - mysqld listening test."
Christoph Galuschka 72f89d
grep 'skip-networking' /etc/my.cnf > /dev/null
Christoph Galuschka 72f89d
if [ $? -eq 1 ]; then
Christoph Galuschka 72f89d
	# FIXME: Test is very basic
Christoph Galuschka 72f89d
	nc -d -w 1 localhost 3306 >/dev/null 2>&1
Christoph Galuschka 72f89d
	t_CheckExitStatus $?
Christoph Galuschka 72f89d
else
Christoph Galuschka 72f89d
	t_Log "Skipped, looks like networking is disabled for mysql"
Christoph Galuschka 72f89d
fi