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

Run CI tests against multiple versions #246

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Run CI tests against multiple versions #246

merged 1 commit into from
Jan 24, 2025

Conversation

LucasG0
Copy link
Contributor

@LucasG0 LucasG0 commented Jan 22, 2025

This PR enables CI tests to run against both latest infrahub server version and local version of stable/develop branch. Version is set using INFRAHUB_TESTING_IMAGE_VER environment variable (that we already use within python_testcontainers, and related logic should be simplified when this PR is cleaned/finalized).

Ideally, we would also like to have an ---infrahub-version cli argument for users convenience. Adding such a parameter requires to define pytest_adoption within a conftest.py file. However, having this conftest.py being loaded when a user runs a test requires either of the tests to be located in the same folder/subfolders of conftest.py - and it should not be the case. So, we need a more elaborated pytest plugin/hook mechanism that would deserve a dedicated PR.

Note that we may later want to run sdk tests at least against pinned major infrahub versions.

@github-actions github-actions bot added the group/ci Issue related to the CI pipeline label Jan 22, 2025
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 53.33333% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/testing/docker.py 53.33% 7 Missing ⚠️
@@            Coverage Diff             @@
##           stable     #246      +/-   ##
==========================================
- Coverage   70.28%   70.25%   -0.04%     
==========================================
  Files          82       82              
  Lines        7462     7477      +15     
  Branches     1385     1387       +2     
==========================================
+ Hits         5245     5253       +8     
- Misses       1842     1849       +7     
  Partials      375      375              
Flag Coverage Δ
integration-tests 22.52% <53.33%> (+0.06%) ⬆️
python-3.10 45.39% <0.00%> (-0.10%) ⬇️
python-3.11 45.39% <0.00%> (-0.10%) ⬇️
python-3.12 45.39% <0.00%> (-0.10%) ⬇️
python-3.13 45.39% <0.00%> (-0.10%) ⬇️
python-3.9 45.39% <0.00%> (-0.10%) ⬇️
python-filler-3.12 24.03% <0.00%> (-0.05%) ⬇️

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

Files with missing lines Coverage Δ
infrahub_sdk/testing/docker.py 68.00% <53.33%> (-22.00%) ⬇️

@LucasG0 LucasG0 force-pushed the lgu-ci-tests branch 25 times, most recently from f69736f to 212da2c Compare January 24, 2025 10:34
@LucasG0 LucasG0 changed the title WIP: Run CI tests against multiple versions Run CI tests against multiple versions Jan 24, 2025
@LucasG0 LucasG0 marked this pull request as ready for review January 24, 2025 10:48
@LucasG0 LucasG0 requested a review from a team January 24, 2025 10:48
INFRAHUB_VERSION = os.getenv("INFRAHUB_TESTING_IMAGE_VER", "latest")


def skip_version(min_infrahub_version: str | None = None, max_infrahub_version: str | None = None) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

When is it that this skip_version function gets used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whenever a SDK test should be running prior/since a given infrahub version. We do not have such tests for now, but should have some in the future

@LucasG0 LucasG0 merged commit c54a904 into stable Jan 24, 2025
15 checks passed
@LucasG0 LucasG0 deleted the lgu-ci-tests branch January 24, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/ci Issue related to the CI pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants