if proxy certificate is not valid, fake ones are generated
authorMarcel Poul <marcel.poul@cern.ch>
Wed, 14 Sep 2011 19:45:21 +0000 (19:45 +0000)
committerMarcel Poul <marcel.poul@cern.ch>
Wed, 14 Sep 2011 19:45:21 +0000 (19:45 +0000)
19 files changed:
org.glite.testsuites.ctb/LB/tests/lb-common.sh
org.glite.testsuites.ctb/LB/tests/lb-test-acl-authz.sh
org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh
org.glite.testsuites.ctb/LB/tests/lb-test-event-delivery.sh
org.glite.testsuites.ctb/LB/tests/lb-test-harvester.sh
org.glite.testsuites.ctb/LB/tests/lb-test-https.sh
org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh
org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh
org.glite.testsuites.ctb/LB/tests/lb-test-job-states.sh
org.glite.testsuites.ctb/LB/tests/lb-test-logevent.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-msg.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh
org.glite.testsuites.ctb/LB/tests/lb-test-proxy-delivery.sh
org.glite.testsuites.ctb/LB/tests/lb-test-sandbox-transfer.sh
org.glite.testsuites.ctb/LB/tests/lb-test-statistics.sh
org.glite.testsuites.ctb/LB/tests/lb-test-threaded.sh
org.glite.testsuites.ctb/LB/tests/lb-test-ws.sh

index 09ee9d0..776429b 100755 (executable)
@@ -128,6 +128,22 @@ SYS_STAT=stat
 # not used at the moment
 DEBUG=2
 
