Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI not reporting error when unit tests fail but functional tests pass. #1274

Merged
merged 7 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions _cms-test-internal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

sudo chown cmsuser:cmsuser ./codecov

dropdb --host=testdb --username=postgres cmsdbfortesting
createdb --host=testdb --username=postgres cmsdbfortesting
cmsInitDB

pytest --cov . --cov-report xml:codecov/unittests.xml
UNIT=$?

dropdb --host=testdb --username=postgres cmsdbfortesting
createdb --host=testdb --username=postgres cmsdbfortesting
cmsInitDB

cmsRunFunctionalTests -v --coverage codecov/functionaltests.xml
FUNC=$?

# This check is needed because otherwise failing unit tests aren't reported in
# the CI as long as the functional tests are passing. Ideally we should get rid
# of `cmsRunFunctionalTests` and make those tests work with pytest so they can
# be auto-discovered and run in a single command.
if [ $UNIT -ne 0 ] || [ $FUNC -ne 0 ]
then
exit 1
else
exit 0
fi
13 changes: 1 addition & 12 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,4 @@ services:
- "./codecov:/home/cmsuser/cms/codecov"
privileged: true
cgroup: host
command: >
wait-for-it testdb:5432 -- sh -c "
dropdb --host=testdb --username=postgres cmsdbfortesting ;
createdb --host=testdb --username=postgres cmsdbfortesting ;
cmsInitDB ;
sudo chown cmsuser:cmsuser ./codecov ;
pytest --cov . --cov-report xml:codecov/unittests.xml ;
dropdb --host=testdb --username=postgres cmsdbfortesting ;
createdb --host=testdb --username=postgres cmsdbfortesting ;
cmsInitDB ;
cmsRunFunctionalTests -v --coverage codecov/functionaltests.xml ;
"
command: wait-for-it testdb:5432 -- ./_cms-test-internal.sh
Loading