fix(e2e): clean-delete existing deployment before redeploy for guaranteed fresh pod #113
Reference in New Issue
Block a user
Delete Branch "fix/e2e-clean-deploy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
E2E runs were failing with auth setup timeout even when no concurrent runs were present (PR#110 run #23500542756):
Root cause:
deploy-e2e-headlamp.shusedkubectl applyto update the Deployment/Service/ServiceAccount, butkubectl applydoesn't trigger a rollout if the pod spec is unchanged between runs. A degraded pod from a prior run (e.g., one that didn't tear down cleanly due to a cancelled or failed job) would keep serving in an inconsistent state. The fresh ConfigMap was mounted but the pod itself was stale.Changes
scripts/deploy-e2e-headlamp.shDelete Deployment, Service, and ServiceAccount (with
--wait) before applying new manifests. This guarantees a fresh pod on every run regardless of what was left behind by prior runs.e2e/auth.setup.tsAdd explicit
waitFor({ state: 'visible', timeout: 15_000 })before the "use a token" button click. This causes failures to surface at 15 s with a clear locator message rather than silently timing out at the global 60 s limit — which made diagnosing the root cause harder.Impact
Unblocks PR#110 (
ci/e2e-concurrency-guard) — once this merges, PR#110 can rebase on main and its E2E run should pass cleanly.cc @cpfarhood
QA Review Summary
PR #113 — E2E clean-deploy fix
Test Results
Changes Reviewed
1.
e2e/auth.setup.ts(lines 45-52)waitFor({ state: 'visible', timeout: 15_000 })before clicking the "use a token" button2.
scripts/deploy-e2e-headlamp.sh(lines 61-69)--wait) before applying new manifestskubectl applyonly patches in-place and a degraded pod keeps servingMinor Observation
--waitflag unlike Deployment and Service. This is a minor inconsistency but ServiceAccount deletion is typically fast and shouldn't cause issues.Verification
QA Approval: ✅ Approved
Clean fix. Root cause correctly identified — apply-without-delete leaves stale pods when the spec hasn't changed. Delete-before-apply with --ignore-not-found --wait is the right pattern. The explicit waitFor in auth.setup.ts is a good diagnostic improvement. Approved.
QA Review: PR #113
Tested: vitest (100 tests PASS), tsc (PASS)
Changes reviewed:
e2e/auth.setup.ts:48-52: Added explicit 15s wait before clicking "use a token" button. Good — surfaces failures at 15s instead of 60s.scripts/deploy-e2e-headlamp.sh:61-67: Deletes existing Deployment, Service, ServiceAccount before applying new manifests. Fixes root cause:kubectl applydoesn't trigger rollout when pod spec is unchanged, leaving stale pods from prior runs.Edge cases considered:
--ignore-not-foundflags handle first-run scenarios cleanly--waitflag ensures resources are fully removed before proceedingRegression check: No existing behavior broken — this only affects E2E deployment script.
Verdict: QA APPROVED