+function check_credentials_and_generate_proxy()
+{      
+       check_credentials
+       if [ $? != 0 ]; then
+               test_failed
+               ./lb-generate-fake-proxy.sh
+               if [ $? != 0 ]; then
+                       print_error "Proxy not created - process failed"
+                       return 2
+               fi
+       else
+               test_done
+       fi
+       return 0
+}
+
 # ping host
 function ping_host()
 {
@@ -170,7 +186,7 @@ function check_binaries()
        do      
                check_exec $file 
                if [ $? -gt 0 ]; then
-                       update_error "file $file not found"
+                       print_error "command $file not found"
                        ret=$TEST_ERROR
                fi
        done
@@ -270,7 +286,7 @@ function check_credentials()
                my_GRIDPROXYINFO="${GRIDPROXYINFO} -f $1"
        fi
 
-       timeleft=`${my_GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
+       timeleft=`${my_GRIDPROXYINFO} 2>/dev/null | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
        if [ "$timeleft" = "" ]; then
                print_error "No credentials"
                return 1
index ad41727..3150ae5 100755 (executable)
@@ -128,12 +128,14 @@ while [ "$CONT" = "yes" ]; do
        fi
        test_done
 
-       printf "Testing credentials"
-       check_credentials
-       if [ $? -ne 0 ]; then
-               test_failed
-               break
+       printf "Testing credentials"    
+       check_credentials_and_generate_proxy
+       if [ $? != 0 ]; then
+               test_end
+               exit 2
        fi
+
+       printf "Testing snd proxy certificate"
        if [ "$X509_USER_PROXY_BOB" = "" ]; then
                test_failed
                print_error "\$X509_USER_PROXY_BOB must be set"
index 6cd8648..517198b 100755 (executable)
@@ -97,128 +97,118 @@ if [ $? -gt 0 ]; then
        test_failed
 else
        test_done
+fi
+
+printf "Testing optional WS client binary"
+check_binaries $LBWSGETVERSION
+if [ $? -gt 0 ]; then
+       printf " ... not present. Some tests will be skipped\n"
+       WSBIN="no"
+else
+       test_done
 
-       printf "Testing optional WS client binary"
-       check_binaries $LBWSGETVERSION
+       printf "Testing credentials"
+       check_credentials
        if [ $? -gt 0 ]; then
-               printf " ... not present. Some tests will be skipped\n"
                WSBIN="no"
        else
-               test_done
-
-               printf "Testing credentials"
-
-               timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
+               WSBIN="yes"
+       fi
 
-               if [ "$timeleft" = "" ]; then
-                       printf "No credentials, not critical\n"
-                       WSBIN="no"
-               else
-                       if [ "$timeleft" = "0:00:00" ]; then
-                               printf "Credentials expired, not critical\n"
-                               WSBIN="no"
-                       else
-                               test_done
-                               WSBIN="yes"
-                       fi
+fi
 
-               fi
+# Register job:
 
-       fi
+server=`${SYS_ECHO} ${GLITE_WMS_QUERY_SERVER} | ${SYS_SED} 's/:.*$//'`
 
-       # Register job:
+printf "Checking if BDII operational... "
+$SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=infosys' > ldap.$$.out
+if [ $? -gt 0 ]; then  
+       test_failed
+       print_error "No reply"
+else
+       test_done
+fi
 
-       server=`${SYS_ECHO} ${GLITE_WMS_QUERY_SERVER} | ${SYS_SED} 's/:.*$//'`
+printf "Checking Glue 1 root entry... "
+$SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=grid' 'GlueServiceType=org.glite.lb.Server' > ldap.$$.out
+if [ $? -gt 0 ]; then  
+       test_failed
+       print_error "No reply"
+else
+       test_done
+fi
 
-       printf "Checking if BDII operational... "
-       $SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=infosys' > ldap.$$.out
-       if [ $? -gt 0 ]; then   
-               test_failed
-               print_error "No reply"
-       else
+printf "Checking ServiceStatus... "
+health=`$SYS_GREP GlueServiceStatus: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'`
+if [ "$health" == "" ]; then
+       print_error "GlueServiceStatus not specified"
+       test_failed
+else
+       printf "$health"
+       if [ "$health" == "OK" ]; then
                test_done
-       fi
-
-       printf "Checking Glue 1 root entry... "
-       $SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=grid' 'GlueServiceType=org.glite.lb.Server' > ldap.$$.out
-       if [ $? -gt 0 ]; then   
-               test_failed
-               print_error "No reply"
        else
-               test_done
-       fi
-
-       printf "Checking ServiceStatus... "
-       health=`$SYS_GREP GlueServiceStatus: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'`
-       if [ "$health" == "" ]; then
-               print_error "GlueServiceStatus not specified"
                test_failed
-       else
-               printf "$health"
-               if [ "$health" == "OK" ]; then
-                       test_done
-               else
-                       test_failed
-               fi
        fi
+fi
 
-       printf "Checking Glue 2.0 entry with 'o=glue'... "
-       $SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=glue' 'GLUE2EndpointInterfaceName=org.glite.lb.Server' > ldap.$$.out
-       if [ $? -gt 0 ]; then   
-               test_failed
-               print_error "No reply"
-       else
-               test_done
-       fi
+printf "Checking Glue 2.0 entry with 'o=glue'... "
+$SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=glue' 'GLUE2EndpointInterfaceName=org.glite.lb.Server' > ldap.$$.out
+if [ $? -gt 0 ]; then  
+       test_failed
+       print_error "No reply"
+else
+       test_done
+fi
 
-       printf "Checking GLUE2 HealthStatus... "
-       health=`$SYS_GREP GLUE2EndpointHealthState: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'`
-       if [ "$health" == "" ]; then
-               print_error "GLUE2EndpointHealthState not specified"
-               test_failed
+printf "Checking GLUE2 HealthStatus... "
+health=`$SYS_GREP GLUE2EndpointHealthState: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'`
+if [ "$health" == "" ]; then
+       print_error "GLUE2EndpointHealthState not specified"
+       test_failed
+else
+       printf "$health"
+       if [ "$health" == "ok" ]; then
+               test_done
        else
-               printf "$health"
-               if [ "$health" == "ok" ]; then
-                       test_done
-               else
-                       test_failed
-               fi
+               test_failed
        fi
+fi
 
-       printf "Checking GlueServiceVersion... "
-       glservver=`$SYS_GREP GLUE2EndpointImplementationVersion ldap.$$.out | $SYS_SED 's/^.*GLUE2EndpointImplementationVersion:\s*//'`
-       if [ "$glservver" == "" ]; then 
-               print_error "GLUE2EndpointImplementationVersion not specified"
-               test_failed
-       else
-               printf "$glservver"
-               test_done
+printf "Checking GlueServiceVersion... "
+glservver=`$SYS_GREP GLUE2EndpointImplementationVersion ldap.$$.out | $SYS_SED 's/^.*GLUE2EndpointImplementationVersion:\s*//'`
+if [ "$glservver" == "" ]; then        
+       print_error "GLUE2EndpointImplementationVersion not specified"
+       test_failed
+else
+       printf "$glservver"
+       test_done
 
-               printf "Reading version through WS... "
-               if [ "$WSBIN" == "yes" ]; then
-                       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       
-                               test_failed
-                       else
-                               printf "$wsglservver"
-                               test_done
+       printf "Reading version through WS... "
+       if [ "$WSBIN" == "yes" ]; then
+               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       
+                       test_failed
+               else
+                       printf "$wsglservver"
+                       test_done
 
-                               printf "Comparing versions: '$glservver' == '$wsglservver'"
-                               if [ "$glservver" == "$wsglservver" ]; then
-                                       test_done
-                               else
-                                       test_failed
-                               fi
+                       printf "Comparing versions: '$glservver' == '$wsglservver'"
+                       if [ "$glservver" == "$wsglservver" ]; then
+                               test_done
+                       else
+                               test_failed
                        fi
-               else
-                       test_skipped
                fi
+       else
+               test_skipped
        fi
+fi
 
-       rm ldap.$$.out
+rm ldap.$$.out
 
-fi             
                
 
 test_end
index 3bc6a2e..cf3cd0e 100755 (executable)
@@ -91,245 +91,247 @@ DEBUG=2
 {
 test_start
 
-# check_binaries
-printf "Testing if all binaries are available"
-check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LB_READY_SH $LB_RUNNING_SH $LB_DONE_SH $SYS_AWK $LBJOBLOG
-if [ $? -gt 0 ]; then
-       test_failed
-else
-       test_done
-fi
-
-printf "Testing credentials"
+CONT="yes"
+while [ "$CONT" = "yes" ]; do
+       CONT="no"
+
+       # check_binaries
+       printf "Testing if all binaries are available"
+       check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LB_READY_SH $LB_RUNNING_SH $LB_DONE_SH $SYS_AWK $LBJOBLOG
+       if [ $? -gt 0 ]; then
+               test_failed
+       else
+               test_done
+       fi
 
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
+       printf "Testing credentials"
+       check_credentials_and_generate_proxy
+       if [ $? != 0 ]; then
+               test_end
+               break
+       fi
 
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials"
-else
-       if [ "$timeleft" = "0:00:00" ]; then
+       # Register job:
+       printf "Registering testing job "
+       jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application`
+       if [ $? != 0 ]; then
                test_failed
-               print_error "Credentials expired"
+               print_error "Failed to register job"
+               break
+       else
+               test_done
+       fi
+       jobid=`echo "${jobid}" | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
+       if [ -z $jobid  ]; then
+               print_error "Failed to parse job "
+               test_end
+               exit 4
        else
+               printf "($jobid)"
+       fi
+       
+       # log events:
+       printf "Logging events resulting in READY state... "
+       $LB_READY_SH -j ${jobid} > /dev/null 2> /dev/null
+
+       printf "Sleeping for 10 seconds...\n"
+
+       sleep 10
+
+       jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
+       printf "Is the testing job ($jobid) in a correct state? $jobstate"
+
+       if [ "${jobstate}" = "Ready" ]; then
+               test_done
+       else
+               test_failed
+               print_error "Job is not in appropriate state"
+       fi
+
+#      printf "Logging events resulting in RUNNING state\n"
+#      $LB_RUNNING_SH -j ${jobid} > /dev/null 2> /dev/null
+
+       printf "Logging events resulting in DONE state... "
+       $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null
+
+       printf "Sleeping for 10 seconds...\n"
+
+       sleep 10
+
+       jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
+       printf "Testing job ($jobid) is in state: $jobstate"
+
+       if [ "${jobstate}" = "Done" ]; then
                test_done
+       else
+               test_failed
+               print_error "Job is not in appropriate state"
+       fi
 
+       #Purge test job
+       joblist=$$_jobs_to_purge.txt
+       echo $jobid > ${joblist}
 
-               # Register job:
-               printf "Registering testing job... "
-               jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
+        printf "Registering collection "
+        ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -C -n 2 -S > $$_test_coll_registration.txt
+       jobid=`$SYS_CAT $$_test_coll_registration.txt | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
+       if [ -z $jobid  ]; then
+               test_failed
+               print_error "Failed to register job"
+       else
+               test_done
+               subjobs=( $(cat $$_test_coll_registration.txt | $SYS_GREP EDG_WL_SUB_JOBID | $SYS_SED 's/EDG_WL_SUB_JOBID.*="//' | $SYS_SED 's/"$//') )
+               printf "Collection ID: $jobid\n     Subjob 1: ${subjobs[0]}\n     Subjob 2: ${subjobs[1]}\nChecking if subjob registration worked... "
+       
+               ${LBJOBLOG} ${subjobs[0]} | $SYS_GREP 'DG.EVNT="RegJob"' >> /dev/null
+               if [ $? = 0 ]; then
+                       printf "Registration event recorded"
+                       test_done
+               else
+                       test_failed
+                       print_error "Subjob registration did not work (Registration event not recorded)"
+               fi
+       
 
-               if [ -z $jobid  ]; then
+               job1jdl=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} -E "^jdl :" | ${SYS_AWK} '{print $3}'`
+               if [ "${job1jdl}" = "(null)" ]; then
                        test_failed
-                       print_error "Failed to register job"
+                       print_error "Subjob registration did not work (JDL not present: "${job1jdl}")"
                else
-                       printf "Registered job: $jobid"
+                       printf "JDL present"
                        test_done
                fi
 
-               # log events:
-               printf "Logging events resulting in READY state... "
-               $LB_READY_SH -j ${jobid} > /dev/null 2> /dev/null
-
-               printf "Sleeping for 10 seconds...\n"
+               printf "Logging events for subjobs... "
+               $LB_READY_SH -j ${subjobs[0]} > /dev/null 2> /dev/null
+               $LB_DONE_SH -j ${subjobs[1]} > /dev/null 2> /dev/null
 
+               printf "Sleeping for 10 seconds (waiting for events to deliver)...\n"
                sleep 10
 
-               jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
-               printf "Is the testing job ($jobid) in a correct state? $jobstate"
+               jobstate=`${LBJOBSTATUS} ${subjobs[0]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
+               printf "Is the testing job (${subjobs[0]}) in a correct state? $jobstate"
 
                if [ "${jobstate}" = "Ready" ]; then
                        test_done
                else
                        test_failed
-                       print_error "Job is not in appropriate state"
+                       print_error "State ${jobstate}: Job is not in appropriate state (Ready)"
                fi
+               jobstate=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
+               printf "Is the testing job (${subjobs[1]}) in a correct state? $jobstate"
 
-#              printf "Logging events resulting in RUNNING state\n"
-#              $LB_RUNNING_SH -j ${jobid} > /dev/null 2> /dev/null
+               if [ "${jobstate}" = "Done" ]; then
+                       test_done
+               else
+                       test_failed
+                       print_error "State ${jobstate}: Job is not in appropriate state (Done)"
+               fi
+
+
+               jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
+               printf "Is the collection ($jobid) in a correct state? $jobstate"
 
-               printf "Logging events resulting in DONE state... "
-               $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null
+               if [ "${jobstate}" = "Waiting" ]; then
+                       test_done
+               else
+                       test_failed
+                       print_error "State ${jobstate}: Job is not in appropriate state (Waiting)"
+               fi
 
-               printf "Sleeping for 10 seconds...\n"
+               printf "Logging events to clear subjobs... "
+               $LB_CLEARED_SH -j ${subjobs[0]} > /dev/null 2> /dev/null
+               $LB_CLEARED_SH -j ${subjobs[1]} > /dev/null 2> /dev/null
 
+               printf "Sleeping for 10 seconds (waiting for events to deliver)...\n"
                sleep 10
 
-               jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
-               printf "Testing job ($jobid) is in state: $jobstate"
+               jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
+               printf "Is the collection ($jobid) in a correct state? $jobstate"
 
-               if [ "${jobstate}" = "Done" ]; then
+               if [ "${jobstate}" = "Cleared" ]; then
                        test_done
                else
                        test_failed
-                       print_error "Job is not in appropriate state"
+                       print_error "State ${jobstate}: Job is not in appropriate state (Cleared)"
                fi
 
-               #Purge test job
-               joblist=$$_jobs_to_purge.txt
-               echo $jobid > ${joblist}
-
-                printf "Registering collection "
-                ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -C -n 2 -S > $$_test_coll_registration.txt
-                jobid=`$SYS_CAT $$_test_coll_registration.txt | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
-                if [ -z $jobid  ]; then
-                        test_failed
-                        print_error "Failed to register job"
-                else
-                        test_done
-                        subjobs=( $(cat $$_test_coll_registration.txt | $SYS_GREP EDG_WL_SUB_JOBID | $SYS_SED 's/EDG_WL_SUB_JOBID.*="//' | $SYS_SED 's/"$//') )
-                        printf "Collection ID: $jobid\n     Subjob 1: ${subjobs[0]}\n     Subjob 2: ${subjobs[1]}\nChecking if subjob registration worked... "
-
-                       ${LBJOBLOG} ${subjobs[0]} | $SYS_GREP 'DG.EVNT="RegJob"' >> /dev/null
-                        if [ $? = 0 ]; then
-                               printf "Registration event recorded"
-                                test_done
-                        else
-                                test_failed
-                                print_error "Subjob registration did not work (Registration event not recorded)"
-                        fi
-
-
-                        job1jdl=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} -E "^jdl :" | ${SYS_AWK} '{print $3}'`
-                        if [ "${job1jdl}" = "(null)" ]; then
-                                test_failed
-                                print_error "Subjob registration did not work (JDL not present: "${job1jdl}")"
-                        else
-                                printf "JDL present"
-                                test_done
-                        fi
-
-                        printf "Logging events for subjobs... "
-                        $LB_READY_SH -j ${subjobs[0]} > /dev/null 2> /dev/null
-                        $LB_DONE_SH -j ${subjobs[1]} > /dev/null 2> /dev/null
-
-                        printf "Sleeping for 10 seconds (waiting for events to deliver)...\n"
-                        sleep 10
-
-                        jobstate=`${LBJOBSTATUS} ${subjobs[0]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
-                        printf "Is the testing job (${subjobs[0]}) in a correct state? $jobstate"
-
-                        if [ "${jobstate}" = "Ready" ]; then
-                                test_done
-                        else
-                                test_failed
-                                print_error "State ${jobstate}: Job is not in appropriate state (Ready)"
-                        fi
-                        jobstate=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'`
-                        printf "Is the testing job (${subjobs[1]}) in a correct state? $jobstate"
-
-                        if [ "${jobstate}" = "Done" ]; then
-                                test_done
-                        else
-                                test_failed
-                                print_error "State ${jobstate}: Job is not in appropriate state (Done)"
-                        fi
-
-
-                        jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
-                        printf "Is the collection ($jobid) in a correct state? $jobstate"
-
-                        if [ "${jobstate}" = "Waiting" ]; then
-                                test_done
-                        else
-                                test_failed
-                                print_error "State ${jobstate}: Job is not in appropriate state (Waiting)"
-                        fi
-
-                        printf "Logging events to clear subjobs... "
-                        $LB_CLEARED_SH -j ${subjobs[0]} > /dev/null 2> /dev/null
-                        $LB_CLEARED_SH -j ${subjobs[1]} > /dev/null 2> /dev/null
-
-                        printf "Sleeping for 10 seconds (waiting for events to deliver)...\n"
-                        sleep 10
-
-                        jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
-                        printf "Is the collection ($jobid) in a correct state? $jobstate"
-
-                        if [ "${jobstate}" = "Cleared" ]; then
-                                test_done
-                        else
-                                test_failed
-                                print_error "State ${jobstate}: Job is not in appropriate state (Cleared)"
-                        fi
-
-                       echo $jobid > $$_jobs_to_purge_test.txt
-
-                       printf "Purging collection... " 
-
-                       $LBPURGE -j $$_jobs_to_purge_test.txt
-
-                       printf "Sleeping for 10 seconds... " 
-
-                       sleep 10
-
-                       printf "Checking state of collection... " 
-
-                       ${LBJOBSTATUS} $jobid > $$_collstate.tmp 2> $$_collstate_err.tmp
-                        jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
-                       $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
-                        if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
+               echo $jobid > $$_jobs_to_purge_test.txt
+
+               printf "Purging collection... " 
+
+               $LBPURGE -j $$_jobs_to_purge_test.txt
 
+               printf "Sleeping for 10 seconds... " 
+
+               sleep 10
+
+               printf "Checking state of collection... " 
+
+               ${LBJOBSTATUS} $jobid > $$_collstate.tmp 2> $$_collstate_err.tmp
+               jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
+               $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
+               if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
+
+                       if [ "${jobstate}" = "Purged" ]; then
+                               printf "${jobstate}"
+                       else
+                       printf "Identifier removed"
+                       fi
+                       test_done
+
+                       printf "Checking state of subjob #1... "
+                       ${LBJOBSTATUS} ${subjobs[0]} > $$_collstate.tmp 2> $$_collstate_err.tmp
+                       jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
+                       $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
+                       if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
                                if [ "${jobstate}" = "Purged" ]; then
                                        printf "${jobstate}"
                                else
                                        printf "Identifier removed"
                                fi
-                                test_done
-
-                               printf "Checking state of subjob #1... "
-                               ${LBJOBSTATUS} ${subjobs[0]} > $$_collstate.tmp 2> $$_collstate_err.tmp
-                               jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
-                               $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
-                               if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
-                                       if [ "${jobstate}" = "Purged" ]; then
-                                               printf "${jobstate}"
-                                       else
-                                               printf "Identifier removed"
-                                       fi
-                                       test_done
-                               else
-                                       test_failed
-                                       print_error "State ${jobstate}: Job is not in appropriate state (Cleared)"
-                               fi
-
-                               printf "Checking state of subjob #2... "
-                               ${LBJOBSTATUS} ${subjobs[1]} > $$_collstate.tmp 2> $$_collstate_err.tmp
-                               jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
-                               $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
-                               if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
-                                       if [ "${jobstate}" = "Purged" ]; then
-                                               printf "${jobstate}"
-                                       else
-                                               printf "Identifier removed"
-                                       fi
-                                       test_done
-                               else
-                                       test_failed
-                                       print_error "State ${jobstate}: Job is not in appropriate state (Cleared)"
-                               fi
-
-                        else
-                               printf "${jobstate}"
-                                test_skipped
-                        fi
+                               test_done
+                       else
+                               test_failed
+                               print_error "State ${jobstate}: Job is not in appropriate state (Cleared)"
+                       fi
+
+                       printf "Checking state of subjob #2... "
+                       ${LBJOBSTATUS} ${subjobs[1]} > $$_collstate.tmp 2> $$_collstate_err.tmp
+                       jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
+                       $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
+                       if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
+                               if [ "${jobstate}" = "Purged" ]; then
+                                       printf "${jobstate}"
+                               else
+                                       printf "Identifier removed"
+                               fi
+                               test_done
+                       else
+                               test_failed
+                               print_error "State ${jobstate}: Job is not in appropriate state (Cleared)"
+                       fi
 
-                       $SYS_RM $$_jobs_to_purge_test.txt
-                       $SYS_RM $$_collstate.tmp
-                       $SYS_RM $$_collstate_err.tmp
-                       
-                fi
+               else
+                       printf "${jobstate}"
+                       test_skipped
+               fi
 
-                echo ${subjobs[0]} >> ${joblist}
-                echo ${subjobs[1]} >> ${joblist}
-                echo $jobid >> ${joblist}
-                try_purge ${joblist}
+               $SYS_RM $$_jobs_to_purge_test.txt
+               $SYS_RM $$_collstate.tmp
+               $SYS_RM $$_collstate_err.tmp
 
-                $SYS_RM $$_test_coll_registration.txt
+       fi
 
+       echo ${subjobs[0]} >> ${joblist}
+       echo ${subjobs[1]} >> ${joblist}
+       echo $jobid >> ${joblist}
+       try_purge ${joblist}
 
-       fi
-fi
+       $SYS_RM $$_test_coll_registration.txt
+
+
+done
 
 test_end
 #} &> $logfile
index dd52c32..354d311 100755 (executable)
@@ -118,23 +118,10 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials!"
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
        test_end
        exit 2
-else
-       if [ "$timeleft" = "0:00:00" ]; then
-               test_failed
-               print_error "Credentials expired"
-               test_end
-               exit 2
-       else
-               test_done
-       fi
 fi
 
 printf "Testing access to MySQL"
index 9e261c7..85582de 100755 (executable)
@@ -100,31 +100,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
-               # Get path to the proxy cert
-               printf "Getting proxy cert path... "
-
-               PROXYCERT=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^path" | ${SYS_SED} "s/path\s*:\s//"`
-
-               if [ "$PROXYCERT" = "" ]; then
-                       test_failed
-                       print_error "Unable to identify the path to your proxy certificate"
-               else
-                       printf "$PROXYCERT"
-                       test_done
-       
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi     
                        # Register job:
                        printf "Registering testing job "
                        jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'`
@@ -285,11 +265,6 @@ else
                        fi
                        $SYS_RM http.header.dump.$$
 
-               fi
-               
-               
-       fi
-fi
 
 test_end
 }
index bd85c3a..a2bdade 100755 (executable)
@@ -127,19 +127,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials"
-else
-       if [ "$timeleft" = "0:00:00" ]; then
-               test_failed
-               print_error "Credentials expired"
-       else
-               test_done
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
                USERIDENTITY=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^identity" | ${SYS_SED} "s/identity\s*:\s//"`
 
                # Register job:
@@ -209,8 +201,6 @@ else
                        try_purge ${joblist}
 
                fi
-       fi
-fi
 
 test_end
 }
