From 175d3ec6a2ddb9d2f4bf758c8e8ac615ce711ba4 Mon Sep 17 00:00:00 2001 From: Gandalf the Greybeard Date: Tue, 24 Mar 2026 16:40:30 +0000 Subject: [PATCH] fix(e2e): clean-delete existing deployment before redeploy for guaranteed fresh pod MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kubectl apply without prior deletion patches in place: if the pod spec is unchanged between runs, no rollout is triggered and a potentially degraded pod from a prior run keeps serving. This caused the auth.setup.ts timeout (waiting for the "use a token" button) even when no concurrent runs were present — the headlamp-e2e pod was in an inconsistent state from a previous run that didn't tear down cleanly. Changes: - deploy-e2e-headlamp.sh: delete Deployment, Service, and ServiceAccount (with --wait) before applying, guaranteeing a fresh pod each run - auth.setup.ts: add explicit waitFor({ state: 'visible', timeout: 15_000 }) before the "use a token" button click, so failures surface at 15 s with a clear locator error rather than silently timing out at 60 s Fixes the pre-existing infra issue blocking PR#110. Co-Authored-By: Claude Sonnet 4.6 --- e2e/auth.setup.ts | 8 ++++++-- scripts/deploy-e2e-headlamp.sh | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/e2e/auth.setup.ts b/e2e/auth.setup.ts index 2bc6d1d..2b4ecb9 100644 --- a/e2e/auth.setup.ts +++ b/e2e/auth.setup.ts @@ -45,8 +45,12 @@ async function authenticateWithToken(page: Page, token: string): Promise { await page.waitForURL(/\/(login|token)$/); if (page.url().includes('/login')) { - // OIDC login page — click "use a token" to reach token auth - await page.getByRole('button', { name: /use a token/i }).click(); + // OIDC login page — click "use a token" to reach token auth. + // Wait explicitly before clicking so failures surface at 15 s + // with a clear message rather than silently timing out at 60 s. + const useTokenBtn = page.getByRole('button', { name: /use a token/i }); + await useTokenBtn.waitFor({ state: 'visible', timeout: 15_000 }); + await useTokenBtn.click(); await page.waitForURL('**/token'); } diff --git a/scripts/deploy-e2e-headlamp.sh b/scripts/deploy-e2e-headlamp.sh index 6186d5a..1b19583 100755 --- a/scripts/deploy-e2e-headlamp.sh +++ b/scripts/deploy-e2e-headlamp.sh @@ -58,6 +58,16 @@ kubectl create configmap headlamp-polaris-plugin \ --from-file="$DIST_DIR" \ --from-file=package.json="$REPO_ROOT/package.json" +# --- Tear down any existing E2E deployment for a clean start --- +# kubectl apply without prior deletion only patches in-place: if the pod spec is +# unchanged between runs, no new rollout is triggered and a degraded pod keeps +# serving. Delete first to guarantee a fresh pod regardless of prior state. +echo "" +echo "Removing any existing E2E deployment (clean-start)..." +kubectl delete deployment "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not-found --wait +kubectl delete service "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not-found --wait +kubectl delete serviceaccount "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not-found --wait + # --- Deploy Headlamp via kubectl apply --- echo "" echo "Deploying Headlamp E2E instance..." -- 2.52.0