From bae2a04ed6919a9beeb58ed159cb27a0f38d756a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Thu, 23 May 2024 19:30:13 +0200 Subject: [PATCH] Fix failing test not actually failing and add artifacts (This commit should fail), Closes #24 --- .gitlab-ci.yml | 6 +++++- docker_start.sh | 12 ++++++++---- tests/routes/site.py | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 750245f..77d0f31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,4 +29,8 @@ run-tests: name: registry.git.fsmpi.rwth-aachen.de/videoag/backend_api/videoag_api_testing:$CI_COMMIT_SHA entrypoint: [""] script: - - $CI_PROJECT_DIR/docker_start.sh -test \ No newline at end of file + - $CI_PROJECT_DIR/docker_start.sh -test + artifacts: + paths: + - $CI_PROJECT_DIR/coverage/report.txt + - $CI_PROJECT_DIR/coverage/html/* diff --git a/docker_start.sh b/docker_start.sh index c1d5186..250ea17 100755 --- a/docker_start.sh +++ b/docker_start.sh @@ -11,10 +11,14 @@ if [ $# = 1 ] && [ $1 = "-test" ]; then uname -a export VIDEOAG_API_TEST_CONFIG_OVERRIDE="../config/test_config_override.py" python3 -V - python3 -m coverage run --data-file "../coverage/.data" run_tests.py - python3 -m coverage report --data-file "../coverage/.data" --include "./*" - python3 -m coverage report --data-file "../coverage/.data" -m --include "./*" > ../coverage/report.txt - python3 -m coverage html -d "../coverage/html/" --data-file "../coverage/.data" --include "./*" + python3 -m coverage run --data-file "../coverage/.data" run_tests.py || + { echo "Test failed!"; exit 1; } + python3 -m coverage report --data-file "../coverage/.data" --include "./*" || + { echo "Coverage report stdout failed"; exit 1; } + python3 -m coverage report --data-file "../coverage/.data" -m --include "./*" > ../coverage/report.txt || + { echo "Coverage report report.txt failed"; exit 1; } + python3 -m coverage html -d "../coverage/html/" --data-file "../coverage/.data" --include "./*" || + { echo "Coverage report html failed"; exit 1; } else echo "Running nginx and uWSGI" nginx -c ${VIDEOAG_NGINX_CONFIG} -p . & diff --git a/tests/routes/site.py b/tests/routes/site.py index 90b437e..527fac4 100644 --- a/tests/routes/site.py +++ b/tests/routes/site.py @@ -8,7 +8,7 @@ class SiteTest(ApiTest): # TODO test live config self.do_json_request( "GET", - "/status", + "/path-which-does-not-exist", None, { "status": "available", -- GitLab