Port exposing doesn't work in gitlab-ci, use container hostname instead.

parent 23e36673
......@@ -142,7 +142,7 @@ test_build:
- docker build . -t admin
# run simple smoketests to verify Docker image is sane
- tests/docker.sh
- tests/docker.sh admin
# run on MR
except: [master]
......
......@@ -4,6 +4,8 @@ set -ve
# run simple smoketests to verify docker image build is sane
host=${1:-localhost}
if test -f /bin/busybox;then
timeout="timeout -t 15"
else
......@@ -15,20 +17,20 @@ docker run --rm --name admin -p 8000:8000 -d admin runuwsgi
trap "docker logs admin;docker stop admin&" EXIT
# wait for server to be ready
$timeout /bin/sh -c "while ! curl -sSIk http://localhost:8000 | grep 200\ OK;do sleep 1;done"
$timeout /bin/sh -c "while ! curl -sSIk http://$host:8000 | grep 200\ OK;do sleep 1;done"
# setup database and implicitly test running commands
docker exec admin failmap-admin migrate
docker exec admin failmap-admin loaddata development
# index page
curl -s http://localhost:8000 |grep MSPAINT.EXE
curl -s "http://$host:8000" |grep MSPAINT.EXE
# static files
curl -sI http://localhost:8000/static/images/red-dot.png |grep 200\ OK
curl -sI "http://$host:8000/static/images/red-dot.png" |grep 200\ OK
# compressed static files
curl -sI "http://localhost:8000/static/$(curl -s http://localhost:8000/static/CACHE/manifest.json|sed -n 's,.*\(CACHE/js/.*js\).*,\1,p')"|grep 200\ OK
curl -sI "http://$host:8000/static/$(curl -s "http://$host:8000/static/CACHE/manifest.json"|sed -n 's,.*\(CACHE/js/.*js\).*,\1,p')"|grep 200\ OK
# admin login
curl -si --cookie-jar cookie --cookie cookie http://localhost:8000/admin/login/|grep 200\ OK
curl -si --cookie-jar cookie --cookie cookie --data "csrfmiddlewaretoken=$(grep csrftoken cookie | cut -f 7)&username=admin&password=faalkaart" http://localhost:8000/admin/login/|grep 302\ Found
curl -si --cookie-jar cookie --cookie cookie "http://$host:8000/admin/login/"|grep 200\ OK
curl -si --cookie-jar cookie --cookie cookie --data "csrfmiddlewaretoken=$(grep csrftoken cookie | cut -f 7)&username=admin&password=faalkaart" "http://$host:8000/admin/login/"|grep 302\ Found
echo "All good!"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment