New local test for local logger + minor improvements in server test.
authorZdeněk Šustr <sustr4@cesnet.cz>
Mon, 8 Sep 2008 09:02:02 +0000 (09:02 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Mon, 8 Sep 2008 09:02:02 +0000 (09:02 +0000)
org.glite.testsuites.ctb/LB/lb-common.sh
org.glite.testsuites.ctb/LB/lb-test-logger-local.sh [new file with mode: 0755]
org.glite.testsuites.ctb/LB/lb-test-server-local.sh

index bfc69ad..906c056 100755 (executable)
@@ -171,3 +171,5 @@ function check_socket_listener()
                return $TEST_OK
        fi
 }
+
+#df /var/lib/mysql/ | tail -n 1 | awk '{ print $4 }'
diff --git a/org.glite.testsuites.ctb/LB/lb-test-logger-local.sh b/org.glite.testsuites.ctb/LB/lb-test-logger-local.sh
new file mode 100755 (executable)
index 0000000..034742c
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/bash
+
+# show help and usage
+progname=`basename $0`
+showHelp()
+{
+cat << EndHelpHeader
+Script for testing the LB logger locally
+
+Prerequisities:
+   - LB logger running on local machine
+   - environment variables set:
+
+     GLITE_LB_LOGGER_PORT - if nondefault port (9002) 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
+      (9002 by default)
+
+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
+
+# logger running:
+printf "Testing if LB logger is running"
+if [ "$(pidof ${LB_LOGD})" ]; then
+       test_done
+else
+       test_failed
+       print_error "${LB_LOGD} is not running"
+fi
+
+# logger listening:
+printf "Testing if LB logger is listening on port ${GLITE_LB_LOGGER_PORT}"
+check_listener ${LB_LOGD} ${GLITE_LB_LOGGER_PORT}
+if [ $? -gt 0 ]; then
+        test_failed
+        print_error "LB logger is not listening on port ${GLITE_LB_LOGGER_PORT}"
+else
+        test_done
+fi
+
+# interlogger running:
+printf "Testing if Interlogger is running"
+if [ "$(pidof ${LB_INTERLOGD})" ]; then
+       test_done
+else
+       test_failed
+       print_error "${LB_INTERLOGD} server is not running"
+fi
+
+
+# Interlogger listening on socket:
+printf "Testing if interlogger is listening on socket ${GLITE_LB_IL_SOCK}" 
+check_socket_listener ${LB_INTERLOGD} ${GLITE_LB_IL_SOCK}
+if [ $? -gt 0 ]; then
+        test_failed
+        print_error "LB interlogger is not listening on socket ${GLITE_LB_IL_SOCK}"
+else
+        test_done
+fi
+
+
+
+test_end
+} &> $logfile
+
+if [ $flag -ne 1 ]; then
+       cat $logfile
+       rm $logfile
+fi
+exit $TEST_OK
+
index 75603af..d09a1eb 100755 (executable)
@@ -101,16 +101,16 @@ else
        print_error "mySQL server is not answering"
 fi
 
-# glite-lb-bkserverd running:
+# server running:
 printf "Testing if LB Server is running"
-if [ "$(pidof glite-lb-bkserverd)" ]; then
+if [ "$(pidof ${LB_SERVER})" ]; then
        test_done
 else
        test_failed
-       print_error "glite-lb-bkserverd server is not running"
+       print_error "${LB_SERVER} server is not running"
 fi
 
-# glite-lb-bkserverd listening:
+# Server 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
@@ -120,7 +120,7 @@ else
         test_done
 fi
 
-# glite-lb-bkserverd listening:
+# Server 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
@@ -130,7 +130,7 @@ else
         test_done
 fi
 
-# glite-lb-bkserverd listening:
+# Server 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
@@ -141,16 +141,13 @@ else
 fi
 
 
-# glite-lb-interlogd running:
-printf "Testing if Interlogger is running"
-
-# glite-lb-interlogd running:
+# Interlogger running:
 printf "Testing if Interlogger is running"
 if [ "$(pidof ${LB_INTERLOGD})" ]; then
        test_done
 else
        test_failed
-       print_error "glite-lb-interlogd server is not running"
+       print_error "${LB_INTERLOGD} server is not running"
 fi