From 4676ae4d9358735261a78c03947e9bf75cac16b6 Mon Sep 17 00:00:00 2001 From: srugovac <> Date: Fri, 23 Mar 2007 14:30:33 +0000 Subject: [PATCH] Layer 1 tests: add Readme file --- org.glite.testsuites.ctb/LB/Readme.txt | 53 +++++++++ org.glite.testsuites.ctb/LB/lb-l2.sh | 193 ++++++++++++++++--------------- org.glite.testsuites.ctb/LB/lb-l2Stat.sh | 150 ++++++++++++------------ 3 files changed, 233 insertions(+), 163 deletions(-) create mode 100644 org.glite.testsuites.ctb/LB/Readme.txt diff --git a/org.glite.testsuites.ctb/LB/Readme.txt b/org.glite.testsuites.ctb/LB/Readme.txt new file mode 100644 index 0000000..1a7033f --- /dev/null +++ b/org.glite.testsuites.ctb/LB/Readme.txt @@ -0,0 +1,53 @@ + + +Readme file for lb1 v1.0************************************* +Date: 19.03.2007 * +Author: * +************************************************************* + +lb-l1.sh +******** + +Script for testing of LB services + +* Prerequisities: All services running (user does not have to get any credentials) + +* Basic test: PING + check LB binaries + check running services +* Options: + -h | --help Show this help message. + -m | --m lb_host + -g | --log 'logfile' Redirect all output to the 'logfile'. + +* The name of the bkserver has to be specified everytime + + +Examples +******** + +[ui] /home/fmunster> ./lb-l1.sh -g log +USAGE: TCPecho + +[ui] /home/fmunster> ./lb-l1.sh -g log -m gliterb.iihe.ac.be + +[ui] /home/fmunster> cat log + +Basic services test...... +Checking binary glite-lb-job_reg ? OK +Checking binary glite-lb-job_log ? OK +Checking binary glite-lb-logevent ? OK +Checking binary glite-lb-user_jobs ? OK +Checking binary glite-lb-job_status ? OK +Checking binary glite-lb-change_acl ? OK +Checking binary glite-lb-lbmon OK +Listening to locallogger port (9002) +Connecting a socket with : 193.190.246.245,9002 [OK] +glite-lb-logd running ? - [OK] +Listening to interlogger ports (9000-9001-9003) +Connecting a socket with : 193.190.246.245,9000 [OK] +Connecting a socket with : 193.190.246.245,9001 [OK] +Connecting a socket with : 193.190.246.245,9003 [OK] +Interlogd running ? - [OK] + + diff --git a/org.glite.testsuites.ctb/LB/lb-l2.sh b/org.glite.testsuites.ctb/LB/lb-l2.sh index 69f6a25..1972a4e 100755 --- a/org.glite.testsuites.ctb/LB/lb-l2.sh +++ b/org.glite.testsuites.ctb/LB/lb-l2.sh @@ -20,17 +20,22 @@ LBJOBLOG=${LBJOBLOG:-glite-lb-job_log} LBJOBSTAT=${LBJOBSTAT:-glite-lb-job_status} LBPURGE=${PURGE:-glite-lb-purge} -BKSERVER="pc900.iihe.ac.be" +BKSERVER="localhost" STATES="aborted cancelled done ready running scheduled waiting submitted " SOURCES="NetworkServer WorkloadManager BigHelper JobController LogMonitor LRMS Application UserInterface" -stest=1 +dtest=1 i=0 JOBS_ARRAY_SIZE=10 INTERVAL=2 +DATE_S=`date +"%s"` +DATE=`date` +LOG_FILE="$DATE_S.log" + init() { +echo "Date: $DATE" > $LOG_FILE export EDG_WL_QUERY_SERVER="$BKSERVER:9000" export EDG_WL_LOG_DESTINATION="$BKSERVER:9002" BKSERVER_HOST="$BKSERVER:9000" @@ -50,7 +55,7 @@ rm jobList2 #registrating a job job_reg() { -eval $LBJOBREG -m pc900.iihe.ac.be:9000 -s userInterface > jobreg +eval $LBJOBREG $BKSERVER_OPT -s $1 > jobreg getJobId job=`cat jobreg` rm jobreg @@ -79,53 +84,52 @@ echo "Checking the Events............................................." echo job_id=0 while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - #sleep 2 - dtest=0 - #out is the list of events sent, we count the number of events and then we extract the job status - nbEvents=`cat out[$job_id] |grep glite-lb-logevent | wc -l` - nbEvents=$[$nbEvents+1] - cat out[$job_id] |gawk -F"-e " '{ print $2 }' > eventsTemp - echo "UserTag"> events - echo "RegJob">> events - cat eventsTemp|gawk -F" --" '{ print $1 }'>> events - rm eventsTemp - events3="blank" + #sleep 2 + #out is the list of events sent, we count the number of events and then we extract the job status + nbEvents=`cat out[$job_id] |grep glite-lb-logevent | wc -l` + nbEvents=$[$nbEvents+1] + cat out[$job_id] |gawk -F"-e " '{ print $2 }' > eventsTemp + echo "UserTag"> events + echo "RegJob">> events + cat eventsTemp|gawk -F" --" '{ print $1 }'>> events + rm eventsTemp + events3="blank" i=0 cmp -s events events3 - while [ $? -ne 0 ] && [ $i -lt $INTERVAL ] ; do - - - #we use glite-lb-job_log and apply the same treatment as above to the output - eval $LBJOBLOG -r $INTERVAL -d 2 ${SAMPLE_JOBS_ARRAY[$job_id]} > joblog2 - nbevents=`cat joblog2 | grep DATE | wc -l` - cat joblog2|gawk -F"DG.EVNT=\"" '{ print $2 }' > eventsTemp2 - cat eventsTemp2|gawk -F"\"" '{ print $1 }'> events2 - cat events2|sed /^$/d > events3 - rm eventsTemp2 events2 joblog2 - #Comparison of the outputs and intermediary printout - echo "Events Sent....." >> LoggedEvents.log - cat -n events >> LoggedEvents.log -# cat -n events - echo "Events recorded in the LB server....." >> LoggedEvents.log - cat -n events3 >> LoggedEvents.log -# cat -n events3 - i=$[$i+1] - cmp -s events events3 - done - cmp -s events events3 - if [ $? -eq 0 ]; then - dtest=1 - echo "Job $job_id ....................[OK]" - i=0 - - else - echo "Job $job_id.....................[FAILED]" - fi - rm events events3 out[$job_id] - job_id=$[$job_id+1] + while [ $? -ne 0 ] && [ $i -lt $INTERVAL ] ; do + + + #we use glite-lb-job_log and apply the same treatment as above to the output + eval $LBJOBLOG -r $INTERVAL -d 2 ${SAMPLE_JOBS_ARRAY[$job_id]} > joblog2 + nbevents=`cat joblog2 | grep DATE | wc -l` + cat joblog2|gawk -F"DG.EVNT=\"" '{ print $2 }' > eventsTemp2 + cat eventsTemp2|gawk -F"\"" '{ print $1 }'> events2 + cat events2|sed /^$/d > events3 + rm eventsTemp2 events2 joblog2 + #Comparison of the outputs and intermediary printout + echo "Events Sent....." >> $LOG_FILE + cat -n events >> $LOG_FILE +# cat -n events + echo "Events recorded in the LB server....." >> $LOG_FILE + cat -n events3 >> $LOG_FILE +# cat -n events3 + i=$[$i+1] + cmp -s events events3 + done + cmp -s events events3 + if [ $? -eq 0 ]; then + echo "Job $job_id ....................[OK]" + i=0 + + else + echo "Job $job_id.....................[FAILED]" + dtest=0 + fi + rm events events3 out[$job_id] + job_id=$[$job_id+1] done echo -echo "A detailed list of events logged has been printed to LoggedEvents.log" +echo "A detailed list of events logged has been printed to $LOG_FILE" echo } @@ -139,40 +143,25 @@ job_id=0 #sleep 1 eval $LBJOBSTATUS ${SAMPLE_JOBS_ARRAY[$job_id]} > status testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - i=0 - while [ $testStatus -ne 1 ] && [ $i -lt $INTERVAL ] ; do - bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` + i=0 + while [ $testStatus -ne 1 ] && [ $i -lt $INTERVAL ] ; do + bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - i=$[$i+1] - done - if [$testStatus -eq 1 ] ; then - echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[OK]" + i=$[$i+1] + done + if [$testStatus -eq 1 ] ; then + echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[OK]" else - echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[FAILED]" - cat status > errorStatus.tmp - echo "Detailed status has been copied to errorStatus.tmp" - echo + echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[FAILED]" + cat status > errorStatus.tmp + echo "Detailed status has been copied to errorStatus.tmp" + echo dtest=0 fi - rm status + rm status job_id=$[$job_id+1] done } -showHelp() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -r | --retries Number of test retries (2 by default)" - echo " -n | --nbjobs Number of jobs (10 by default)" - echo " -m | --bkserver Host address of the BKServer ex:pc900.iihe.ac.be " - echo " -s | --states List of states in which could tested jobs fall." - echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." - echo "" - -# echo "For proper operation check your grid-proxy-info" -# grid-proxy-info -} #logging events to the jobs. Events are selected randomly from a list. logEvents() @@ -181,17 +170,17 @@ echo "Logging events to the $JOBS_ARRAY_SIZE jobs............................... echo job_id2=0 st_count=`echo $STATES | wc -w` - while [ $job_id2 -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` + while [ $job_id2 -lt $JOBS_ARRAY_SIZE ] ; do + tmp=`echo $RANDOM % $st_count + 1 | bc` state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - SAMPLE_JOBS_STATES[$job_id2]=$state - echo > LoggedEvents.log - echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$job_id2]} " >> LoggedEvents.log - echo >> LoggedEvents.log - - echo "event submitted.......................................[$state]" >> LoggedEvents.log - eval glite-lb-$state.sh $LARGE_STRESS -j ${SAMPLE_JOBS_ARRAY[$job_id2]} 2>out[$job_id2] - job_id2=$(($job_id2 + 1)) + SAMPLE_JOBS_STATES[$job_id2]=$state + echo >> $LOG_FILE + echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$job_id2]} " >> $LOG_FILE + echo >> $LOG_FILE + + echo "event submitted.......................................[$state]" >> $LOG_FILE + eval glite-lb-$state.sh $LARGE_STRESS -j ${SAMPLE_JOBS_ARRAY[$job_id2]} 2>out[$job_id2] + job_id2=$(($job_id2 + 1)) done } @@ -203,11 +192,26 @@ echo job_id=0 while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - eval $LBLOGEVENT -s Application -e UserTag -j ${SAMPLE_JOBS_ARRAY[$job_id]} -name testTag -value 12345 >> LoggedEvents.log + eval $LBLOGEVENT -s Application -e UserTag -j ${SAMPLE_JOBS_ARRAY[$job_id]} -name testTag -value 12345 >> $LOG_FILE job_id=$[$job_id+1] done } +showHelp() +{ +echo "Usage: $0 [OPTIONS] " +echo "Options:" +echo " -h | --help Show this help message." +echo " -r | --retries Number of test retries (2 by default)" +echo " -n | --nbjobs Number of jobs (10 by default)" +echo " -m | --bkserver Host address of the BKServer ex:pc900.iihe.ac.be " +echo " -s | --states List of states in which could tested jobs fall." +echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." +echo "" + +# echo "For proper operation check your grid-proxy-info" +# grid-proxy-info +} #input @@ -215,15 +219,16 @@ if [ -z "$1" ]; then showHelp exit 2 fi +BK=0 while test -n "$1" do case "$1" in "-h" | "--help") showHelp && exit 2 ;; "-r" | "--retries") shift ; INTERVAL=$1 ;; - "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; - "-m" | "--bkserver") shift ; BKSERVER=$1 ;; + "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; + "-m" | "--bkserver") shift ; BKSERVER=$1 BK=1;; "-s" | "--states") shift; STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; + "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; # "-g" | "--log") shift ; logfile=$1 ;; *) echo "Unrecognized option $1 try -h for help"; exit 2 ;; @@ -231,6 +236,12 @@ do esac shift done +if [ $BK -ne 1 ]; then + echo + echo "You must specify the hostname of the LB Server with the option -m (ex: -m pf435.ulb.ac.be)" + echo + exit 2 +fi echo @@ -244,10 +255,10 @@ testLB2 #testProxy #eval $LBPURGE -h echo -if [ $stest -eq 1 ];then +if [ $dtest -eq 1 ];then echo "Final test result .........................................[OK]" - exit 1 -else echo "Final test result .........................................[FAILED]" - exit 0 + exit 1 +else echo "Final test result .........................................[FAILED]" + exit 0 fi echo diff --git a/org.glite.testsuites.ctb/LB/lb-l2Stat.sh b/org.glite.testsuites.ctb/LB/lb-l2Stat.sh index 1e5d9e2..b7bf2fb 100755 --- a/org.glite.testsuites.ctb/LB/lb-l2Stat.sh +++ b/org.glite.testsuites.ctb/LB/lb-l2Stat.sh @@ -18,12 +18,10 @@ LBJOBLOG=${LBJOBLOG:-glite-lb-job_log} LBJOBSTAT=${LBJOBSTAT:-glite-lb-job_status} LBPURGE=${PURGE:-glite-lb-purge} -# -m host -BKSERVER="pc900.iihe.ac.be" + STATES="aborted cancelled done ready running scheduled waiting submitted " SOURCES="NetworkServer WorkloadManager BigHelper JobController LogMonitor LRMS Application UserInterface" - -stest=1 +dtest=1 i=0 JOBS_ARRAY_SIZE=10 # timeouts for polling the bkserver @@ -31,9 +29,13 @@ timeout=10 maxtimeout=300 NB_TAGS=50 INTERVAL=2 +DATE_S=`date +"%s"` +DATE=`date` +LOG_FILE="$DATE_S.log" init() { +echo "Date: $DATE" > $LOG_FILE export EDG_WL_QUERY_SERVER="$BKSERVER:9000" export EDG_WL_LOG_DESTINATION="$BKSERVER:9002" BKSERVER_HOST="$BKSERVER:9000" @@ -61,7 +63,7 @@ rm jobList2 #registrating a job job_reg() { -eval $LBJOBREG -m pc900.iihe.ac.be:9000 -s userInterface > jobreg +eval $LBJOBREG $BKSERVER_OPT -s $1 > jobreg getJobId job=`cat jobreg` rm jobreg @@ -89,38 +91,37 @@ echo "Checking the Events............................................." echo job_id=0 while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - get_time - start=$time - logEvent $job_id - logTag $job_id - - - eval $LBJOBSTATUS ${SAMPLE_JOBS_ARRAY[$job_id]} > status + get_time + start=$time + logEvent $job_id + logTag $job_id + + + eval $LBJOBSTATUS ${SAMPLE_JOBS_ARRAY[$job_id]} > status testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - response=0 + response=0 while [ $testStatus -ne 1 ];do - bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - echo "**Retrying**" - sleep $timeout - response=$(($response + $timeout )) - if test $response -gt $maxtimeout ; then - echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job_id]} as queried from bkserver ($bkserver_state) has not become ${SAMPLE_JOBS_STATES[$job_id]} for more than $response seconds!" - echo "Detailed status has been copied to errorStatus.tmp" - echo - dtest=0 - exit 1; - fi - done - get_time - response=`echo "scale=9; ($time - $start)/1000000000"|bc` - SAMPLE_JOBS_RESPONSES[$job_id]=$response + bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` + testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` + echo "**Retrying**" + sleep $timeout + response=$(($response + $timeout )) + if test $response -gt $maxtimeout ; then + echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job_id]} as queried from bkserver ($bkserver_state) has not become ${SAMPLE_JOBS_STATES[$job_id]} for more than $response seconds!" + echo "Detailed status has been copied to errorStatus.tmp" + echo + dtest=0 + fi + done + get_time + response=`echo "scale=9; ($time - $start)/1000000000"|bc` + SAMPLE_JOBS_RESPONSES[$job_id]=$response echo "Job: $job_id ....[`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`].......[OK]" - echo - rm status + echo + rm status job_id=$[$job_id+1] - done - j=0 + done + j=0 total=0 echo "Sending events took for individual jobs the following time" while [ $j -lt $JOBS_ARRAY_SIZE ] ; do @@ -128,32 +129,16 @@ while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do echo -e "${SAMPLE_JOBS_ARRAY[$j]} \t${SAMPLE_JOBS_RESPONSES[$j]} seconds" j=$(($j + 1)) done - echo -e "Total time for $JOBS_ARRAY_SIZE jobs: \t$total" - echo -e -n "Average time for event: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE "|bc - echo -e -n "Average time for event and tags: \t" + echo -e "Total time for $JOBS_ARRAY_SIZE jobs: \t$total" + echo -e -n "Average time for event: \t" + echo "scale=9; $total / $JOBS_ARRAY_SIZE "|bc + echo -e -n "Average time for event and tags: \t" echo "scale=9; $total / $JOBS_ARRAY_SIZE / $NB_TAGS"|bc - echo -e -n "Event throughput (events/sec): \t" - echo "scale=9; $NB_TAGS * $JOBS_ARRAY_SIZE / $total"|bc - echo - echo "A detailed list of events logged has been printed to LoggedEvents.log" - echo -} - -showHelp() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -n | --nbjobs Number of jobs" - echo " -s | --states List of states in which could tested jobs fall." - echo " -m | --bkserver Host address of the BKServer " - echo " -t | --tags Number of user tags to load to each job." - echo " -l | --large-stress 'size' Do a large stress logging ('size' rand om data added to the messages." - echo "" - -# echo "For proper operation check your grid-proxy-info" -# grid-proxy-info + echo -e -n "Event throughput (events/sec): \t" + echo "scale=9; $NB_TAGS * $JOBS_ARRAY_SIZE / $total"|bc + echo + echo "A detailed list of events logged has been printed to $LOG_FILE" + echo } logEvent() @@ -165,34 +150,49 @@ state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` SAMPLE_JOBS_STATES[$1]=$state echo "Logging event to the job($1).........................[$state]" echo > LoggedEvents.log -echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$1]} " >> LoggedEvents.log +echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$1]} " >> $LOG_FILE echo >> LoggedEvents.log -echo "event submitted.......................................[$state]" >> LoggedEvents.log +echo "event submitted.......................................[$state]" >> $LOG_FILE eval glite-lb-$state.sh $LARGE_STRESS -j ${SAMPLE_JOBS_ARRAY[$1]} 2>out } logTag() { i=0 echo "Logging $NB_TAGS tags to the job................" -eval $LBLOGEVENT -s Application -n $NB_TAGS -e UserTag -j ${SAMPLE_JOBS_ARRAY[$1]} -name testTag -value 12345 >> LoggedEvents.log +eval $LBLOGEVENT -s Application -n $NB_TAGS -e UserTag -j ${SAMPLE_JOBS_ARRAY[$1]} -name testTag -value 12345 >> $LOG_FILE } +showHelp() +{ + echo "Usage: $0 [OPTIONS] " + echo "Options:" + echo " -h | --help Show this help message." + echo " -n | --nbjobs Number of jobs" + echo " -s | --states List of states in which could tested jobs fall." + echo " -m | --bkserver Host address of the BKServer " + echo " -t | --tags Number of user tags to load to each job." + echo " -l | --large-stress 'size' Do a large stress logging ('size' rand om data added to the messages." + echo "" +# echo "For proper operation check your grid-proxy-info" +# grid-proxy-info +} #input if [ -z "$1" ]; then showHelp exit 2 fi +BK=0 while test -n "$1" do case "$1" in "-h" | "--help") showHelp && exit 2 ;; - "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; - "-s" | "--states") shift; STATES="$1" ;; - "-m" | "--bkserver") shift ; BKSERVER_HOST=$1 ;; - "-t" | "--tags") shift ; NB_TAGS=$1 ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; + "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; + "-s" | "--states") shift; STATES="$1" ;; + "-m" | "--bkserver") shift ; BKSERVER=$1 BK=1 ;; + "-t" | "--tags") shift ; NB_TAGS=$1 ;; + "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; # "-g" | "--log") shift ; logfile=$1 ;; *) echo "Unrecognized option $1 try -h for help"; exit 2 ;; @@ -200,18 +200,24 @@ do esac shift done +if [ $BK -ne 1 ]; then + echo + echo "You must specify the hostname of the LB Server with the option -m (ex: -m pf435.ulb.ac.be)" + echo + exit 2 +fi -echo "Test of job status with several jobs " -echo "***********************************" echo init array_job_reg testLBP echo -if [ $stest -eq 1 ];then +if [ $dtest -eq 1 ];then echo "Final test result .........................................[OK]" - exit 1 -else echo "Final test result .........................................[FAILED]" - exit 0 + exit 1 +else echo "Final test result .........................................[FAILED]" + exit 0 fi echo + + -- 1.8.2.3