.gitlab-ci.yml - improved testing

This commit is contained in:
Oscar Krause 2022-12-27 12:40:33 +01:00
parent 701453b18a
commit 4df5f18b67
1 changed files with 7 additions and 9 deletions

View File

@ -65,10 +65,13 @@ test:debian:
- job: build:debian - job: build:debian
artifacts: true artifacts: true
before_script: before_script:
- apt-get update -qq && apt-get install -qq -y jq # systemd - apt-get update -qq && apt-get install -qq -y jq
script: script:
# test installation # test installation
- apt-get install -q -y ./build/build.deb --fix-missing - apt-get install -q -y ./build/build.deb --fix-missing
# copy example config from GitLab-CI-Variables
#- cat ${EXAMPLE_CONFIG} > /etc/fastapi-dls/env
# start service in background
- uvicorn --host 127.0.0.1 --port 443 - uvicorn --host 127.0.0.1 --port 443
--app-dir /usr/share/fastapi-dls/app --app-dir /usr/share/fastapi-dls/app
--ssl-keyfile /etc/fastapi-dls/webserver.key --ssl-keyfile /etc/fastapi-dls/webserver.key
@ -76,15 +79,10 @@ test:debian:
--proxy-headers & --proxy-headers &
- FASTAPI_DLS_PID=$! - FASTAPI_DLS_PID=$!
- echo "Started service with pid $FASTAPI_DLS_PID" - echo "Started service with pid $FASTAPI_DLS_PID"
# testing service
- if [ "`curl --insecure -s https://127.0.0.1/status | jq .status`" != "up" ]; then echo "Success"; else "Error"; fi
# cleanup
- kill $FASTAPI_DLS_PID - kill $FASTAPI_DLS_PID
# copy example config from GitLab-CI-Variables
#- cat ${EXAMPLE_CONFIG} > /etc/fastapi-dls/env
#- systemctl daemon-reload
#- systemctl enable fastapi-dls.service
#- systemctl start fastapi-dls.service
#- if [ "`curl --insecure -s https://localhost:8000/status | jq .status`" != "up" ]; then exit 2; fi
#- systemctl stop fastapi-dls.service
#- systemctl disable fastapi-dls.service
- apt-get purge -qq -y fastapi-dls - apt-get purge -qq -y fastapi-dls
- apt-get autoremove -qq -y && apt-get clean -qq - apt-get autoremove -qq -y && apt-get clean -qq