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

Allow model_version command line configuration of integration tests #878

Merged
merged 15 commits into from Apr 23, 2024

Conversation

GernotMaier
Copy link
Contributor

@GernotMaier GernotMaier commented Apr 19, 2024

This PR adds an option to allow to run the integration tests for different model versions and adds a --model_version to the integration tests.

Example:

pytest --no-cov --model_version="prod5" \
    "tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-print-array-elements_utm_to_ground_meta_in_yml]"

Adds also a matrix job to the integration test CI to run over prod6 (default, labeled as 2024-02-01) and prod5.

Note that the additional tests (e.g., file content comparison) are disabled for the non-default version (which is given in conftest.py through the model_version fixture. Reason for that is that we otherwise would have to keep track and add comparison tables in test/resources for all model versions.

Also solves a couple of issues to run simtools with the prod5 model version.

@GernotMaier GernotMaier self-assigned this Apr 19, 2024
@GernotMaier GernotMaier marked this pull request as ready for review April 21, 2024 10:19
Copy link
Collaborator

@VictorBarbosaMartins VictorBarbosaMartins left a comment

Choose a reason for hiding this comment

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

Hi @GernotMaier. I leave some comments here, but it was a bit hard to grasp some of the changes, as I am not very used to these configs. Let me know if my comments make sense. I will continue with the remaining PRs tomorrow

@@ -22,6 +22,9 @@ jobs:
container:
image: ghcr.io/gammasim/simtools-dev:latest
options: --user 0
strategy:
matrix:
type: ['2024-02-01', 'prod5']
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was expecting this to run over prod6 as well. Is there a reason why it is not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, 2024-02-01 is a prod6 prototype implementation. The model needs some more testing and some update, so better not to call it prod6.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tested now running the test for model_version="prod6" pytest --no-cov --model_version="prod6" "tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-print-array-elements_utm_to_ground_meta_in_yml]" and it works (the test also passes). I guess this is because we already have the model parameters for prod6 in the DB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. There is no difference between 2024-02-01 and prod6 (this is resolved in names.py)

Comment on lines +299 to +300
if model_version is not None and "MODEL_VERSION" in config:
config.update({"MODEL_VERSION": model_version})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not entirely sure these lines are doing what we expect. We prioritize here the parameter passed over the one in the config, but perhaps we gave the version in the config file because that is the one we expect it to work with, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This replaces the model_version for all tools which have a model_version set via the config file.

This is exactly what we want to do and allow us to run the integration test using a command line parameter (e.g., --model_version=prod5 to run all integration tests with prod6.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, so that means all integration tests should work with both versions? For instance, we don't have integration tests that should work only with prod5 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All tests should work with both versions (and they do). I do think we should aim that this is also true in the future.

The only difference we have to make if we check for output files. At this point, we only check for the version which is labeled in the configuration files (file naming is a bit complicated and adding this is probably not necessary)

@GernotMaier
Copy link
Contributor Author

@VictorBarbosaMartins - thanks a lot for the review. I've added back the missing warning. Let me know if it is fine now.

Copy link
Collaborator

@VictorBarbosaMartins VictorBarbosaMartins left a comment

Choose a reason for hiding this comment

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

Thanks @GernotMaier. I have only two minor questions, so I am already approving

@GernotMaier
Copy link
Contributor Author

Thank you again.

@GernotMaier GernotMaier merged commit 373fc52 into main Apr 23, 2024
17 checks passed
@GernotMaier GernotMaier deleted the prod5-completely-in-db branch April 23, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants