From 9da46b7621fd414a5139be1cb0d0b0929418d721 Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Tue, 11 Nov 2025 13:46:36 +0100 Subject: [PATCH 01/11] Split up test_remove_infotag --- server/tests/ioc/test_remove_infotag.db | 6 -- server/tests/ioc/test_remove_infotag_after.db | 3 + .../tests/ioc/test_remove_infotag_before.db | 4 + server/tests/test_bash_ioc.py | 76 +++++++++++-------- 4 files changed, 53 insertions(+), 36 deletions(-) delete mode 100644 server/tests/ioc/test_remove_infotag.db create mode 100644 server/tests/ioc/test_remove_infotag_after.db create mode 100644 server/tests/ioc/test_remove_infotag_before.db diff --git a/server/tests/ioc/test_remove_infotag.db b/server/tests/ioc/test_remove_infotag.db deleted file mode 100644 index 5ee53d2..0000000 --- a/server/tests/ioc/test_remove_infotag.db +++ /dev/null @@ -1,6 +0,0 @@ - -record(ai, "$(P)ai:test") { - alias("$(P)ai:test:alias") - info("test", "testing") - field(DESC, "testdesc") -} diff --git a/server/tests/ioc/test_remove_infotag_after.db b/server/tests/ioc/test_remove_infotag_after.db new file mode 100644 index 0000000..8ca3937 --- /dev/null +++ b/server/tests/ioc/test_remove_infotag_after.db @@ -0,0 +1,3 @@ + +record(ai, "$(P)ai:test") { +} diff --git a/server/tests/ioc/test_remove_infotag_before.db b/server/tests/ioc/test_remove_infotag_before.db new file mode 100644 index 0000000..795424d --- /dev/null +++ b/server/tests/ioc/test_remove_infotag_before.db @@ -0,0 +1,4 @@ + +record(ai, "$(P)ai:test") { + info("archive", "testing") +} diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index 238e3d4..962ea47 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -3,6 +3,7 @@ from pathlib import Path from typing import Optional +from channelfinder import ChannelFinderClient from testcontainers.compose import DockerCompose from docker import DockerClient @@ -46,43 +47,58 @@ def stream_logs(exec_result, cmd: str): log_thread.start() -class TestRemoveProperty: - def test_remove_property(self, setup_compose: DockerCompose) -> None: # noqa: F811 +def start_ioc(setup_compose: DockerCompose, db_file: Optional[str] = None) -> Container: + ioc_container = setup_compose.get_container("ioc1-1") + docker_client = DockerClient() + docker_ioc = docker_client.containers.get(ioc_container.ID) + docker_exec_new_command(docker_ioc, "./demo /ioc/st.cmd", env={"DB_FILE": db_file} if db_file else None) + return docker_ioc + + +def restart_ioc( + ioc_container: Container, cf_client: ChannelFinderClient, channel_name: str, new_db_file: str +) -> Container: + ioc_container.stop() + LOG.info("Waiting for channels to go inactive") + assert wait_for_sync( + cf_client, + lambda cf_client: check_channel_property(cf_client, name=channel_name, prop=INACTIVE_PROPERTY), + ) + ioc_container.start() + + docker_exec_new_command(ioc_container, "./demo /ioc/st.cmd", env={"DB_FILE": new_db_file}) + # Detach by not waiting for the thread to finish + + LOG.debug("ioc1-1 restart") + assert wait_for_sync(cf_client, lambda cf_client: check_channel_property(cf_client, name=channel_name)) + LOG.debug("ioc1-1 has restarted and synced") + + +class TestRemoveInfoTag: + def test_remove_infotag(self, setup_compose: DockerCompose) -> None: # noqa: F811 """ - Test that the setup in the docker compose creates channels in channelfinder + Test that removing an infotag from a record works """ - ioc_container = setup_compose.get_container("ioc1-1") - docker_client = DockerClient() - docker_ioc = docker_client.containers.get(ioc_container.ID) - docker_exec_new_command(docker_ioc, "./demo /ioc/st.cmd") - + test_channel_count = 1 + # Arrange + docker_ioc = start_ioc(setup_compose, db_file="test_remove_infotag_before.db") LOG.info("Waiting for channels to sync") - cf_client = create_client_and_wait(setup_compose, expected_channel_count=2) + cf_client = create_client_and_wait(setup_compose, expected_channel_count=test_channel_count) # Check ioc1-1 has ai:test with info tag "archive" LOG.debug('Checking ioc1-1 has ai:test with info tag "archive"') - channel = cf_client.find(name=DEFAULT_CHANNEL_NAME) - - def get_len_archive_properties(channel): - return len([prop for prop in channel[0]["properties"] if prop["name"] == "archive"]) - - assert get_len_archive_properties(channel) == 1 + channels = cf_client.find(name=DEFAULT_CHANNEL_NAME) + TEST_INFO_TAG = {"archive": "testing", "owner": "admin", "value": "Active", "channels": []} - docker_ioc.stop() - LOG.info("Waiting for channels to go inactive") - assert wait_for_sync( - cf_client, - lambda cf_client: check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME, prop=INACTIVE_PROPERTY), - ) - docker_ioc.start() + assert len(channels) == test_channel_count + assert TEST_INFO_TAG in channels[0]["properties"] - docker_exec_new_command(docker_ioc, "./demo /ioc/st.cmd", env={"DB_FILE": "test_remove_infotag.db"}) - # Detach by not waiting for the thread to finish + # Act + restart_ioc(docker_ioc, cf_client, DEFAULT_CHANNEL_NAME, "test_remove_infotag_after.db") - LOG.debug("ioc1-1 restart") - assert wait_for_sync(cf_client, lambda cf_client: check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME)) - LOG.debug("ioc1-1 has restarted and synced") + # Assert + channels = cf_client.find(name=DEFAULT_CHANNEL_NAME) + LOG.debug("archive channels: %s", channels) + assert len(channels) == test_channel_count + assert TEST_INFO_TAG not in channels[0]["properties"] - channel = cf_client.find(name=DEFAULT_CHANNEL_NAME) - LOG.debug("archive channel: %s", channel) - assert get_len_archive_properties(channel) == 0 From 45ddf49ceca4c2a01b5d4035237e184b5a650544 Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Wed, 12 Nov 2025 14:13:21 +0100 Subject: [PATCH 02/11] Extract BASE_IOC_CHANNEL_COUNT --- server/tests/client_checks.py | 3 +++ server/tests/test_bash_ioc.py | 1 + server/tests/test_multiple_recceiver.py | 8 ++++---- server/tests/test_single_ioc.py | 5 ++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/server/tests/client_checks.py b/server/tests/client_checks.py index a5bda1e..711a2b6 100644 --- a/server/tests/client_checks.py +++ b/server/tests/client_checks.py @@ -13,6 +13,9 @@ TIME_PERIOD_INCREMENT = 2 DEFAULT_CHANNEL_NAME = "IOC1-1:ai:test" +# 1 record and 1 alias +BASE_IOC_CHANNEL_COUNT = 2 + def channel_match(channel0, channel1, properties_to_match: list[str]): assert channel0["name"] == channel1["name"] diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index 962ea47..8ce6091 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -10,6 +10,7 @@ from docker.models.containers import Container from .client_checks import ( + BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, INACTIVE_PROPERTY, check_channel_property, diff --git a/server/tests/test_multiple_recceiver.py b/server/tests/test_multiple_recceiver.py index c6cbeb5..336099f 100644 --- a/server/tests/test_multiple_recceiver.py +++ b/server/tests/test_multiple_recceiver.py @@ -5,15 +5,15 @@ from channelfinder import ChannelFinderClient from testcontainers.compose import DockerCompose -from .client_checks import DEFAULT_CHANNEL_NAME, create_client_and_wait +from .client_checks import BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, create_client_and_wait from .docker import ComposeFixtureFactory LOG: logging.Logger = logging.getLogger(__name__) RECSYNC_RESTART_DELAY = 30 # Number of channels expected in the default setup -# 4 iocs, 1 channel 1 alias in archive.db -EXPECTED_DEFAULT_CHANNEL_COUNT = 4 * 2 +IOC_COUNT = 4 +EXPECTED_DEFAULT_CHANNEL_COUNT = IOC_COUNT * BASE_IOC_CHANNEL_COUNT setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-multi-recc.yml").return_fixture() @@ -43,7 +43,7 @@ def test_number_of_aliases_and_alais_property(self, cf_client: ChannelFinderClie def test_number_of_recordDesc_and_property(self, cf_client: ChannelFinderClient) -> None: channels = cf_client.find(property=[("recordDesc", "*")]) - assert len(channels) == 8 + assert len(channels) == EXPECTED_DEFAULT_CHANNEL_COUNT assert { "name": "recordDesc", "value": "testdesc", diff --git a/server/tests/test_single_ioc.py b/server/tests/test_single_ioc.py index 50a700c..bda1b3b 100644 --- a/server/tests/test_single_ioc.py +++ b/server/tests/test_single_ioc.py @@ -7,6 +7,7 @@ from testcontainers.compose import DockerCompose from .client_checks import ( + BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, INACTIVE_PROPERTY, channels_match, @@ -26,14 +27,12 @@ LOG: logging.Logger = logging.getLogger(__name__) -EXPECTED_DEFAULT_CHANNEL_COUNT = 2 - setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-single-ioc.yml").return_fixture() @pytest.fixture(scope="class") def cf_client(setup_compose: DockerCompose) -> ChannelFinderClient: # noqa: F811 - return create_client_and_wait(setup_compose, expected_channel_count=EXPECTED_DEFAULT_CHANNEL_COUNT) + return create_client_and_wait(setup_compose, expected_channel_count=BASE_IOC_CHANNEL_COUNT) class TestRestartIOC: From fcf6c08995e1eacf9d4faaada358df9ccbd6c0a4 Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Wed, 12 Nov 2025 14:16:05 +0100 Subject: [PATCH 03/11] Extract BASE_ALIAS_COUNT --- server/tests/client_checks.py | 1 + server/tests/test_multiple_recceiver.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/tests/client_checks.py b/server/tests/client_checks.py index 711a2b6..3d36f8b 100644 --- a/server/tests/client_checks.py +++ b/server/tests/client_checks.py @@ -14,6 +14,7 @@ DEFAULT_CHANNEL_NAME = "IOC1-1:ai:test" # 1 record and 1 alias +BASE_ALIAS_COUNT = 1 BASE_IOC_CHANNEL_COUNT = 2 diff --git a/server/tests/test_multiple_recceiver.py b/server/tests/test_multiple_recceiver.py index 336099f..c360e9c 100644 --- a/server/tests/test_multiple_recceiver.py +++ b/server/tests/test_multiple_recceiver.py @@ -5,7 +5,7 @@ from channelfinder import ChannelFinderClient from testcontainers.compose import DockerCompose -from .client_checks import BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, create_client_and_wait +from .client_checks import BASE_ALIAS_COUNT, BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, create_client_and_wait from .docker import ComposeFixtureFactory LOG: logging.Logger = logging.getLogger(__name__) @@ -32,7 +32,7 @@ def test_number_of_channels_and_channel_name(self, cf_client: ChannelFinderClien # Smoke Test Default Properties def test_number_of_aliases_and_alais_property(self, cf_client: ChannelFinderClient) -> None: channels = cf_client.find(property=[("alias", "*")]) - assert len(channels) == 4 + assert len(channels) == IOC_COUNT * BASE_ALIAS_COUNT assert channels[0]["name"] == DEFAULT_CHANNEL_NAME + ":alias" assert { "name": "alias", From 6e47a9e24f627ed7aa0f1ab764d23a8de5b859dd Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Mon, 10 Nov 2025 17:24:58 +0100 Subject: [PATCH 04/11] Add a test remove channel --- server/tests/ioc/test_remove_channel_after.db | 3 +++ .../tests/ioc/test_remove_channel_before.db | 6 +++++ server/tests/test_bash_ioc.py | 25 ++++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 server/tests/ioc/test_remove_channel_after.db create mode 100644 server/tests/ioc/test_remove_channel_before.db diff --git a/server/tests/ioc/test_remove_channel_after.db b/server/tests/ioc/test_remove_channel_after.db new file mode 100644 index 0000000..8ca3937 --- /dev/null +++ b/server/tests/ioc/test_remove_channel_after.db @@ -0,0 +1,3 @@ + +record(ai, "$(P)ai:test") { +} diff --git a/server/tests/ioc/test_remove_channel_before.db b/server/tests/ioc/test_remove_channel_before.db new file mode 100644 index 0000000..bf33b35 --- /dev/null +++ b/server/tests/ioc/test_remove_channel_before.db @@ -0,0 +1,6 @@ + +record(ai, "$(P)ai:test") { +} + +record(ai, "$(P)ai:test-2") { +} diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index 8ce6091..a7ad0b2 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -27,7 +27,7 @@ encoding="utf-8", ) -setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-bash-ioc.yml").return_fixture() +setup_compose = ComposeFixtureFactory(Path("docker") / Path("test-bash-ioc.yml")).return_fixture() def docker_exec_new_command(container: Container, command: str, env: Optional[dict] = None) -> None: @@ -103,3 +103,26 @@ def test_remove_infotag(self, setup_compose: DockerCompose) -> None: # noqa: F8 assert len(channels) == test_channel_count assert TEST_INFO_TAG not in channels[0]["properties"] + +class TestRemoveChannel: + def test_remove_channel(self, setup_compose: DockerCompose) -> None: # noqa: F811 + """ + Test that removing a channel works correctly. + """ + # Arrange + docker_ioc = start_ioc(setup_compose, db_file="test_remove_channel_before.db") + LOG.info("Waiting for channels to sync") + cf_client = create_client_and_wait(setup_compose, expected_channel_count=2) + + # Check ioc1-1 has base channel + LOG.debug("Checking ioc1-1 has both channels before removal") + check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME) + second_channel_name = f"{DEFAULT_CHANNEL_NAME}-2" + check_channel_property(cf_client, name=second_channel_name) + + # Act + restart_ioc(docker_ioc, cf_client, DEFAULT_CHANNEL_NAME, "test_remove_channel_after.db") + + # Assert + check_channel_property(cf_client, name=second_channel_name, prop=INACTIVE_PROPERTY) + check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME) From 4fa3bd23e103f4ca27baa6789171de51e06cb6c9 Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Mon, 10 Nov 2025 17:33:20 +0100 Subject: [PATCH 05/11] Test removing an alias --- server/tests/ioc/test_remove_alias_after.db | 6 ++++++ server/tests/test_bash_ioc.py | 24 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 server/tests/ioc/test_remove_alias_after.db diff --git a/server/tests/ioc/test_remove_alias_after.db b/server/tests/ioc/test_remove_alias_after.db new file mode 100644 index 0000000..9b44e57 --- /dev/null +++ b/server/tests/ioc/test_remove_alias_after.db @@ -0,0 +1,6 @@ + +record(ai, "$(P)ai:test") { + info("test", "testing") + info("archive", "MONITOR@1") + field(DESC, "testdesc") +} diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index a7ad0b2..cbdb050 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -126,3 +126,27 @@ def test_remove_channel(self, setup_compose: DockerCompose) -> None: # noqa: F8 # Assert check_channel_property(cf_client, name=second_channel_name, prop=INACTIVE_PROPERTY) check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME) + + +class TestRemoveAlias: + def test_remove_alias(self, setup_compose: DockerCompose) -> None: # noqa: F811 + """ + Test that removing an alias works correctly. + """ + # Arrange + docker_ioc = start_ioc(setup_compose) + LOG.info("Waiting for channels to sync") + cf_client = create_client_and_wait(setup_compose, expected_channel_count=BASE_IOC_CHANNEL_COUNT) + + # Check before alias status + LOG.debug('Checking ioc1-1 has ai:base_pv3 has an Active alias"') + channel_alias_name = f"{DEFAULT_CHANNEL_NAME}:alias" + check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME) + check_channel_property(cf_client, name=channel_alias_name) + + # Act + restart_ioc(docker_ioc, cf_client, DEFAULT_CHANNEL_NAME, "test_remove_alias_after.db") + + # Assert + check_channel_property(cf_client, name=DEFAULT_CHANNEL_NAME) + check_channel_property(cf_client, name=channel_alias_name, prop=INACTIVE_PROPERTY) From 682b580a6e1c223f8ca97d63c848615a5dc6933a Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Tue, 18 Nov 2025 07:25:55 +0100 Subject: [PATCH 06/11] fixup! Add a test remove channel --- server/tests/test_bash_ioc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index cbdb050..862bfa6 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -27,7 +27,7 @@ encoding="utf-8", ) -setup_compose = ComposeFixtureFactory(Path("docker") / Path("test-bash-ioc.yml")).return_fixture() +setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-bash-ioc.yml").return_fixture() def docker_exec_new_command(container: Container, command: str, env: Optional[dict] = None) -> None: From 393ef9bf3be39c785b5ef5ee4d9414135c8ada98 Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Tue, 18 Nov 2025 14:46:05 +0100 Subject: [PATCH 07/11] fixup! Split up test_remove_infotag --- server/tests/test_bash_ioc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index 862bfa6..a54db5d 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -89,7 +89,7 @@ def test_remove_infotag(self, setup_compose: DockerCompose) -> None: # noqa: F8 # Check ioc1-1 has ai:test with info tag "archive" LOG.debug('Checking ioc1-1 has ai:test with info tag "archive"') channels = cf_client.find(name=DEFAULT_CHANNEL_NAME) - TEST_INFO_TAG = {"archive": "testing", "owner": "admin", "value": "Active", "channels": []} + TEST_INFO_TAG = {"name": "archive", "owner": "admin", "value": "testing", "channels": []} assert len(channels) == test_channel_count assert TEST_INFO_TAG in channels[0]["properties"] From ca08bfea0a9544c9273ff0f6977d64906a51018f Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Tue, 25 Nov 2025 13:54:26 +0100 Subject: [PATCH 08/11] clearer count constants --- server/tests/client_checks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/tests/client_checks.py b/server/tests/client_checks.py index 3d36f8b..4e1f9f2 100644 --- a/server/tests/client_checks.py +++ b/server/tests/client_checks.py @@ -13,9 +13,9 @@ TIME_PERIOD_INCREMENT = 2 DEFAULT_CHANNEL_NAME = "IOC1-1:ai:test" -# 1 record and 1 alias BASE_ALIAS_COUNT = 1 -BASE_IOC_CHANNEL_COUNT = 2 +BASE_RECORD_COUNT = 1 +BASE_IOC_CHANNEL_COUNT = BASE_ALIAS_COUNT + BASE_RECORD_COUNT def channel_match(channel0, channel1, properties_to_match: list[str]): From 81bee97f8431d2089d9a4ed2232ec523607953fe Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Tue, 25 Nov 2025 13:56:20 +0100 Subject: [PATCH 09/11] Add assert message --- server/tests/test_bash_ioc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index a54db5d..fa6f131 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -71,8 +71,9 @@ def restart_ioc( # Detach by not waiting for the thread to finish LOG.debug("ioc1-1 restart") - assert wait_for_sync(cf_client, lambda cf_client: check_channel_property(cf_client, name=channel_name)) - LOG.debug("ioc1-1 has restarted and synced") + assert wait_for_sync(cf_client, lambda cf_client: check_channel_property(cf_client, name=channel_name)), ( + "ioc1-1 failed to restart and sync" + ) class TestRemoveInfoTag: From c95028c55283fb37a9807a45ca4097484a67dc27 Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Tue, 25 Nov 2025 13:56:55 +0100 Subject: [PATCH 10/11] remove unused ignore lint --- server/tests/test_bash_ioc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index fa6f131..c722b74 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -77,7 +77,7 @@ def restart_ioc( class TestRemoveInfoTag: - def test_remove_infotag(self, setup_compose: DockerCompose) -> None: # noqa: F811 + def test_remove_infotag(self, setup_compose: DockerCompose) -> None: """ Test that removing an infotag from a record works """ From 638e6fb9219c47daa71903ae9a568b6bdc16e7ee Mon Sep 17 00:00:00 2001 From: Sky Brewer Date: Wed, 26 Nov 2025 13:50:36 +0100 Subject: [PATCH 11/11] More descriptive assert on TEST_INFO_TAG --- server/tests/test_bash_ioc.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/tests/test_bash_ioc.py b/server/tests/test_bash_ioc.py index c722b74..c91c433 100644 --- a/server/tests/test_bash_ioc.py +++ b/server/tests/test_bash_ioc.py @@ -92,8 +92,9 @@ def test_remove_infotag(self, setup_compose: DockerCompose) -> None: channels = cf_client.find(name=DEFAULT_CHANNEL_NAME) TEST_INFO_TAG = {"name": "archive", "owner": "admin", "value": "testing", "channels": []} - assert len(channels) == test_channel_count - assert TEST_INFO_TAG in channels[0]["properties"] + assert any(TEST_INFO_TAG in ch["properties"] for ch in channels), ( + "Info tag 'archive' not found in channel before removal" + ) # Act restart_ioc(docker_ioc, cf_client, DEFAULT_CHANNEL_NAME, "test_remove_infotag_after.db") @@ -101,8 +102,9 @@ def test_remove_infotag(self, setup_compose: DockerCompose) -> None: # Assert channels = cf_client.find(name=DEFAULT_CHANNEL_NAME) LOG.debug("archive channels: %s", channels) - assert len(channels) == test_channel_count - assert TEST_INFO_TAG not in channels[0]["properties"] + assert all(TEST_INFO_TAG not in ch["properties"] for ch in channels), ( + "Info tag 'archive' still found in channel after removal" + ) class TestRemoveChannel: