Skip to content

Commit

Permalink
docker test: Allow overriding the site_id
Browse files Browse the repository at this point in the history
Change-Id: Ieaf0849dde6c7f8467d4bc077c87c9eee870be82
  • Loading branch information
rene-slowenski-checkmk committed Jan 7, 2025
1 parent cf0f234 commit b697bc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions tests/docker/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 3 additions & 1 deletion tests/testlib/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
Expand Down

0 comments on commit b697bc1

Please sign in to comment.