fix for SC-2587 & comments

This commit is contained in:
Maria Haider 2025-01-29 20:12:35 +01:00
parent ddde165d2b
commit 70008219d3
Signed by: mariah
GPG key ID: 7414A760CA747E57
2 changed files with 41 additions and 0 deletions

View file

@ -23,6 +23,8 @@ calculate_time() {
echo $diff
}
###Check if the exection is too old
exec_time=$(echo "$exec_status" | jq --raw-output '."last execution result".executiontimestamp')
exec_time_result=$?
@ -38,6 +40,9 @@ if [ "$diff_exec_time" -gt "$day" ]; then
fi
###Check how many lands are not executed, exit critical if it is more than two
raw_not_executed_test=$(echo "$exec_status" | jq --raw-output '."last execution result".notExecutedTests[2]')
declare -a not_executed_test=($(echo "$raw_not_executed_test" | tr "\n" " "))
@ -48,6 +53,22 @@ then
exit $STATE_CRITICAL
fi
###Exit critical if no tests have passed
raw_passed_tests=$(echo "$exec_status" | jq --raw-output '."last execution result".passed[0].result')
declare -a passed_tests=($(echo "$raw_passed_tests" | tr "\n" " "))
if [ "$passed_tests" == null ]
then
echo "No tests have passed"
exit $STATE_CRITICAL
fi
###Check which tests have failed, warn if it has been failing for 12 hours, be critical if it has been failing for more than a day
raw_lands=$(echo "$exec_status" | jq --raw-output '."last execution result".failed[].result')
raw_lands_result=$?

View file

@ -23,6 +23,9 @@ calculate_time() {
echo $diff
}
###Check if the exection is too old
exec_time=$(echo "$exec_status" | jq --raw-output '."last execution result".executiontimestamp')
exec_time_result=$?
@ -38,6 +41,8 @@ if [ "$diff_exec_time" -gt "$day" ]; then
fi
###Check if XA, XB are not executed
raw_not_executed_test=$(echo "$exec_status" | jq --raw-output '."last execution result".notExecutedTests[]')
declare -a not_executed_test=($(echo "$raw_not_executed_test" | tr "\n" " "))
@ -48,6 +53,21 @@ then
exit $STATE_CRITICAL
fi
###Exit critical if no tests have passed
raw_passed_tests=$(echo "$exec_status" | jq --raw-output '."last execution result".passed[0].result')
declare -a passed_tests=($(echo "$raw_passed_tests" | tr "\n" " "))
echo $passed_tests
if [ "$passed_tests" == null ]
then
echo "No tests have passed"
exit $STATE_CRITICAL
fi
#Check if any of the failed tests are XA, XB
raw_lands=$(curl -s https://api.swedenconnect.se/testid/qa/execution-status | jq --raw-output '."last execution result".failed[].result')