zentol commented on a change in pull request #13419:
URL: https://github.com/apache/flink/pull/13419#discussion_r495803821
##########
File path: flink-end-to-end-tests/test-scripts/common.sh
##########
@@ -801,32 +801,44 @@ function extract_job_id_from_job_submission_return() {
echo "$JOB_ID"
}
-
-#
-# NOTE: This function requires at least Bash version >= 4. Mac OS in 2020
still ships 3.x
-#
kill_test_watchdog() {
- local watchdog_pid=`cat $TEST_DATA_DIR/job_watchdog.pid`
+ local watchdog_pid=$(cat $TEST_DATA_DIR/job_watchdog.pid)
echo "Stopping job timeout watchdog (with pid=$watchdog_pid)"
kill $watchdog_pid
}
-run_test_with_timeout() {
- local TEST_TIMEOUT_SECONDS=$1
- shift
- local TEST_COMMAND=$@
+#
+# NOTE: This function requires at least Bash version >= 4 due to the usage of
$BASHPID. Mac OS in 2020 still ships 3.x
+#
+internal_run_with_timeout() {
+ local timeout_in_seconds="$1"
+ local on_failure="$2"
+ local command_label="$3"
+ local command="${@:4}"
on_exit kill_test_watchdog
(
- cmdpid=$BASHPID
- (sleep $TEST_TIMEOUT_SECONDS # set a timeout for this test
- echo "Test (pid: $cmdpid) did not finish after $TEST_TIMEOUT_SECONDS
seconds."
- echo "Printing Flink logs and killing it:"
- cat ${FLINK_DIR}/log/*
- kill "$cmdpid") & watchdog_pid=$!
+ command_pid=$BASHPID
+ (sleep "${timeout_in_seconds}" # set a timeout for this test
Review comment:
```suggestion
(sleep "${timeout_in_seconds}" # set a timeout for this command
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]