Compare commits

..

10 Commits

Author SHA1 Message Date
Chris Farhood d202ca42d6 fix(e2e): reference @main workflow after .github merge
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 17:43:44 +00:00
Chris Farhood 019366ff01 fix(e2e): use LoadBalancer IP for HEADLAMP_URL
Previous approaches (port-forward to Service/Pod) failed with 'connection
refused' — the runner cannot tunnel to pod IPs through the API server.

Switch to LoadBalancer service type:
- After rollout, poll kubectl get svc for status.loadBalancer.ingress[0].ip
- Once assigned, poll http://<lb-ip>:80 until reachable
- Write HEADLAMP_URL=http://<lb-ip>:80 to .env.e2e

The runner pod (in the cluster) can reach LoadBalancer IPs assigned
by the cloud controller or metallb.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 17:15:33 +00:00
Chris Farhood 9cc1ca7b91 fix(e2e): use NodePort instead of cluster-internal DNS for HEADLAMP_URL
Previous attempt used kubectl port-forward to a Service, which failed
with 'connection refused' — the API server could not reach pod IPs.

Switch to NodePort (30080) service type and use the node's InternalIP
for HEADLAMP_URL, reachable from the GitHub Actions runner pod.

- Change Service type from ClusterIP to NodePort with nodePort: 30080
- After rollout, get node InternalIP via kubectl get nodes
- Poll http://<node-ip>:30080 until reachable
- Write HEADLAMP_URL=http://<node-ip>:30080 to .env.e2e
- Remove port-forward leftover cleanup from teardown script

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 17:10:54 +00:00
Chris Farhood f1dd09c155 fix(e2e): use localhost via kubectl port-forward for HEADLAMP_URL
The browser runs outside the cluster and cannot resolve
headlamp-e2e.${E2E_NAMESPACE}.svc.cluster.local DNS names.

- Start kubectl port-forward in background after service rollout
- Poll until localhost:4466 is reachable before writing .env.e2e
- Write HEADLAMP_URL=http://localhost:4466 so Playwright browser can connect
- teardown: kill port-forward processes with pkill

