Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hadoop-ozone/dist/src/main/compose/common/hadoop-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ for HADOOP_TEST_IMAGE in $HADOOP_TEST_IMAGES; do
hadoop_version=$(docker run --rm "${HADOOP_TEST_IMAGE}" bash -c "hadoop version | grep -m1 '^Hadoop' | cut -f2 -d' '")
export HADOOP_MAJOR_VERSION=${hadoop_version%%.*}

retry docker-compose --ansi never --profile hadoop pull nm rm
docker-compose --ansi never --profile hadoop up -d nm rm

execute_command_in_container rm hadoop version
Expand Down
26 changes: 26 additions & 0 deletions hadoop-ozone/dist/src/main/compose/testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ start_docker_env(){

docker-compose --ansi never down --remove-orphans

retry docker-compose --ansi never pull

opts=""
if has_scalable_datanode; then
opts="--scale datanode=${datanode_count}"
Expand Down Expand Up @@ -357,6 +359,30 @@ save_container_logs() {
done
}

retry() {
local -i n=0
local -i attempts=${RETRY_ATTEMPTS:-3}
local -i rc=0

set +e
while [[ $n -lt $attempts ]]; do
if "$@"; then
rc=0
break
fi
let n++

if [[ $n -eq $attempts ]]; then
echo "ERROR: $n attempts failed to: $@"
rc=1
else
sleep ${RETRY_SLEEP:-3}
fi
done
set -e

return ${rc}
}

## @description wait until the port is available on the given host
## @param The host to check for the port
Expand Down