Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdshipley/9210161320501568a82737fce78dc39f to your computer and use it in GitHub Desktop.
Save tdshipley/9210161320501568a82737fce78dc39f to your computer and use it in GitHub Desktop.
Script to wait for a test to finish running in a K8s Pod
passed="false"
failed="false"
while [ "$failed" == "false" ] && [ "$passed" == "false" ] && [ $tryCount -lt $maxWaitTime ]
do
tryCount=$((tryCount + 1))
podLogs=$(kubectl logs --tail=80 pods/$runningPod)
case $podLogs in
*"Test run passed"*) passed="true";;
*"Test run failed"*) failed="true";;
*) sleep 5
esac
timeWaited=$((tryCount * 5))
echo "Waiting for test run to finish. Waited: $timeWaited seconds"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment