Skip to content
This repository was archived by the owner on Jan 11, 2025. It is now read-only.

Commit c0f4e40

Browse files
fixed test script
1 parent b4ca313 commit c0f4e40

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/test.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ source supported_versions
55
function test() {
66
DOCKER_TAG=$1
77

8-
docker image ls -q fabiocicerchia/nginx:$DOCKER_TAG \
9-
|| (docker run -d --name nginx_lua_test -p 8080:80 -v $PWD/test/nginx.conf:/etc/nginx/nginx.conf fabiocicerchia/nginx-lua:$DOCKER_TAG \
10-
&& until $(curl --output /dev/null --silent --head --fail http://localhost:8080); do echo -n '.'; sleep 0.5; done \
11-
; curl -v http://localhost:8080 | grep "Welcome to nginx" || exit 1 \
12-
; curl -v http://localhost:8080/lua_content | grep "Hello world" || exit 1 \
13-
; docker rm -f nginx_lua_test)
8+
docker rm -f nginx_lua_test 2> /dev/null
9+
10+
FOUND=$(docker image ls -q fabiocicerchia/nginx-lua:$DOCKER_TAG | wc -l)
11+
if [ $FOUND -ne 0 ]; then
12+
docker run -d --name nginx_lua_test -p 8080:80 -v $PWD/test/nginx.conf:/etc/nginx/nginx.conf fabiocicerchia/nginx-lua:$DOCKER_TAG \
13+
&& until $(curl --output /dev/null --silent --head --fail http://localhost:8080); do echo -n '.'; sleep 0.5; done \
14+
; curl -v http://localhost:8080 | grep "Welcome to nginx" || exit 1 \
15+
; curl -v http://localhost:8080/lua_content | grep "Hello world" || exit 1 \
16+
; docker rm -f nginx_lua_test
17+
else
18+
echo "Image not found: fabiocicerchia/nginx-lua:$DOCKER_TAG"
19+
fi
1420
}
1521

1622
function runtest() {

0 commit comments

Comments
 (0)