From 1dd136f568702cc8605988814daa58e1e32a55d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Tue, 2 Sep 2008 15:56:26 +0000 Subject: [PATCH] *** empty log message *** --- org.glite.testsuites.ctb/LB/lb-common.sh | 2 +- .../LB/lb-test-server-local.sh | 163 +++++++++++++++++++++ 2 files changed, 164 insertions(+), 1 deletion(-) create mode 100755 org.glite.testsuites.ctb/LB/lb-test-server-local.sh diff --git a/org.glite.testsuites.ctb/LB/lb-common.sh b/org.glite.testsuites.ctb/LB/lb-common.sh index 33d3150..553d3b3 100755 --- a/org.glite.testsuites.ctb/LB/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/lb-common.sh @@ -95,7 +95,7 @@ function check_binaries() { # TODO: test only the binaries that are needed - it can differ in each test local ret=$TEST_OK - for file in $LBLOGEVENT $LBJOBLOG $LBJOBREG $LBUSERJOBS $LBJOBSTATUS $LBCHANGEACL $TEST_SOCKET $SYS_LSOF $SYS_GREP $SYS_SED + for file in $LBLOGEVENT $LBJOBLOG $LBJOBREG $LBUSERJOBS $LBJOBSTATUS $LBCHANGEACL $TEST_SOCKET $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS do check_exec $file if [ $? -gt 0 ]; then diff --git a/org.glite.testsuites.ctb/LB/lb-test-server-local.sh b/org.glite.testsuites.ctb/LB/lb-test-server-local.sh new file mode 100755 index 0000000..7fb4226 --- /dev/null +++ b/org.glite.testsuites.ctb/LB/lb-test-server-local.sh @@ -0,0 +1,163 @@ +#!/bin/bash + +# show help and usage +progname=`basename $0` +showHelp() +{ +cat << EndHelpHeader +Script for testing the LB server locally + +Prerequisities: + - LB server running on local machine + - environment variables set: + + GLITE_LB_SERVER_PORT - if nondefault port (9000) is used + +Tests called: + + pidof - return instance PIDs of the given binary + mysqladmin ping - check for response by the mysql server + check_socket() - simple tcp echo to all LB server ports + (by default 9000 for logging, 9001 for querying, 9003 for web services) + +Returned values: + Exit TEST_OK: Test Passed + Exit TEST_ERROR: Test Failed + Exit 2: Wrong Input + +EndHelpHeader + + echo "Usage: $progname [OPTIONS]" + echo "Options:" + echo " -h | --help Show this help message." + echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." + echo " -t | --text Format output as plain ASCII text." + echo " -c | --color Format output as text with ANSI colours (autodetected by default)." + echo " -x | --html Format output as html." +} + +# read common definitions and functions +COMMON=lb-common.sh +if [ ! -r ${COMMON} ]; then + printf "Common definitions '${COMMON}' missing!" + exit 2 +fi +source ${COMMON} + +logfile=$$.tmp +flag=0 +while test -n "$1" +do + case "$1" in + "-h" | "--help") showHelp && exit 2 ;; + "-o" | "--output") shift ; logfile=$1 flag=1 ;; + "-t" | "--text") setOutputASCII ;; + "-c" | "--color") setOutputColor ;; + "-x" | "--html") setOutputHTML ;; + esac + shift +done + +# redirecting all output to $logfile +touch $logfile +if [ ! -w $logfile ]; then + echo "Cannot write to output file $logfile" + exit $TEST_ERROR +fi + +DEBUG=2 + +## +# Starting the test +##################### + +{ +test_start + +# check_binaries +printf "Testing if all binaries are available" +check_binaries +if [ $? -gt 0 ]; then + test_failed +else + test_done +fi + +# mySQL running: +printf "Testing if mySQL is running" +if [ "$(pidof mysqld)" ]; then + test_done +else + test_failed + print_error "mySQL server is not running" +fi + +# mySQL accessible: +printf "Testing if mySQL is accessible" +if [ "$(mysqladmin ping)" ]; then + test_done +else + test_failed + print_error "mySQL server is not answering" +fi + +# glite-lb-bkserverd running: +printf "Testing if LB Server is running" +if [ "$(pidof glite-lb-bkserverd)" ]; then + test_done +else + test_failed + print_error "glite-lb-bkserverd server is not running" +fi + +# glite-lb-bkserverd listening: +printf "Testing if LB Server is listening on port ${GLITE_LB_SERVER_PORT}" +check_listener ${LB_SERVER} ${GLITE_LB_SERVER_PORT} +if [ $? -gt 0 ]; then + test_failed + print_error "LB server is not listening on port ${GLITE_LB_SERVER_PORT}" +else + test_done +fi + +# glite-lb-bkserverd listening: +printf "Testing if LB Server is listening on port ${GLITE_LB_SERVER_QPORT}" +check_listener ${LB_SERVER} ${GLITE_LB_SERVER_QPORT} +if [ $? -gt 0 ]; then + test_failed + print_error "LB server is not listening on port ${GLITE_LB_SERVER_QPORT}" +else + test_done +fi + +# glite-lb-bkserverd listening: +printf "Testing if LB Server is listening on port ${GLITE_LB_SERVER_WPORT}" +check_listener ${LB_SERVER} ${GLITE_LB_SERVER_WPORT} +if [ $? -gt 0 ]; then + test_failed + print_error "LB server is not listening on port ${GLITE_LB_SERVER_WPORT}" +else + test_done +fi + + +# glite-lb-interlogd running: +printf "Testing if Interlogger is running" +if [ "$(pidof glite-lb-interlogd)" ]; then + test_done +else + test_failed + print_error "glite-lb-interlogd server is not running" +fi + + + +test_end +} &> $logfile + +if [ $flag -ne 1 ]; then + cat $logfile + rm $logfile +fi +exit $TEST_OK + -- 1.8.2.3