New common test for server version
authorZdeněk Šustr <sustr4@cesnet.cz>
Wed, 4 May 2011 09:41:01 +0000 (09:41 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Wed, 4 May 2011 09:41:01 +0000 (09:41 +0000)
org.glite.testsuites.ctb/LB/tests/lb-common.sh
org.glite.testsuites.ctb/LB/tests/lb-test-changeacl.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh

index a8a862d..a45a74e 100755 (executable)
@@ -279,3 +279,32 @@ function check_credentials()
        fi
        return 0
 }
+
+function check_srv_version()
+{
+        check_binaries $LBWSGETVERSION
+        if [ $? -gt 0 ]; then
+               return 2
+        else
+               servername=`echo ${GLITE_WMS_QUERY_SERVER} | ${SYS_SED} "s/:.*//"`
+                wsglservver=`$LBWSGETVERSION -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_SED 's/^.*Server version:\s*//'`
+                if [ "$wsglservver" == "" ]; then
+                               return 2
+                else
+       
+                       SRVVER=`$SYS_ECHO $wsglservver | $SYS_GREP -o -E "^[0-9]+\.[0-9]+"`
+                       CHKVER=`$SYS_ECHO $2 | $SYS_GREP -o -E "^[0-9]*\.[0-9*]"`
+
+                       printf "Srv. version $SRVVER $1 $CHKVER? "
+                       cresult=`$SYS_EXPR $SRVVER $1 $CHKVER`
+                       if [ "$cresult" -eq "1" ]; then
+                               printf "yes "
+                               return 0
+                       else
+                               printf "no "
+                               return 1
+                       fi
+               fi
+       fi
+       return 0
+}
index 3bd415e..9f4bcdf 100755 (executable)
@@ -101,7 +101,6 @@ change_acl()
 #####################
 
 identity="ThisIsJustATestingIdentity"
-test_tag_acl=${TEST_TAG_ACL:-"no"}
 
 {
 test_start
@@ -134,6 +133,15 @@ while [ "$CONT" = "yes" ]; do
        fi
        test_done
 
+        check_srv_version '>=' "2.2"
+        if [ $? -gt 0 ]; then
+               test_tag_acl="no"
+               test_done
+        else
+               test_tag_acl="yes"
+               test_done
+        fi
+
        printf "Testing Tags permissions... "
        if [ "$test_tag_acl" != "yes" ]; then
                printf "Capability not detected..."
@@ -150,6 +158,7 @@ while [ "$CONT" = "yes" ]; do
                print_error "Failed to register job"
                break
        fi
+       printf " $jobid"
        test_done
 
        printf "Changing ACL..."
@@ -168,7 +177,6 @@ while [ "$CONT" = "yes" ]; do
        fi
        test_done
 
-
        printf "Checking ACL for new values... "
        ops="read"
        [ "$test_tag_acl" = "yes" ] && ops="$ops write"
index 7ec2508..7ea4727 100755 (executable)
@@ -77,11 +77,11 @@ do
 done
 
 # redirecting all output to $logfile
-touch $logfile
-if [ ! -w $logfile ]; then
-       echo "Cannot write to output file $logfile"
-       exit $TEST_ERROR
-fi
+#touch $logfile
+#if [ ! -w $logfile ]; then
+#      echo "Cannot write to output file $logfile"
+#      exit $TEST_ERROR
+#fi
 
 DEBUG=2
 RETURN=2
@@ -122,6 +122,15 @@ while true; do
 
        RETURN=1
 
+       check_srv_version '>=' "2.2"
+       if [ $? -gt 0 ]; then
+               printf "Capability not detected. This test will be"
+               test_skipped
+               break
+       else
+               test_done
+       fi
+
        # Register job:
        printf "Registering job "
        jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'`