index dd3bee4..dfeb33e 100755 (executable)
@@ -98,18 +98,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
 
                # Register job:
                printf "Registering testing job "
@@ -255,8 +248,6 @@ else
 
                
                
-       fi
-fi
 
 test_end
 }
index 05976b7..1a674f1 100755 (executable)
@@ -126,109 +126,113 @@ DEBUG=2
 {
 test_start
 
-# check_binaries
-printf "Testing if all binaries are available"
-check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LBJOBSTATUS
-if [ $? -gt 0 ]; then
-       test_failed
-else
-       test_done
-fi
-
-printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials"
-else
-       if [ "$timeleft" = "0:00:00" ]; then
+CONT="yes"
+while [ "$CONT" = "yes" ]; do
+       CONT="no"
+       
+       # check_binaries
+       printf "Testing if all binaries are available"
+       check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LBJOBSTATUS
+       if [ $? -gt 0 ]; then
                test_failed
-               print_error "Credentials expired"
+               print_error "Some binaries are missing"
+               break
        else
                test_done
+       fi
+       
+       # check credentials
+       printf "Testing credentials"
+       check_credentials_and_generate_proxy
+       if [ $? != 0 ]; then
+               break
+       fi
+       
+       # Register job:
+       printf "Registering testing job "
+       jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application`
+       if [ $? != 0 ]; then
+               test_failed
+               print_error "Failed to register job"
+               break
+       else
+               test_done
+       fi
+       
+       #parse job id
+       jobid=`echo "${jobid}" | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
+       if [ -z $jobid  ]; then
+               print_error "Failed to parse job "
+               break
+       else
+               printf "($jobid)"
+       fi
+       
+       test_state $jobid Submitted
 
+       EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000"        
 
-               # Register job:
-               printf "Registering testing job "
-               jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
-
-               if [ -z $jobid  ]; then
-                       test_failed
-                       print_error "Failed to register job"
-               else
-                       printf "($jobid)"
-                       test_done
-               fi
-
-               test_state $jobid Submitted
-
-               EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000"        
-
-               printf "logging Accepted"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e Accepted --from="UserInterface" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"`
-               check_return_and_test_state $? $jobid Waiting
-
-               printf "logging EnQueued"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"`
-               check_return_and_test_state $? $jobid Waiting
+       printf "logging Accepted"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e Accepted --from="UserInterface" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"`
+       check_return_and_test_state $? $jobid Waiting
 
-               printf "logging DeQueued"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"`
-               check_return_and_test_state $? $jobid Waiting
+       printf "logging EnQueued"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"`
+       check_return_and_test_state $? $jobid Waiting
 
-               printf "logging HelperCall"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperCall --helper_name="name of the called component" --helper_params="parameters of the call" --src_role=CALLING`
-               check_return_and_test_state $? $jobid Waiting
+       printf "logging DeQueued"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"`
+       check_return_and_test_state $? $jobid Waiting
 
-               printf "logging Match"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e Match --dest_id="${DESTINATION:-destination CE/queue}"`
-               check_return_and_test_state $? $jobid Waiting
+       printf "logging HelperCall"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperCall --helper_name="name of the called component" --helper_params="parameters of the call" --src_role=CALLING`
+       check_return_and_test_state $? $jobid Waiting
 
-               printf "logging HelperReturn"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperReturn --helper_name="name of the called component" --retval="returned data" --src_role=CALLING`
-               check_return_and_test_state $? $jobid Waiting
+       printf "logging Match"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e Match --dest_id="${DESTINATION:-destination CE/queue}"`
+       check_return_and_test_state $? $jobid Waiting
 
-               printf "logging EnQueued"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"`
-               check_return_and_test_state $? $jobid Ready
+       printf "logging HelperReturn"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperReturn --helper_name="name of the called component" --retval="returned data" --src_role=CALLING`
+       check_return_and_test_state $? $jobid Waiting
 
-               printf "logging DeQueued"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"`
-               check_return_and_test_state $? $jobid Ready
+       printf "logging EnQueued"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"`
+       check_return_and_test_state $? $jobid Ready
 
-               printf "logging Transfer"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"`
-               check_return_and_test_state $? $jobid Ready
+       printf "logging DeQueued"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"`
+       check_return_and_test_state $? $jobid Ready
 
-               printf "logging Accepted"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Accepted --from="JobController" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"`
-               check_return_and_test_state $? $jobid Ready
+       printf "logging Transfer"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"`
+       check_return_and_test_state $? $jobid Ready
 
-               printf "logging Transfer"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"`
-               check_return_and_test_state $? $jobid Scheduled
+       printf "logging Accepted"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Accepted --from="JobController" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"`
+       check_return_and_test_state $? $jobid Ready
 
-               printf "logging Running"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Running --node="${CE_NODE:-worker node}"`
-               check_return_and_test_state $? $jobid Running
+       printf "logging Transfer"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"`
+       check_return_and_test_state $? $jobid Scheduled
 
-               printf "logging Done"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Done --status_code=OK --reason="reason for the change" --exit_code=0`
-               check_return_and_test_state $? $jobid Done
+       printf "logging Running"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Running --node="${CE_NODE:-worker node}"`
+       check_return_and_test_state $? $jobid Running
 
-               printf "logging Clear"
-               EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Clear --reason=USER`
-               check_return_and_test_state $? $jobid Cleared
+       printf "logging Done"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Done --status_code=OK --reason="reason for the change" --exit_code=0`
+       check_return_and_test_state $? $jobid Done
 
-               #Purge test job
-               joblist=$$_jobs_to_purge.txt
-               echo $jobid > ${joblist}
-               try_purge ${joblist}
+       printf "logging Clear"
+       EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Clear --reason=USER`
+       check_return_and_test_state $? $jobid Cleared
 
-       fi
-fi
+       #Purge test job
+       joblist=$$_jobs_to_purge.txt
+       echo $jobid > ${joblist}
+       try_purge ${joblist}
+done
 
 test_end
 }
index 5278888..e4090d9 100755 (executable)
@@ -122,19 +122,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials"
-else
-       if [ "$timeleft" = "0:00:00" ]; then
-               test_failed
-               print_error "Credentials expired"
-       else
-               test_done
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
 
                # Register job:
                printf "Registering testing job "
@@ -305,8 +297,6 @@ else
                echo $jobid > ${joblist}
                try_purge ${joblist}
 
-       fi
-fi
 
 test_end
 } &> $logfile
index 1198683..3f787cd 100755 (executable)
@@ -106,20 +106,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
                # Register job:
                printf "Registering testing job "
                jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'`
@@ -208,8 +199,6 @@ else
                        try_purge ${joblist}
 
                fi
-       fi
-fi
 
 test_end
 #} &> $logfile
index fe9ca46..cc4d791 100755 (executable)
@@ -106,20 +106,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
                # Register job:
                printf "Registering testing job "
                jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'`
@@ -186,8 +177,6 @@ else
                        try_purge ${joblist}
 
                fi
-       fi
-fi
 
 test_end
 }
