1u0 commented on a change in pull request #9419: [FLINK-13599][e2e tests]
Harden test_streaming_kinesis with kinesalite docker image download/run retries
URL: https://github.com/apache/flink/pull/9419#discussion_r312910804
##########
File path: flink-end-to-end-tests/test-scripts/common.sh
##########
@@ -747,3 +747,47 @@ function retry_times() {
echo "Command: ${command} failed ${retriesNumber} times."
return 1
}
+
+##################################################################################
+# Retry action until it has successfully exited and wait for condition.
+#
+# Globals:
+# -
+# Arguments:
+# $1 - action to run
+# $2 - boolean function to check whether the action has been successfully
done
+# $3 - action name for logs
+# $4 - (default: 10) max number of retries to run action until passed and
check done
+# $5 - (default: 0) backoff delay in seconds between retry attempts
+# Returns:
+# Done or failed message
+###################################################################################
+function retry_until_passed_and_wait_condition {
Review comment:
I think, it should be possible to "simulate" your new function by already
existing `retry_times` function above:
```bash
retry_until_passed_and_wait_condition START_KINESALITE KINESALITE_STARTED
"start kinesalite" ${START_KINESALITE_MAX_RETRY_NUMBER}
### Can be translated to smt. like:
function check_and_start_kinesalite() {
if ! KINESALITE_STARTED; then
START_KINESALITE
fi
KINESALITE_STARTED
return $?
}
if ! retry_times ${START_KINESALITE_MAX_RETRY_NUMBER} 0
check_and_start_kinesalite ; then
exit 1
fi
```
I suggest to avoid functional duplication and try to consolidate both
methods.
----------------------------------------------------------------
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]
With regards,
Apache Git Services