From b697bc1df7d733914ee554e03ec53439fec71a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Slowenski?= Date: Tue, 7 Jan 2025 15:22:59 +0100 Subject: [PATCH] docker test: Allow overriding the site_id Change-Id: Ieaf0849dde6c7f8467d4bc077c87c9eee870be82 --- tests/docker/test_docker.py | 5 +---- tests/testlib/docker.py | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/docker/test_docker.py b/tests/docker/test_docker.py index 1ec0231a2a5..4a24b48c563 100644 --- a/tests/docker/test_docker.py +++ b/tests/docker/test_docker.py @@ -89,10 +89,7 @@ def test_start_cmkadmin_password(client: docker.DockerClient) -> None: def test_start_custom_site_id(client: docker.DockerClient) -> None: - with CheckmkApp( - client, - environment={"CMK_SITE_ID": "xyz"}, - ) as cmk: + with CheckmkApp(client, site_id="xyz") as cmk: assert cmk.container.exec_run(["omd", "status"], user="xyz")[0] == 0 diff --git a/tests/testlib/docker.py b/tests/testlib/docker.py index be2743c4a73..2f7df6d4850 100644 --- a/tests/testlib/docker.py +++ b/tests/testlib/docker.py @@ -251,7 +251,9 @@ def __init__( self.site_id = site_id self.site_root = f"/omd/sites/{self.site_id}" self.version = version or version_from_env() - self.environment = {"CMK_PASSWORD": self.password} | (environment or {}) + self.environment = {"CMK_PASSWORD": self.password, "CMK_SITE_ID": self.site_id} | ( + environment or {} + ) self.is_update = is_update self.ports = ports self.volumes = volumes or []