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

refactor ipam unit tests to maintain data #5163

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

ajtmccarty
Copy link
Contributor

@ajtmccarty ajtmccarty commented Dec 6, 2024

work from hackathon

adds a new query to reset a database to specific time by hard-deleting any changes after that time
updates some IPAM unit tests to use this new query to speed up some unit tests

would like to follow it up with a mutation that allows doing this, but will require some more work to support updating cached data correctly. made an issue for it here IFC-998

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Dec 6, 2024
@ajtmccarty ajtmccarty changed the title Ajtm 12052024 module fixtures 1.1 refactor ipam unit tests to maintain data Dec 6, 2024
Copy link

codspeed-hq bot commented Dec 6, 2024

CodSpeed Performance Report

Merging #5163 will not alter performance

Comparing ajtm-12052024-module-fixtures-1.1 (6d7f4a2) with release-1.1 (65cc50b)

Summary

✅ 10 untouched benchmarks

@ajtmccarty ajtmccarty marked this pull request as ready for review December 10, 2024 15:22
@ajtmccarty ajtmccarty requested a review from a team December 10, 2024 15:22


@pytest.fixture(scope="module")
async def default_branch(local_storage_dir: str, db: InfrahubDatabase) -> Branch:
Copy link
Contributor

@LucasG0 LucasG0 Dec 10, 2024

Choose a reason for hiding this comment

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

Should function body of these fixtures be factorized into new functions to avoid duplication of backend.tests.helpers original fixtures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion, I've made that change

@@ -0,0 +1,58 @@
from typing import Any
Copy link
Contributor

Choose a reason for hiding this comment

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

If this query is used only for testing purposes, I think it should be located under tests

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's tricky because the goal is to expose it to other systems during integration tests so from Infrahub point of view it's not just for testing

@ajtmccarty ajtmccarty merged commit 5f62aeb into release-1.1 Dec 11, 2024
31 of 32 checks passed
@ajtmccarty ajtmccarty deleted the ajtm-12052024-module-fixtures-1.1 branch December 11, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants