From ac4e006011811eef64fdea5b1d40aa2741ec50b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Posp=C3=AD=C5=A1il?= Date: Wed, 13 Aug 2008 14:07:49 +0000 Subject: [PATCH] added remote LB service ping tests: - lb-test-logger-remote.sh and lb-test-server-remote.sh - they succeed the old lb-l1.sh test --- org.glite.testsuites.ctb/LB/Readme.txt | 73 +++++++------ org.glite.testsuites.ctb/LB/lb-common.sh | 19 ++-- .../LB/lb-test-logger-remote.sh | 120 +++++++++++++++++++++ .../LB/{lb-l1.sh => lb-test-server-remote.sh} | 71 +++++++----- 4 files changed, 208 insertions(+), 75 deletions(-) create mode 100755 org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh rename org.glite.testsuites.ctb/LB/{lb-l1.sh => lb-test-server-remote.sh} (74%) diff --git a/org.glite.testsuites.ctb/LB/Readme.txt b/org.glite.testsuites.ctb/LB/Readme.txt index a6a54bb..ecc0213 100644 --- a/org.glite.testsuites.ctb/LB/Readme.txt +++ b/org.glite.testsuites.ctb/LB/Readme.txt @@ -1,51 +1,54 @@ $Header$ -Readme file for lb1 v1.0 -lb-l1.sh -******** +Readme file for basic LB Integration tests -Script for level 1 testing of LB server +Service ping tests: +=================== -* Prerequisities: - - LB server running (user does not have to get any credentials) - - the following environment variables set: +Prerequisities for all tests: +----------------------------- +- the following environment variables set: - GLITE_LOCATION - PATH to gLite software - SAME_SENSOR_HOME - PATH to sensors (might be set to "." for testSocket sensor) - GLITE_LB_SERVER_PORT - if nondefault port (9000) used + GLITE_LOCATION - PATH to gLite software + SAME_SENSOR_HOME - PATH to sensors (might be set to "." for testSocket sensor) -* Basic test: - ping_host() - basic network ping - check_binaries() - check for binary executables, calls check_exec() - check_socket() - TCPecho to host:port for all three LB server ports - (by default 9000 for logging, 9001 for querying, 9003 for web services) +- one may also need to run: -Usage: lb-l1.sh [OPTIONS] host -Options: - -h | --help Show this help message. - -o | --output 'file' Redirect all output to the 'file' (stdout by default). - -t | --text Format output as plain ASCII text. - -c | --color Format output as text with ANSI colours (autodetected by default). - -x | --html Format output as html. +$ make +$ ln -s . tests -* The name of the LB server host has to be specified everytime + +lb-test-logger-remote.sh +------------------------ +Script for remote testing of LB logger + +Run ./lb-test-logger-remote.sh -h for test description and usage. +Example: + +$ ./lb-test-logger-remote.sh sci.civ.zcu.cz +Aug 13 15:57:02 scientific lb-test-logger-remote.sh: start +Testing if all binaries are available done +Testing ping to LB logger sci.civ.zcu.cz done +Testing LB logger at sci.civ.zcu.cz:9002 (logging) done +Aug 13 15:57:04 scientific lb-test-logger-remote.sh: end + + + +lb-test-server-remote.sh +------------------------ +Script for remote testing of LB server + +Run ./lb-test-server-remote.sh -h for test description and usage. -Examples -******** +Example: -$ ./lb-l1.sh sci.civ.zcu.cz -Jul 30 15:01:21 scientific lb-l1.sh: start +$ ./lb-test-server-remote.sh sci.civ.zcu.cz +Aug 13 15:58:22 scientific lb-test-server-remote.sh: start +Testing if all binaries are available done Testing ping to LB server sci.civ.zcu.cz done -Testing LB binaries: - checking binary glite-lb-logevent done - checking binary glite-lb-job_log done - checking binary glite-lb-job_reg done - checking binary glite-lb-user_jobs done - checking binary glite-lb-job_status done - checking binary glite-lb-change_acl done Testing LB server at sci.civ.zcu.cz:9000 (logging) done Testing LB server at sci.civ.zcu.cz:9001 (queries) done Testing LB server at sci.civ.zcu.cz:9003 (web services) done -Jul 30 15:01:21 scientific lb-l1.sh: end +Aug 13 15:58:26 scientific lb-test-server-remote.sh: end diff --git a/org.glite.testsuites.ctb/LB/lb-common.sh b/org.glite.testsuites.ctb/LB/lb-common.sh index a94b49a..509c7ef 100755 --- a/org.glite.testsuites.ctb/LB/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/lb-common.sh @@ -40,6 +40,8 @@ if [ -z "${GLITE_LB_SERVER_WPORT}" ]; then let GLITE_LB_SERVER_WPORT=${GLITE_LB_SERVER_PORT}+3 fi +GLITE_LB_LOGGER_PORT=${GLITE_LB_LOGGER_PORT:-9002} + TEST_SOCKET=$SAME_SENSOR_HOME/tests/testSocket DEBUG=2 @@ -82,24 +84,17 @@ function check_exec() function check_binaries() { +# TODO: test only the binaries that are needed - it can differ in each test local err=0 - for file in $LBLOGEVENT $LBJOBLOG $LBJOBREG $LBUSERJOBS $LBJOBSTATUS $LBCHANGEACL + for file in $LBLOGEVENT $LBJOBLOG $LBJOBREG $LBUSERJOBS $LBJOBSTATUS $LBCHANGEACL $TEST_SOCKET do - printf " checking binary %s" "$file" check_exec $file - if [ $? -eq 0 ]; then - test_done - else - test_failed + if [ $? -gt 0 ]; then print_error "file $file not found" - err=1 + return $TEST_ERROR fi done - if [ $err -eq 0 ]; then - return $TEST_OK - else - return $TEST_ERROR - fi + return $TEST_OK } # check socket diff --git a/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh b/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh new file mode 100755 index 0000000..33942ed --- /dev/null +++ b/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# $Header$ + +# show help and usage +progname=`basename $0` +showHelp() +{ +cat << EndHelpHeader +Script for testing remotely the LB logger + +Prerequisities: + - LB logger running on remote machine + - environment variables set: + + GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used + +Tests called: + check_binaries() - check if all necessary binaries are locally available + ping_host() - network ping to LB server host + check_socket() - simple tcp echo to the LB logger port + +Returned values: + Exit TEST_OK: Test Passed + Exit TEST_ERROR: Test Failed + Exit 2: Wrong Input + +EndHelpHeader + + echo "Usage: $progname [OPTIONS] host" + 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." + echo "" + echo "where host is the LB logger host, it must be specified everytime." +} +if [ -z "$1" ]; then + showHelp + exit 2 +fi + +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 ;; + *) LB_HOST=$1 ;; + 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 + +# read common definitions and functions +COMMON=lb-common.sh +if [ ! -r ${COMMON} ]; then + printf "Common definitions '${COMMON}' missing!" + exit 2 +fi +source ${COMMON} + +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 + +# ping_host: +printf "Testing ping to LB logger ${LB_HOST}" +ping_host ${LB_HOST} +if [ $? -gt 0 ]; then + test_failed + print_error "Destination host might be unreachable" +else + test_done +fi + +# check_services +printf "Testing LB logger at ${LB_HOST}:${GLITE_LB_LOGGER_PORT} (logging)" +check_socket ${LB_HOST} ${GLITE_LB_LOGGER_PORT} +if [ $? -gt 0 ]; then + test_failed + print_error "LB logger at ${LB_HOST}:${GLITE_LB_LOGGER_PORT} might be unreachable" +else + test_done +fi + +test_end +} &> $logfile + +if [ $flag -ne 1 ]; then + cat $logfile + rm $logfile +fi +exit $TEST_OK + diff --git a/org.glite.testsuites.ctb/LB/lb-l1.sh b/org.glite.testsuites.ctb/LB/lb-test-server-remote.sh similarity index 74% rename from org.glite.testsuites.ctb/LB/lb-l1.sh rename to org.glite.testsuites.ctb/LB/lb-test-server-remote.sh index 798a2a5..7c1b6b2 100755 --- a/org.glite.testsuites.ctb/LB/lb-l1.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-server-remote.sh @@ -1,34 +1,32 @@ #!/bin/bash # $Header$ -# ------------------------------------------------------------------------------ -# Script for testing the LB services -# -# Basic test: -# PING -# check LB binaries -# check running services with sockets -# -# Returned values: -# Exit TEST_OK: Test Passed -# Exit TEST_ERROR: Test Failed -# Exit 2: Wrong Input -# -# ------------------------------------------------------------------------------ - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -DEBUG=2 # show help and usage progname=`basename $0` showHelp() { +cat << EndHelpHeader +Script for testing remotely the LB server + +Prerequisities: + - LB server running on remote machine + - environment variables set: + + GLITE_LB_SERVER_PORT - if nondefault port (9000) is used + +Tests called: + check_binaries() - check if all necessary binaries are locally available + ping_host() - network ping to LB server host + 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] host" echo "Options:" echo " -h | --help Show this help message." @@ -37,11 +35,13 @@ showHelp() echo " -c | --color Format output as text with ANSI colours (autodetected by default)." echo " -x | --html Format output as html." echo "" + echo "where host is the LB server host, it must be specified everytime." } if [ -z "$1" ]; then showHelp exit 2 fi + logfile=$$.tmp flag=0 while test -n "$1" @@ -64,6 +64,16 @@ if [ ! -w $logfile ]; then exit $TEST_ERROR fi +# read common definitions and functions +COMMON=lb-common.sh +if [ ! -r ${COMMON} ]; then + printf "Common definitions '${COMMON}' missing!" + exit 2 +fi +source ${COMMON} + +DEBUG=2 + ## # Starting the test ##################### @@ -71,6 +81,15 @@ fi { test_start +# check_binaries +printf "Testing if all binaries are available" +check_binaries +if [ $? -gt 0 ]; then + test_failed +else + test_done +fi + # ping_host: printf "Testing ping to LB server ${LB_HOST}" ping_host ${LB_HOST} @@ -81,10 +100,6 @@ else test_done fi -# check_binaries -printf "Testing LB binaries:${lf}" -check_binaries - # check_services printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_PORT} (logging)" check_socket ${LB_HOST} ${GLITE_LB_SERVER_PORT} -- 1.8.2.3