From d224b54f52f977d6305e61def81231c1fab6811e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 1 Jun 2026 18:24:54 +0200 Subject: [PATCH] tests/e2e: fix proxxy tests failing due to in-use port --- tests/e2e/test_provider_proxy.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/e2e/test_provider_proxy.py b/tests/e2e/test_provider_proxy.py index ab1e697c7f..9de14e45a7 100644 --- a/tests/e2e/test_provider_proxy.py +++ b/tests/e2e/test_provider_proxy.py @@ -33,15 +33,16 @@ class TestProviderProxy(SeleniumTestCase): def start_proxy(self, outpost: Outpost): """Start proxy container based on outpost created""" - self.run_container( + container = self.run_container( image=self.get_container_image("ghcr.io/goauthentik/dev-proxy"), ports={ - "9000": "9000", + "9000": None, }, environment={ "AUTHENTIK_TOKEN": outpost.token.key, }, ) + self.outpost_port = container.ports["9000/tcp"][0]["HostPort"] @retry() @apply_blueprint( @@ -70,7 +71,7 @@ class TestProviderProxy(SeleniumTestCase): ), invalidation_flow=Flow.objects.get(slug="default-provider-invalidation-flow"), internal_host=f"http://{self.host}", - external_host="http://localhost:9000", + external_host=f"http://localhost{self.outpost_port}", ) # Ensure OAuth2 Params are set proxy.set_oauth_defaults() @@ -88,7 +89,7 @@ class TestProviderProxy(SeleniumTestCase): sleep(5) - self.driver.get("http://localhost:9000/api") + self.driver.get(f"http://localhost{self.outpost_port}/api") self.login() sleep(1) @@ -112,7 +113,7 @@ class TestProviderProxy(SeleniumTestCase): self.assertIsNotNone(jwt["sid"], "Missing 'sid' in JWT") self.assertIsNotNone(jwt["ak_proxy"], "Missing 'ak_proxy' in JWT") - self.driver.get("http://localhost:9000/outpost.goauthentik.io/sign_out") + self.driver.get(f"http://localhost{self.outpost_port}/outpost.goauthentik.io/sign_out") sleep(2) flow_executor = self.get_shadow_root("ak-flow-executor") @@ -155,7 +156,7 @@ class TestProviderProxy(SeleniumTestCase): ), invalidation_flow=Flow.objects.get(slug="default-provider-invalidation-flow"), internal_host=f"http://{self.host}", - external_host="http://localhost:9000", + external_host=f"http://localhost{self.outpost_port}", basic_auth_enabled=True, basic_auth_user_attribute="basic-username", basic_auth_password_attribute=attr, @@ -176,7 +177,7 @@ class TestProviderProxy(SeleniumTestCase): sleep(5) - self.driver.get("http://localhost:9000/api") + self.driver.get(f"http://localhost{self.outpost_port}/api") self.login() sleep(1) @@ -198,7 +199,7 @@ class TestProviderProxy(SeleniumTestCase): f"Authorization header mismatch at {self.driver.current_url}: {snippet}", ) - self.driver.get("http://localhost:9000/outpost.goauthentik.io/sign_out") + self.driver.get(f"http://localhost{self.outpost_port}/outpost.goauthentik.io/sign_out") sleep(2) flow_executor = self.get_shadow_root("ak-flow-executor") @@ -233,7 +234,7 @@ class TestProviderProxyConnect(ChannelsE2ETestCase): slug="default-provider-authorization-implicit-consent" ), internal_host="http://localhost", - external_host="http://localhost:9000", + external_host=f"http://localhost{self.outpost_port}", ) # Ensure OAuth2 Params are set proxy.set_oauth_defaults()