Fixes PRI-752.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 17:03:13 +00:00
Chris Farhood 8b90535ec7 Merge branch 'gandalf/e2e-fix-kube-vip' into gandalf/e2e-fix-kube-vip-local 2026-05-05 14:07:33 +00:00
Chris Farhood 00df4a829f fix(e2e): add e2e script to package.json
Missing script caused ERR_PNPM_NO_SCRIPT in CI E2E step.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 14:06:49 +00:00
Chris Farhood 869d1c7225 fix(e2e): use .first() to handle strict mode violations with multiple headings (PRI-700)
The kube-vip page has both 'kube-vip — Overview' (h1) and 'kube-vip Not Detected' (h2) headings.
getByRole('heading', { name: /kube.vip/i }) resolves to both in strict mode. Using .first()
to match the first one (the overview heading) instead.
2026-05-05 13:55:54 +00:00
Chris Farhood 87798ecbe1 fix(e2e): add e2e npm script for reusable workflow (PRI-700)
The plugin-e2e.yaml reusable workflow runs 'npm run e2e' to execute
Playwright tests. This script was missing from the kube-vip plugin.
2026-05-05 13:49:56 +00:00
Chris Farhood 097ac48ecf feat(e2e): add @playwright/test to devDependencies
Required by PRI-700 / PRI-699: E2E test infra needs @playwright/test
as a direct devDependency.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 13:33:10 +00:00
Chris Farhood ced7d57895 feat(e2e): consolidate E2E test infrastructure + add waitForSidebar (PRI-700)
- Adds e2e/auth.setup.ts, e2e/kube-vip.spec.ts with waitForSidebar helper
- Adds playwright.config.ts, scripts/deploy-e2e-headlamp.sh, scripts/teardown-e2e-headlamp.sh
- Adds .github/workflows/e2e.yaml
- Fixes plugin settings test to wait for list before searching
2026-05-05 13:07:55 +00:00
7 changed files with 50 additions and 20 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ concurrency:
jobs:
e2e:
uses: privilegedescalation/.github/.github/workflows/plugin-e2e.yaml@hugh/add-pnpm-support-plugin-e2e
uses: privilegedescalation/.github/.github/workflows/plugin-e2e.yaml@main
with:
node-version: '22'
headlamp-version: v0.40.1
-6
View File
@@ -5,9 +5,3 @@ dist/
.env
.env.local
.eslintcache
# E2E
e2e/.auth/
.env.e2e
playwright-report/
test-results/
+3 -2
View File
@@ -24,14 +24,14 @@ test.describe('kube-vip plugin smoke tests', () => {
await page.waitForLoadState('networkidle');
await expect(page).toHaveURL(/kube-vip/);
await expect(page.getByRole('heading', { name: /kube.vip/i })).toBeVisible();
await expect(page.getByRole('heading', { name: /kube.vip/i }).first()).toBeVisible();
});
test('kube-vip page renders content', async ({ page }) => {
await page.goto('/c/main/kube-vip');
await waitForSidebar(page);
await expect(page.getByRole('heading', { name: /kube.vip/i })).toBeVisible({
await expect(page.getByRole('heading', { name: /kube.vip/i }).first()).toBeVisible({
timeout: 15_000,
});
@@ -43,6 +43,7 @@ test.describe('kube-vip plugin smoke tests', () => {
test('plugin settings page shows kube-vip plugin entry', async ({ page }) => {
await page.goto('/settings/plugins');
await page.waitForLoadState('networkidle');
await page.waitForSelector('table, [class*="PluginList"], [class*="plugin"]', { timeout: 10_000 }).catch(() => {});
const pluginEntry = page.locator('text=/kube.vip/i').first();
await expect(pluginEntry).toBeVisible({ timeout: 30_000 });
+3 -4
View File
@@ -24,8 +24,7 @@
"format:check": "prettier --check src/",
"test": "vitest run",
"test:watch": "vitest",
"e2e": "playwright test",
"e2e:headed": "playwright test --headed"
"e2e": "playwright test"
},
"peerDependencies": {
"react": "^18.0.0",
@@ -41,6 +40,7 @@
"@headlamp-k8s/eslint-config": "^0.6.0",
"@kinvolk/headlamp-plugin": "^0.13.0",
"@mui/material": "^5.15.14",
"@playwright/test": "^1.59.1",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
@@ -54,7 +54,6 @@
"react-dom": "^18.3.1",
"react-router-dom": "^5.3.0",
"typescript": "~5.6.2",
"vitest": "^3.2.4",
"@playwright/test": "^1.58.2"
"vitest": "^3.2.4"
}
}
+3 -3
View File
@@ -18,7 +18,7 @@ importers:
specifier: ^5.15.14
version: 5.18.0(@emotion/react@11.14.0(@types/react@18.3.28)(react@18.3.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@18.3.28)(react@18.3.1))(@types/react@18.3.28)(react@18.3.1))(@types/react@18.3.28)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@playwright/test':
specifier: ^1.58.2
specifier: ^1.59.1
version: 1.59.1
'@testing-library/jest-dom':
specifier: ^6.4.8
@@ -6212,7 +6212,7 @@ snapshots:
material-react-table: 2.13.3(93149b7a28d7dcf9399e2d03ebc8c990)
monaco-editor: 0.52.2
msw: 2.4.9(typescript@5.6.2)
msw-storybook-addon: 2.0.3(msw@2.4.9(typescript@5.6.3))
msw-storybook-addon: 2.0.3(msw@2.4.9(typescript@5.6.2))
notistack: 3.0.2(csstype@3.2.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
path-browserify: 1.0.1
prettier: 2.8.8
@@ -10113,7 +10113,7 @@ snapshots:
ms@2.1.3: {}
msw-storybook-addon@2.0.3(msw@2.4.9(typescript@5.6.3)):
msw-storybook-addon@2.0.3(msw@2.4.9(typescript@5.6.2)):
dependencies:
is-node-process: 1.2.0
msw: 2.4.9(typescript@5.6.2)
+39 -3
View File
@@ -118,7 +118,7 @@ metadata:
app.kubernetes.io/name: headlamp
app.kubernetes.io/instance: ${E2E_RELEASE}
spec:
type: ClusterIP
type: LoadBalancer
selector:
app.kubernetes.io/name: headlamp
app.kubernetes.io/instance: ${E2E_RELEASE}
@@ -150,15 +150,51 @@ done
echo ""
echo "E2E Headlamp is ready at: ${SVC_URL}"
echo ""
echo "Getting LoadBalancer IP for Headlamp service..."
LB_IP=""
ATTEMPTS=0
MAX_ATTEMPTS=24
while [ -z "${LB_IP}" ] || [ "${LB_IP}" = "<pending>" ]; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -ge "$MAX_ATTEMPTS" ]; then
echo "ERROR: LoadBalancer IP not assigned after $((MAX_ATTEMPTS * 5))s" >&2
exit 1
fi
LB_IP=$(kubectl get svc "${E2E_RELEASE}" -n "$E2E_NAMESPACE" -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || echo "")
if [ -z "${LB_IP}" ] || [ "${LB_IP}" = "<pending>" ]; then
LB_IP=""
echo " [${ATTEMPTS}/${MAX_ATTEMPTS}] LoadBalancer IP not yet assigned, retrying in 5s..."
sleep 5
fi
done
echo " LoadBalancer IP: ${LB_IP}"
echo ""
echo "Waiting for Headlamp at http://${LB_IP}:80 to be reachable..."
ATTEMPTS=0
MAX_ATTEMPTS=24
until curl -sf --max-time 5 "http://${LB_IP}:80" -o /dev/null 2>/dev/null; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -ge "$MAX_ATTEMPTS" ]; then
echo "ERROR: http://${LB_IP}:80 not reachable after $((MAX_ATTEMPTS * 5))s" >&2
exit 1
fi
echo " [${ATTEMPTS}/${MAX_ATTEMPTS}] LoadBalancer not yet reachable, retrying in 5s..."
sleep 5
done
echo ""
echo "Headlamp is ready at http://${LB_IP}:80"
echo ""
echo "Creating service account token for E2E auth..."
kubectl create serviceaccount headlamp-e2e-test -n "$E2E_NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
TOKEN=$(kubectl create token headlamp-e2e-test -n "$E2E_NAMESPACE" --duration=1h 2>/dev/null || echo "")
if [ -n "$TOKEN" ]; then
echo "HEADLAMP_URL=${SVC_URL}" > "$REPO_ROOT/.env.e2e"
echo "HEADLAMP_URL=http://${LB_IP}:80" > "$REPO_ROOT/.env.e2e"
echo "HEADLAMP_TOKEN=${TOKEN}" >> "$REPO_ROOT/.env.e2e"
echo "Wrote .env.e2e with HEADLAMP_URL and HEADLAMP_TOKEN"
echo "Wrote .env.e2e with HEADLAMP_URL=http://${LB_IP}:80 and HEADLAMP_TOKEN"
else
echo " WARNING: Could not generate token."
fi
+1 -1
View File
@@ -22,7 +22,7 @@ echo "Cleaning up test service account..."
kubectl delete serviceaccount headlamp-e2e-test -n "$E2E_NAMESPACE" --ignore-not-found
if [ -f "$REPO_ROOT/.env.e2e" ]; then
rm "$REPO_ROOT/.env.e2e"
rm -f "$REPO_ROOT/.env.e2e"
echo "Removed .env.e2e"
fi