This is an automated email from the ASF dual-hosted git repository. gary pushed a commit to branch release-1.9 in repository https://gitbox.apache.org/repos/asf/flink.git
commit 470975d424923487829059e95aa7bbd267b0f0ac Author: Gary Yao <g...@apache.org> AuthorDate: Tue Jul 9 15:05:03 2019 +0200 [hotfix][tests] Improve wait_job_terminal_state() function Always terminate script if job is in globally terminal state. Assert that expected terminal state matches actual state. --- flink-end-to-end-tests/test-scripts/common.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh index 10061d1..714150c 100644 --- a/flink-end-to-end-tests/test-scripts/common.sh +++ b/flink-end-to-end-tests/test-scripts/common.sh @@ -450,17 +450,23 @@ function wait_job_running { function wait_job_terminal_state { local job=$1 - local terminal_state=$2 + local expected_terminal_state=$2 - echo "Waiting for job ($job) to reach terminal state $terminal_state ..." + echo "Waiting for job ($job) to reach terminal state $expected_terminal_state ..." while : ; do - N=$(grep -o "Job $job reached globally terminal state $terminal_state" $FLINK_DIR/log/*standalonesession*.log | tail -1 || true) - + local N=$(grep -o "Job $job reached globally terminal state .*" $FLINK_DIR/log/*standalonesession*.log | tail -1 || true) if [[ -z $N ]]; then sleep 1 else - break + local actual_terminal_state=$(echo $N | sed -n 's/.*state \([A-Z]*\).*/\1/p') + if [[ -z $expected_terminal_state ]] || [[ "$expected_terminal_state" == "$actual_terminal_state" ]]; then + echo "Job ($job) reached terminal state $actual_terminal_state" + break + else + echo "Job ($job) is in state $actual_terminal_state but expected $expected_terminal_state" + exit 1 + fi fi done }