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

Use docker-compose to run tests #1221

Merged
merged 19 commits into from
Dec 17, 2022
Merged

Use docker-compose to run tests #1221

merged 19 commits into from
Dec 17, 2022

Conversation

wil93
Copy link
Member

@wil93 wil93 commented Dec 15, 2022

Move the testing logic from the Github Actions format to a docker-compose.test.yml file. The advantage of this approach is that we can now run tests locally in a easy and reproducible way.

Moreover, instead of using sed at runtime to inject the test database string into cms.conf, we now always add a cms-testdb.conf file next to cms.conf in the /usr/local/etc/ folder as part of the build step of the docker container. We then decide which config file to use based on the already-supported CMS_CONFIG environment variable. (I had to patch testrunner.py which was not supporting that variable yet.)

One possible next step in this direction could be using this approach also for local development, with a cms-devdb.conf file which likewise always gets copied in the etc folder, and a docker-compose.dev.yml which uses it to start the DB and the local CMS instance. It's also possible to re-use the Dockerfile in production, but I wouldn't try to support that use case seriously just yet (I think the contest admins can write a docker-compose.yml fitting their specific needs).

Move the testing logic from the Github Actions format to a more easy
to reproduce docker-compose file.
Copy link
Member

@stefano-maggiolo stefano-maggiolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know docker, so I'll let you test that it works - it seems you're also still tweaking codecov. For the moment I left a comment for you, the rest looks fine for as much I know.

Dockerfile Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Merging #1221 (fc280d8) into master (bbef0ac) will decrease coverage by 0.06%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1221      +/-   ##
==========================================
- Coverage   63.51%   63.44%   -0.07%     
==========================================
  Files         233      233              
  Lines       17151    17151              
==========================================
- Hits        10893    10882      -11     
- Misses       6258     6269      +11     
Flag Coverage Δ
functionaltests 47.17% <ø> (-0.10%) ⬇️
unittests 44.00% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cms/db/util.py 50.37% <0.00%> (-4.45%) ⬇️
cms/service/ScoringService.py 66.66% <0.00%> (-3.04%) ⬇️
cms/service/workerpool.py 62.77% <0.00%> (-2.23%) ⬇️
cms/server/admin/handlers/base.py 68.31% <0.00%> (-1.66%) ⬇️
cms/service/ProxyService.py 65.21% <0.00%> (-1.45%) ⬇️
cms/service/EvaluationService.py 71.64% <0.00%> (-1.25%) ⬇️
cms/server/contest/handlers/taskusertest.py 46.55% <0.00%> (-1.15%) ⬇️
cms/io/triggeredservice.py 85.56% <0.00%> (-1.04%) ⬇️
cms/server/contest/handlers/contest.py 86.40% <0.00%> (-0.98%) ⬇️
cms/db/filecacher.py 79.44% <0.00%> (-0.31%) ⬇️
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@stefano-maggiolo stefano-maggiolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Please look at those two nits and squash the commits as necessary for them to make sense before pushing!

cmstestsuite/RunFunctionalTests.py Outdated Show resolved Hide resolved
cmstestsuite/RunUnitTests.py Outdated Show resolved Hide resolved
@wil93 wil93 merged commit db27018 into cms-dev:master Dec 17, 2022
@wil93 wil93 deleted the docker_action branch December 17, 2022 00:39
@wil93 wil93 mentioned this pull request Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants