updated l1 test, should be functional now
authorJan Pospíšil <honik@ntc.zcu.cz>
Wed, 30 Jul 2008 13:04:03 +0000 (13:04 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Wed, 30 Jul 2008 13:04:03 +0000 (13:04 +0000)
org.glite.testsuites.ctb/LB/Readme.txt
org.glite.testsuites.ctb/LB/lb-common.sh
org.glite.testsuites.ctb/LB/lb-l1.sh
org.glite.testsuites.ctb/LB/testSocket.c

index 424e322..2a232a1 100644 (file)
@@ -32,9 +32,8 @@ Options:
 Examples
 ********
 
-$ ./lb-l1.sh -o log scientific.civ.zcu.cz
-
-Jul 29 21:57:24 scientific lb-l1.sh:                                 start 
+$ ./lb-l1.sh sci.civ.zcu.cz
+Jul 30 15:01:21 scientific lb-l1.sh:                                 start 
 Testing ping to LB server sci.civ.zcu.cz                             done
 Testing LB binaries:
   checking binary glite-lb-logevent                                  done
@@ -43,6 +42,8 @@ Testing LB binaries:
   checking binary glite-lb-user_jobs                                 done
   checking binary glite-lb-job_status                                done
   checking binary glite-lb-change_acl                                done
-Testing LB services                                                  skipped
-Jul 29 21:57:26 scientific lb-l1.sh:                                 end 
+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 
 
index 12ccce5..ac081ef 100755 (executable)
@@ -34,6 +34,12 @@ LB_LOGD=glite-lb-logd
 LB_INTERLOGD=glite-lb-interlogd
 LB_SERVER=glite-lb-bkserverd
 
+GLITE_LB_SERVER_PORT=${GLITE_LB_SERVER_PORT:-9000}
+let GLITE_LB_SERVER_QPORT=${GLITE_LB_SERVER_PORT}+1
+if [ -z "${GLITE_LB_SERVER_WPORT}" ]; then 
+       let GLITE_LB_SERVER_WPORT=${GLITE_LB_SERVER_PORT}+3
+fi
+
 TEST_SOCKET=$SAME_SENSOR_HOME/tests/testSocket
 
 DEBUG=2
@@ -96,9 +102,27 @@ function check_binaries()
        fi
 }
 
+# check socket
+function check_socket()
+{
+       if [ $# -lt 2 ]; then
+               print_newline
+               print_error "No host:port to check"
+               return $TEST_ERROR
+       fi
+       $TEST_SOCKET $1 $2
+       if [ $? -eq 0 ];  then 
+               return $TEST_OK
+       else
+               return $TEST_ERROR
+       fi
+}
+
 # check the services
-check_services()
+function check_services()
 {
+       # if run on the same machine, we can check for example
+       # netstat -an --inet | grep "^tcp .* 0.0.0.0:9000 .*LISTEN"
        echo "${newline:-}Listening to locallogger port (9002)" >> $logfile
        $TEST_SOCKET $LB_HOST 9002 >> $logfile
        if [ $? -eq 0 ]; then
index 5d78935..798a2a5 100755 (executable)
@@ -86,9 +86,32 @@ printf "Testing LB binaries:${lf}"
 check_binaries
 
 # check_services
-printf "Testing LB services"
-#check_services
-test_skipped
+printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_PORT} (logging)"
+check_socket ${LB_HOST} ${GLITE_LB_SERVER_PORT}
+if [ $? -gt 0 ]; then
+       test_failed
+       print_error "LB server at ${LB_HOST}:${GLITE_LB_SERVER_PORT} might be unreachable"
+else
+       test_done
+fi
+#
+printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_QPORT} (queries)"
+check_socket ${LB_HOST} ${GLITE_LB_SERVER_QPORT}
+if [ $? -gt 0 ]; then
+       test_failed
+       print_error "LB server at ${LB_HOST}:${GLITE_LB_SERVER_QPORT} might be unreachable"
+else
+       test_done
+fi
+#
+printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_WPORT} (web services)"
+check_socket ${LB_HOST} ${GLITE_LB_SERVER_WPORT}
+if [ $? -gt 0 ]; then
+       test_failed
+       print_error "LB server at ${LB_HOST}:${GLITE_LB_SERVER_WPORT} might be unreachable"
+else
+       test_done
+fi
 
 test_end
 } &> $logfile
index 434b88c..ae8b558 100755 (executable)
@@ -1,4 +1,4 @@
-#ident "$Header$
+#ident "$Header$"
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
   echoserver.sin_family = AF_INET;     /* Internet/IP */
   echoserver.sin_addr.s_addr = inet_addr (adrIPp);     /* IP address */
   echoserver.sin_port = htons (atoi (argv[2]));        /* server port */
-  printf ("Connecting to: %s:%s\n", adrIPp, argv[2]);
+//  printf ("Connecting to: %s:%s\n", adrIPp, argv[2]);
 /* Establish connection */
   if (connect (sock,
               (struct sockaddr *) &echoserver, sizeof (echoserver)) < 0)
@@ -62,7 +62,7 @@ main (int argc, char *argv[])
   else
     {
       shutdown (sock, 2);
-      printf (" [OK]\n");
+//      printf (" [OK]\n");
       exit (0);
     }
 }