From 9c6da282592db2f200b52e92dd19322768032122 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Tue, 8 Jun 2010 10:08:20 +0000 Subject: [PATCH] Job Registration test extended to cover JobID reuse with/without the 'exclusive' flag set. --- org.glite.testsuites.ctb/LB/tests/lb-common.sh | 3 + .../LB/tests/lb-test-job-registration.sh | 67 +++++++++++++++++++++- org.glite.testsuites.ctb/LB/tests/test-common.sh | 5 +- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common.sh b/org.glite.testsuites.ctb/LB/tests/lb-common.sh index b418bb1..55bcb8b 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-common.sh @@ -57,6 +57,7 @@ LBPARSEEFILE=glite-lb-parse_eventsfile LB4AGUACTINFO=glite-lb-ws_lb4agu_GetActivityInfo LB4AGUACTSTATUS=glite-lb-ws_lb4agu_GetActivityStatus LBREGSANDBOX=glite-lb-register_sandbox +LBHISTORY=glite-lb-state_history LB_LOGD=glite-lb-logd LB_INTERLOGD=glite-lb-interlogd @@ -100,6 +101,8 @@ SYS_RM="rm -f" SYS_CHMOD=chmod SYS_LDAPSEARCH=ldapsearch SYS_CAT=cat +SYS_NL=nl +SYS_TAIL=tail # not used at the moment DEBUG=2 diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh index ec70aa3..b268eed 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh @@ -132,10 +132,75 @@ else print_error "Job has not been submitted" fi + printf "Trying to re-register job with the same jobid..." + ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid > /dev/null + + noofevents=`${LBHISTORY} $jobid | $SYS_NL | $SYS_TAIL -n 1 | ${SYS_AWK} '{print $1}'` + + printf "(Event No. $noofevents)..." + + if [ "${noofevents}" = "2" ]; then + test_done + else + test_failed + print_error "Second registration did not take place" + fi + + + printf "Trying to re-register job with the same jobid, 'exclusive' flag on..." + ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid -E > /dev/null + + noofevents=`${LBHISTORY} $jobid | $SYS_NL | $SYS_TAIL -n 1 | ${SYS_AWK} '{print $1}'` + + printf "(Event No. $noofevents)..." + + if [ "${noofevents}" = "2" ]; then + test_done + else + test_failed + print_error "Wrong number of registration events" + fi + + #Purge test job joblist=$$_jobs_to_purge.txt echo $jobid > ${joblist} - try_purge ${joblist} + ${LBPURGE} -j ${joblist} > /dev/null + $SYS_RM ${joblist} + + jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` + printf "Test job purged. Testing state... ($jobstate)" + + if [ "${jobstate}" = "Purged" ]; then + test_done + + + ${LBJOBREG} -h 2>&1 | $SYS_GREP '\-E' > /dev/null + + if [ $? = 0 ]; then + printf "Trying to re-register. Same JobID, exclusive flag..." + ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid -E > /dev/null + jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` + + if [ "${jobstate}" = "Purged" ]; then + test_done + else + test_failed + print_error "Job has not remained in purged state" + fi + + else + printf "Client does not support the 'exclusive' flag." + test_skipped + fi + + + else + printf "Job has not been purged, re-registration test will be skipped" + + test_skipped + fi + fi diff --git a/org.glite.testsuites.ctb/LB/tests/test-common.sh b/org.glite.testsuites.ctb/LB/tests/test-common.sh index 327a5c8..f0ca470 100644 --- a/org.glite.testsuites.ctb/LB/tests/test-common.sh +++ b/org.glite.testsuites.ctb/LB/tests/test-common.sh @@ -205,7 +205,10 @@ function update_error() function print_error() { printf "${begin_red}Error${end_red}: %s ${lf}" "$*" - printf "${begin_red}Error${end_red}: %s ${lf}" "`cat $testerrfile`" + + if [ -f $testerrfile ]; then + printf "${begin_red}Error${end_red}: %s ${lf}" "`cat $testerrfile`" + fi reset_error } -- 1.8.2.3