From a76c03ff5661dae768aedc1dc91e825b5d170c58 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Nov 09 2013 18:44:55 +0000 Subject: lamp test now uses both mysql and mysql55 in C5-tests --- diff --git a/tests/r_lamp/0_lamp_install.sh b/tests/r_lamp/0_lamp_install.sh index f6c056c..a8555cf 100755 --- a/tests/r_lamp/0_lamp_install.sh +++ b/tests/r_lamp/0_lamp_install.sh @@ -8,7 +8,7 @@ t_Log "Running $0 - attempting to install LAMP stack." # starting with 5.10, we have to differ between mysql55 and mysql if [ $centos_ver = 5 ] then - t_InstallPackage mysql55-mysql-server httpd php + t_InstallPackage mysql-server mysql55-mysql-server httpd php else t_InstallPackage mysql-server httpd php fi diff --git a/tests/r_lamp/1_lamp_check.sh b/tests/r_lamp/1_lamp_check.sh index 905a7d4..25f1041 100755 --- a/tests/r_lamp/1_lamp_check.sh +++ b/tests/r_lamp/1_lamp_check.sh @@ -7,14 +7,7 @@ # Last Updated: Saturday, 09 November 2013 2:23 # Description: A simple Bash script to start LAMP daemons (httpd, mysqld), and confirm PHP is working. -# starting with 5.10, we have to differ between mysql55 and mysql -if [ $centos_ver = 5 ] -then - readonly DAEMONS=( httpd mysql55-mysqld ) -else - readonly DAEMONS=( httpd mysqld ) -fi -readonly DAEMONSPID=( httpd mysqld ) +readonly DAEMONS=( httpd mysqld ) readonly SERVICE=/sbin/service readonly PHP_BIN=/usr/bin/php @@ -40,9 +33,6 @@ do exit $FAIL fi -done -for D in "${DAEMONSPID[@]}" -do # See if our process exists PIDS=$(pidof $D) @@ -56,7 +46,6 @@ do echo "OK" done - # Finally, a basic check to see if PHP is working correctly. t_Log "Performing php script check..." diff --git a/tests/r_lamp/40_basic_lamp.sh b/tests/r_lamp/40_basic_lamp.sh index ef967db..4253a7b 100755 --- a/tests/r_lamp/40_basic_lamp.sh +++ b/tests/r_lamp/40_basic_lamp.sh @@ -11,11 +11,11 @@ t_Log "Running $0 - install a minimal lamp stack, and test it" if [ $centos_ver = 5 ] then t_InstallPackage mysql55-mysql-server httpd mysql55-mysql php php-mysql wget - t_ServiceControl mysql55-mysqld restart + t_ServiceControl mysql55-mysqld stop else t_InstallPackage httpd mysql mysql-server php php-mysql wget - t_ServiceControl mysqld restart fi +t_ServiceControl mysqld restart t_ServiceControl httpd restart # Initializing a small MySQL db diff --git a/tests/r_lamp/45_basic_lamp_mysql55.sh b/tests/r_lamp/45_basic_lamp_mysql55.sh new file mode 100755 index 0000000..04c48e3 --- /dev/null +++ b/tests/r_lamp/45_basic_lamp_mysql55.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# Author: Karanbir Singh +# Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - install a minimal lamp stack, and test it" + +# MySQL +# starting with 5.10, we have to differ between mysql55 and mysql +if [ $centos_ver = 5 ] +then + t_ServiceControl mysqld stop + t_ServiceControl mysql55-mysqld start +fi +t_ServiceControl httpd restart + +# Initializing a small MySQL db +cat >/tmp/mysql-QA.sql </var/www/html/mysql.php < +EOF + +#################################################### +# testing +#################################################### + +curl -s http://localhost/mysql.php + +t_Log "Performing basic LAMP test" +content=`echo "select * from qatests.tests where name='mysqltest'"|mysql -B --skip-column-names` + +# Clean up +mysql -u root -e 'drop database qatests;' +service httpd stop + +if [ "$content" = "mysqltest" ] ; then + ret_val=0; +else + ret_val=1; +fi + +t_CheckExitStatus $ret_val diff --git a/tests/r_lamp/50_lamp_check_mysql55.sh b/tests/r_lamp/50_lamp_check_mysql55.sh new file mode 100755 index 0000000..905a7d4 --- /dev/null +++ b/tests/r_lamp/50_lamp_check_mysql55.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# Author: Steve Barnes (steve@echo.id.au) +# Christoph Galuschka +# Filename: 1_lamp_check.sh +# Version: 0.2 +# Last Updated: Saturday, 09 November 2013 2:23 +# Description: A simple Bash script to start LAMP daemons (httpd, mysqld), and confirm PHP is working. + +# starting with 5.10, we have to differ between mysql55 and mysql +if [ $centos_ver = 5 ] +then + readonly DAEMONS=( httpd mysql55-mysqld ) +else + readonly DAEMONS=( httpd mysqld ) +fi +readonly DAEMONSPID=( httpd mysqld ) + +readonly SERVICE=/sbin/service +readonly PHP_BIN=/usr/bin/php +readonly PHP_CHECK=/tmp/check.php + +# Make sure we cleanup after ourselves. +trap "/bin/rm -f $PHP_CHECK" EXIT + +t_Log "Running $0 - starting LAMP daemon startup test" + +# Iterate through our daemons, start each and check for the presence of each process +for D in "${DAEMONS[@]}" +do + t_Log "Attempting startup of '$D'" + + $SERVICE $D start &>/dev/null + + RETVAL=$? + + if [ $RETVAL -ne 0 ]; then + + t_Log "FAIL: service startup for '$D' failed ($RETVAL)" + exit $FAIL + + fi +done +for D in "${DAEMONSPID[@]}" +do + + # See if our process exists + PIDS=$(pidof $D) + + if [ -z "$PIDS" ]; then + + t_Log "FAIL: couldn't find '$D' in the process list." + exit $FAIL + fi + + echo "OK" +done + + +# Finally, a basic check to see if PHP is working correctly. + +t_Log "Performing php script check..." + +cat < $PHP_CHECK + +EOL + +RETVAL=$PHP_BIN $PHP_CHECK &>/dev/null + +if [ $RETVAL -ne 0 ]; then + + t_Log "FAIL: php_info() check failed ($RETVAL)" + +fi + +t_CheckExitStatus $RETVAL