From ab120c8f75bec156e9a139cc2f3892be3244f5a7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 22 Oct 2024 23:22:50 +0200 Subject: [PATCH] tests/e2e: manually remove containers for better debugging Signed-off-by: Jens Langhammer --- tests/e2e/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/e2e/utils.py b/tests/e2e/utils.py index e118b0d110d5..d4a27334e92b 100644 --- a/tests/e2e/utils.py +++ b/tests/e2e/utils.py @@ -112,7 +112,6 @@ def run_container(self, **specs: dict[str, Any]) -> Container: specs["network"] = self.__network.name specs["labels"] = self.docker_labels specs["detach"] = True - specs["auto_remove"] = True if hasattr(self, "live_server_url"): specs.setdefault("environment", {}) specs["environment"]["AUTHENTIK_HOST"] = self.live_server_url @@ -136,7 +135,7 @@ def output_container_logs(self, container: Container | None = None): print("::endgroup::") def tearDown(self): - containers = self.docker_client.containers.list( + containers: list[Container] = self.docker_client.containers.list( filters={"label": ",".join(f"{x}={y}" for x, y in self.docker_labels.items())} ) for container in containers: @@ -145,6 +144,10 @@ def tearDown(self): container.kill() except DockerException: pass + try: + container.remove(force=True) + except DockerException: + pass self.__network.remove()