#!/bin/bash

group=$1
testName="ERSRES"
testSummary="resource configured for ERS"

source ../get_test_values --group=$group
rName="rsc_sap_${mySID}_ERS${ersINST}"

function test()
{
    local system=$1
    timeout 10 ssh -T root@$system <<EOF
        cibadmin -Ql | \
           grep -q "$rName" 2>/dev/null;
EOF
    return $?
}

for system in $allSystems; do
    test $system; rc=$?
    logger -t $LandscapeUseCase -s "Test $testName for $group on node $system rc:  $rc"
    case $rc in 
        124 | 255 ) # test timeout - set N/A
             rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_OK
             rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_FAIL
             res="NA";
             ;;
        0 ) 
             touch $STATUS_BASE_DIR/.status/${group}_${testName}_OK
             rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_FAIL
             break
             ;;
        * )  rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_OK
             touch $STATUS_BASE_DIR/.status/${group}_${testName}_FAIL
             ;;
    esac
done