index 82a17be..54ba937 100755 (executable)
@@ -105,21 +105,13 @@ fi
 
 printf "Testing credentials"
 
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
 while true; do
-       if [ "$timeleft" = "" ]; then
-               test_failed
-               print_error "No credentials"
-               break
-       fi
-       if [ "$timeleft" = "0:00:00" ]; then
-               test_failed
-               print_error "Credentials expired"
+       check_credentials_and_generate_proxy
+       if [ $? != 0 ]; then
+               test_end
+               RETURN=2
                break
        fi
-       test_done
-
        RETURN=1
 
        check_srv_version '>=' "2.2"
index 9c65952..f02860e 100755 (executable)
@@ -106,20 +106,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+        test_end
+        exit 2
+fi
                # Register job:
                printf "Registering testing jobs"
                jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'`
@@ -251,8 +242,6 @@ else
                        try_purge ${joblist}
 
                fi
-       fi
-fi
 
 test_end
 }
index 07c4c0c..6445e10 100755 (executable)
@@ -100,20 +100,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials"
-else
-       if [ "$timeleft" = "0:00:00" ]; then
-               test_failed
-               print_error "Credentials expired"
-       else
-               test_done
-
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
                # Register job:
                printf "Registering testing job "
                jobid=`${LBJOBREG} -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'`
