diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2023-08-08 01:59:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 01:59:58 +0300 |
commit | bbb24d10d417452ef23a8c506fd0e2b141b71f15 (patch) | |
tree | 11bd7cb31f8d26b64ee56916d920bbb4d6915769 /test/docker-in-docker/docker_retry.sh | |
parent | 29859aff280dc187d6f508900f8600ebd04c56b7 (diff) |
Docker-in-docker: Add retries to the docker-init script until docker daemon starts (#637)feature_docker-in-docker_2.3.0
* Docker-in-docker: Add retries until docker daemon starts
* address comments
Diffstat (limited to 'test/docker-in-docker/docker_retry.sh')
-rw-r--r-- | test/docker-in-docker/docker_retry.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/docker-in-docker/docker_retry.sh b/test/docker-in-docker/docker_retry.sh new file mode 100644 index 0000000..cc35fbb --- /dev/null +++ b/test/docker-in-docker/docker_retry.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Definition specific tests +check "docker-buildx" docker buildx version +check "docker-ps" docker ps + +sleep 5s + +# Stop docker +pkill dockerd +pkill containerd + +sleep 5s + +set +e + docker_ok_code="$(docker info > /dev/null 2>&1; echo $?)" +set -e + +check "docker-not-running" bash -c "[[ ${docker_ok_code} == 1 ]]" + +# Testing retry logic +./test-scripts/docker-test-init.sh + +check "docker-started-after-retries" docker ps + +# Report result +reportResults |