Skip to content

Commit

Permalink
Use different site IDs for the test modules again
Browse files Browse the repository at this point in the history
Since 7a55185 the test are executed with the same Site IDs. It looks
like this happened accidentally.

Change-Id: I831348bd153569e505bf9842eb2b39f88000b876
  • Loading branch information
LarsMichelsen committed Jul 11, 2024
1 parent e5e2332 commit 613b97f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/composition/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
from tests.composition.utils import bake_agent, get_cre_agent_path

site_factory = get_site_factory(prefix="comp_")
central_site_ids: list[str] = []


# The scope of the site fixtures is "module" to avoid that changing the site properties in a module
# may result in a test failing in another one
# may result in a test failing in another one. It also makes analyzing the job artifacts easier.
@pytest.fixture(name="central_site", scope="module")
def _central_site(request: pytest.FixtureRequest) -> Iterator[Site]:
# Using a different site for every module to avoid having issues when saving the results for the
# tests: if you call SiteFactory.save_results() twice with the same site_id, it will crash
# because the results are already there.
site_number = len([_ for _ in site_factory.sites if _.endswith("_central")])
site_number = len(central_site_ids)
central_site_ids.append(f"{site_number}_central")
yield from site_factory.get_test_site(
f"{site_number}_central",
description=request.node.name,
Expand Down

0 comments on commit 613b97f

Please sign in to comment.