Skip to content

Commit

Permalink
Make tests re-runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Mar 8, 2022
1 parent b8b6498 commit 993d52b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions tests/00.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ run "docker run -d --rm --platform ${ARCH} \
run "sleep 20" # Startup-time is longer on cross-platform
run "docker ps"
run "docker logs ${RAND_NAME}"
run "curl -sS localhost/index.html"
run "curl -sS localhost/index.html | grep 'hello world'"
if ! run "curl -sS localhost/index.html"; then
run "docker stop ${RAND_NAME}"
exit 1
fi
if ! run "curl -sS localhost/index.html | grep 'hello world'"; then
run "docker stop ${RAND_NAME}"
exit 1
fi


###
Expand Down
13 changes: 10 additions & 3 deletions tests/01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@ run "sleep 20" # Startup-time is longer on cross-platform
run "docker ps"
run "docker logs ${RAND_NAME1}"
run "docker logs ${RAND_NAME2}"
run "curl localhost"
run "curl localhost | grep 'hello world php'"

if ! run "curl localhost"; then
run "docker stop ${RAND_NAME1}"
run "docker stop ${RAND_NAME2}"
exit 1
fi
if ! run "curl localhost | grep 'hello world php'"; then
run "docker stop ${RAND_NAME1}"
run "docker stop ${RAND_NAME2}"
exit 1
fi

###
### Cleanup
Expand Down

0 comments on commit 993d52b

Please sign in to comment.