diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-05-19 17:30:27 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-05-25 10:30:04 +0300 |
commit | 244d701607858ce0c4231eb58a467bbf03d00ce8 (patch) | |
tree | e7d9b070beea5b07a199e6dd944a28b419df235e | |
parent | 11c8f877d5f1367f0cdc9dda6cfb3f29e059e8d3 (diff) |
Remove build dependency from test:coverage job
The CI drops privileges while running tests. This prevents creating
the required directories to store the test coverage files, thus the
test:coverage job doesn't work without the cache that already
contains the required directories.
To allow the test:coverage job to also run in parallel with the build
steps, this commit overrides the output directory of the coverage
files in the test jobs so they can be created even when the privileges
are dropped, similarly to what is being done with the test result
output with TEST_REPORT variable.
-rw-r--r-- | .gitlab-ci.yml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94d9da7dd..c965c1352 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -82,6 +82,7 @@ include: POSTGRES_DB: praefect_test POSTGRES_HOST_AUTH_METHOD: trust TEST_REPORT: /tmp/go-tests-report.xml + TEST_COVERAGE_DIR: /tmp/coverage before_script: &test_before_script - go version - while ! psql -h $PGHOST -U $PGUSER -c 'SELECT 1' > /dev/null; do echo "awaiting Postgres service to be ready..." && sleep 1 ; done && echo "Postgres service is ready!" @@ -180,7 +181,6 @@ test: test:coverage: <<: *test_definition - needs: [ build ] # this job fails with permission errors if the caches from the build step are not in place coverage: /^total:\t+\(statements\)\t+\d+\.\d+%$/ script: # We need to explicitly build all prerequisites so that we can run tests unprivileged. @@ -190,7 +190,7 @@ test:coverage: reports: coverage_report: coverage_format: cobertura - path: _build/cover/cobertura.xml + path: ${TEST_COVERAGE_DIR}/cobertura.xml test:pgbouncer: <<: *test_definition |