@@ -272,8 +263,6 @@ else
 
                $SYS_RM $$_test_coll_registration.txt
 
-       fi
-fi
 
 test_end
 }
index 1391062..8c16ced 100755 (executable)
@@ -99,19 +99,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi             
                # Register job:
                printf "Registering testing job "
 
@@ -761,8 +753,6 @@ else
                #       printf "SB colection capability not detected..."
                #       test_skipped
                #fi
-       fi
-fi
 
 test_end
 
index cfeb831..de6c05f 100755 (executable)
@@ -133,19 +133,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-       test_failed
-       print_error "No credentials"
-else
-       if [ "$timeleft" = "0:00:00" ]; then
-               test_failed
-               print_error "Credentials expired"
-       else
-               test_done
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
                datestr=`$SYS_DATE +%Y%m%d%H%M`
 
                SEQUENCE=`eval "echo {1..${NOOFJOBS}}"`
@@ -320,8 +312,6 @@ else
                done
                try_purge ${joblist}
 
-       fi
-fi
 
 test_end
 }
index 2987486..aeaadf5 100755 (executable)
@@ -99,19 +99,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
                # Register jobs:
 
                reg_error="0"
@@ -173,8 +165,6 @@ else
 
                fi
                
-       fi
-fi
 
 test_end
 }
index 530677a..6e3ee5a 100755 (executable)
@@ -98,18 +98,11 @@ else
 fi
 
 printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
+check_credentials_and_generate_proxy
+if [ $? != 0 ]; then
+       test_end
+       exit 2
+fi
 
                # Register job:
                printf "Registering testing job "
@@ -244,8 +237,6 @@ else
                else
                        test_skipped
                fi
-       fi
-fi
 
 test_end
 #} &> $logfile