From edb25e83be815388f27166aeeb32be10f56099b1 Mon Sep 17 00:00:00 2001 From: Stefano Bertelli Date: Tue, 31 Mar 2026 21:44:09 -0500 Subject: [PATCH] fix: increase SAML redirect timeout and add mock-saml health check SAML e2e tests were timing out in CI waiting for the IdP redirect. Increase Playwright wait_for_url timeout from 10s to 30s and add a health check on the mock-saml service container so it's ready before tests start. --- .forgejo/workflows/dev.yml | 5 +++++ tests/e2e/test_saml_login.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/dev.yml b/.forgejo/workflows/dev.yml index 4bff0a6..9846e14 100644 --- a/.forgejo/workflows/dev.yml +++ b/.forgejo/workflows/dev.yml @@ -40,6 +40,11 @@ jobs: SIMPLESAMLPHP_SP_ENTITY_ID: http://localhost:13003/auth/saml/test-saml/metadata SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE: http://localhost:13003/auth/saml/test-saml/callback SIMPLESAMLPHP_IDP_BASE_URL: http://mock-saml:8080/simplesaml/ + options: >- + --health-cmd "curl -sf http://localhost:8080/simplesaml/ || wget -q -O /dev/null http://localhost:8080/simplesaml/ || exit 1" + --health-interval 5s + --health-timeout 5s + --health-retries 10 env: CI: "true" WG_DATABASE_URL: postgresql+asyncpg://wiregui:wiregui@postgres/wiregui diff --git a/tests/e2e/test_saml_login.py b/tests/e2e/test_saml_login.py index 2942750..9d275cb 100644 --- a/tests/e2e/test_saml_login.py +++ b/tests/e2e/test_saml_login.py @@ -140,7 +140,7 @@ async def test_saml_redirect_to_idp(app_with_saml, page: Page): """Clicking SAML login redirects to the SimpleSAMLphp IdP login page.""" await page.goto(f"{SAML_APP_BASE}/auth/saml/test-saml") # Should redirect to the SimpleSAMLphp SSO service - await page.wait_for_url(f"**{MOCK_SAML_HOST}:8080/simplesaml/**", timeout=10_000) + await page.wait_for_url(f"**{MOCK_SAML_HOST}:8080/simplesaml/**", timeout=30_000) async def test_saml_sp_metadata_endpoint(app_with_saml, page: Page): @@ -155,7 +155,7 @@ async def test_saml_sp_metadata_endpoint(app_with_saml, page: Page): async def test_full_saml_login_flow(app_with_saml, page: Page): """Full SAML SSO flow: app → IdP login → callback → authenticated.""" await page.goto(f"{SAML_APP_BASE}/auth/saml/test-saml") - await page.wait_for_url(f"**{MOCK_SAML_HOST}:8080/simplesaml/**", timeout=10_000) + await page.wait_for_url(f"**{MOCK_SAML_HOST}:8080/simplesaml/**", timeout=30_000) # SimpleSAMLphp login form await page.locator("input[name='username']").fill("user1")