Skip to content

Commit

Permalink
Improve c8dind test retry loop (one step closer to full retry.sh lolsob)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Oct 29, 2023
1 parent c0222cf commit 705e698
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .test/tests/c8dind/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,26 @@ ctr_() {
# poor man's retry.sh
tries=30
while (( --tries > 0 )) && ! ctr_ version &> /dev/null; do
if ! running="$(docker inspect -f '{{ .State.Running }}' "$cid" 2>/dev/null)" || [ "$running" != 'true' ]; then
echo >&2 "$image stopped unexpectedly!"
( set -x && docker logs "$cid" ) >&2 || true
false
fi
echo >&2 -n .
sleep 1
done
ctr_ version > /dev/null

testImage='docker.io/tianon/true:yoloci'

[ "$(ctr_ image ls -q | wc -l)" = '0' ]
ctr_ content fetch docker.io/tianon/true:yoloci
ctr_ content fetch "$testImage"
[ "$(ctr_ image ls -q | wc -l)" = '1' ]

[ "$(ctr_ container ls -q | wc -l)" = '0' ]

ctr_ run --rm docker.io/tianon/true:yoloci test
ctr_ run --rm docker.io/tianon/true:yoloci test
ctr_ run --rm docker.io/tianon/true:yoloci test
ctr_ run --rm "$testImage" test
ctr_ run --rm "$testImage" test
ctr_ run --rm "$testImage" test

[ "$(ctr_ container ls -q | wc -l)" = '0' ]

0 comments on commit 705e698

Please sign in to comment.