github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/engine/chaos/scripts/check-case.sh (about)

     1  #!/bin/bash
     2  
     3  completed=false
     4  for i in {1..22}; do
     5  	kubectl wait --for=condition=complete job/chaos-test-case --timeout=1m
     6  	if [ $? -eq 0 ]; then
     7  		completed=true
     8  		echo "chaos-test-case has completed"
     9  		break
    10  	else
    11  		echo "chaos-test-case has not completed" ${i}
    12  		kubectl get job chaos-test-case -o wide
    13  		if [ $? -ne 0 ]; then
    14  			echo "chaos-test-case job has been cleared"
    15  			break
    16  		fi
    17  		failed=$(kubectl get job chaos-test-case -o jsonpath={.status.failed})
    18  		if [[ $failed -gt 0 ]]; then
    19  			echo "chaos-test-case job has failed"
    20  			kubectl logs job.batch/chaos-test-case
    21  			kubectl describe jobs/chaos-test-case
    22  			break
    23  		fi
    24  	fi
    25  done
    26  
    27  if ! $completed; then
    28  	exit 1
    29  fi