Skip to content

Commit 5972c7f

Browse files
MartijnVisserAHeise
authored andcommitted
[FLINK-24971][tests] Adding retry function for failures in Bash e2e tests
1 parent c1f8e73 commit 5972c7f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

flink-end-to-end-tests/test-scripts/common.sh

+21
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,27 @@ function retry_times_with_backoff_and_cleanup() {
791791
return 1
792792
}
793793

794+
function retry_times_with_exponential_backoff {
795+
local retries=$1
796+
shift
797+
798+
local count=0
799+
echo "Executing command:" "$@"
800+
until "$@"; do
801+
exit=$?
802+
wait=$((2 ** $count))
803+
count=$(($count + 1))
804+
if [ $count -lt $retries ]; then
805+
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
806+
sleep $wait
807+
else
808+
echo "Retry $count/$retries exited $exit, no more retries left."
809+
return $exit
810+
fi
811+
done
812+
return 0
813+
}
814+
794815
JOB_ID_REGEX_EXTRACTOR=".*JobID ([0-9,a-f]*)"
795816

796817
function extract_job_id_from_job_submission_return() {

flink-end-to-end-tests/test-scripts/common_ssl.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ function _set_conf_ssl_helper {
7777
# -> we need to build it ourselves
7878
FLINK_SHADED_VERSION=$(cat ${END_TO_END_DIR}/../pom.xml | sed -n 's/.*<flink.shaded.version>\(.*\)<\/flink.shaded.version>/\1/p')
7979
echo "BUILDING flink-shaded-netty-tcnative-static"
80-
git clone https://github.com/apache/flink-shaded.git
80+
# Adding retry to git clone, due to FLINK-24971
81+
retry_times_with_exponential_backoff 5 git clone https://github.com/apache/flink-shaded.git
8182
cd flink-shaded
8283
git checkout "release-${FLINK_SHADED_VERSION}"
8384
run_mvn clean package -Pinclude-netty-tcnative-static -pl flink-shaded-netty-tcnative-static

0 commit comments

Comments
 (0)