Compare commits

..

3 Commits

Author SHA1 Message Date
Chris Farhood 7d56a903c8 fix(e2e): add waitForSidebar helper and networkidle waits for reliability
Add waitForSidebar helper function with explicit sidebar visibility wait
and networkidle state to ensure page is fully loaded before assertions.
This addresses flaky E2E tests where elements were not consistently
found due to timing issues during page transitions.
2026-05-05 06:50:21 +00:00
Chris Farhood ef7183a2d6 Fix E2E workflow: use pnpm-capable reusable workflow branch
The reusable plugin-e2e.yaml@main lacks pnpm support. Switching to
the PR branch that has pnpm detector, Corepack setup, and pnpm commands.

Will revert to @main once PR #141 merges.

- PRI-619 E2E fix

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 06:10:20 +00:00
Chris Farhood 6d48470691 Add E2E test infrastructure for tns-csi plugin
Scaffolded via e2e-scaffold.sh (proactive improvement).
- playwright.config.ts, e2e/auth.setup.ts, e2e/tns-csi.spec.ts
- scripts/deploy-e2e-headlamp.sh, scripts/teardown-e2e-headlamp.sh
- .github/workflows/e2e.yaml uses reusable workflow
- @playwright/test ^1.58.2 devDep

- PRI-639

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-05 05:14:51 +00:00
12 changed files with 563 additions and 563 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ concurrency:
jobs: jobs:
e2e: e2e:
uses: privilegedescalation/.github/.github/workflows/plugin-e2e.yaml@main uses: privilegedescalation/.github/.github/workflows/plugin-e2e.yaml@hugh/add-pnpm-support-plugin-e2e
with: with:
node-version: '22' node-version: '22'
headlamp-version: v0.40.1 headlamp-version: v0.40.1
+6
View File
@@ -5,3 +5,9 @@ dist/
.env .env
.env.local .env.local
.eslintcache .eslintcache
# E2E
e2e/.auth/
.env.e2e
playwright-report/
test-results/
-4
View File
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Changed
- **docs: namespace references** — Updated all documentation, README, and ArtifactHub metadata to explicitly reference the `headlamp` namespace instead of generic "controller pod" language. RBAC examples now clearly scope `pods/proxy` access to `kube-system` where the tns-csi controller runs.
## [1.0.0] - 2026-03-24 ## [1.0.0] - 2026-03-24
### Added ### Added
+4 -8
View File
@@ -63,12 +63,12 @@ config:
pluginsManager: pluginsManager:
sources: sources:
- name: tns-csi - name: tns-csi
url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
``` ```
## RBAC / Security Setup ## RBAC / Security Setup
The plugin reads from the Kubernetes API and the tns-csi controller pod's Prometheus endpoint (deployed in `kube-system`). The Benchmark page additionally creates and deletes Jobs and PVCs. The plugin reads from the Kubernetes API and the tns-csi controller pod's Prometheus endpoint. The Benchmark page additionally creates and deletes Jobs and PVCs.
### Minimal read-only permissions ### Minimal read-only permissions
@@ -90,10 +90,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods/log"] resources: ["pods/log"]
verbs: ["get"] verbs: ["get"]
- apiGroups: [""]
resources: ["pods/proxy"]
verbs: ["get"]
resourceNames: ["pods"]
``` ```
### Additional permissions for Benchmark page ### Additional permissions for Benchmark page
@@ -109,13 +105,13 @@ rules:
### Metrics access ### Metrics access
The plugin fetches Prometheus metrics from the tns-csi controller pod via the Kubernetes pod proxy sub-resource in `kube-system`. Grant `get` on `pods/proxy` scoped to `kube-system`: The plugin fetches Prometheus metrics from the tns-csi controller pod via the Kubernetes pod proxy sub-resource. Grant `get` on `pods/proxy` in `kube-system`:
```yaml ```yaml
- apiGroups: [""] - apiGroups: [""]
resources: ["pods/proxy"] resources: ["pods/proxy"]
verbs: ["get"] verbs: ["get"]
# Scope to kube-system where the tns-csi controller runs # Optionally scope to the controller pod namespace
``` ```
Apply the role and bind it to your Headlamp service account with a ClusterRoleBinding. Apply the role and bind it to your Headlamp service account with a ClusterRoleBinding.
+1 -1
View File
@@ -67,7 +67,7 @@ Welcome to the Headlamp TNS-CSI Plugin documentation.
## External Links ## External Links
- **[GitHub Repository](https://github.com/privilegedescalation/headlamp-tns-csi-plugin)** - **[GitHub Repository](https://github.com/privilegedescalation/headlamp-tns-csi-plugin)**
- **[Artifact Hub](https://artifacthub.io/packages/headlamp/tns-csi/headlamp-tns-csi-plugin)** - **[Artifact Hub](https://artifacthub.io/packages/headlamp/headlamp-tns-csi-plugin/headlamp-tns-csi-plugin)**
- **[tns-csi Driver](https://github.com/fenio/tns-csi)** - **[tns-csi Driver](https://github.com/fenio/tns-csi)**
- **[kbench](https://github.com/longhorn/kbench)** - **[kbench](https://github.com/longhorn/kbench)**
- **[Headlamp](https://headlamp.dev/)** - **[Headlamp](https://headlamp.dev/)**
+1 -1
View File
@@ -28,7 +28,7 @@ The TNS-CSI plugin is a single-page React application bundled as a Headlamp plug
│ HTTPS │ HTTPS
┌─────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────┐
│ Headlamp Pod (headlamp namespace) │ │ Headlamp Pod (kube-system) │
│ │ │ │
│ Headlamp UI server + API proxy │ │ Headlamp UI server + API proxy │
│ (forwards requests using service account token │ │ (forwards requests using service account token │
+3 -3
View File
@@ -13,7 +13,7 @@ helm install headlamp headlamp/headlamp \
--create-namespace \ --create-namespace \
--set config.pluginsDir=/headlamp/plugins \ --set config.pluginsDir=/headlamp/plugins \
--set pluginsManager.sources[0].name=tns-csi \ --set pluginsManager.sources[0].name=tns-csi \
--set pluginsManager.sources[0].url=https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz --set pluginsManager.sources[0].url=https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
``` ```
## Complete values.yaml Example ## Complete values.yaml Example
@@ -27,7 +27,7 @@ config:
pluginsManager: pluginsManager:
sources: sources:
- name: tns-csi - name: tns-csi
url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
serviceAccount: serviceAccount:
name: headlamp name: headlamp
@@ -81,7 +81,7 @@ spec:
pluginsManager: pluginsManager:
sources: sources:
- name: tns-csi - name: tns-csi
url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
``` ```
## RBAC Manifest (Apply Separately) ## RBAC Manifest (Apply Separately)
+10 -7
View File
@@ -22,7 +22,7 @@ config:
pluginsManager: pluginsManager:
sources: sources:
- name: tns-csi - name: tns-csi
url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
``` ```
**Via FluxCD HelmRelease:** **Via FluxCD HelmRelease:**
@@ -46,7 +46,7 @@ spec:
pluginsManager: pluginsManager:
sources: sources:
- name: tns-csi - name: tns-csi
url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
``` ```
### Method 2: Manual Tarball Install ### Method 2: Manual Tarball Install
@@ -55,10 +55,13 @@ Download and extract the plugin directly:
```bash ```bash
# Download the release tarball # Download the release tarball
wget https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz wget https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
# Verify the checksum
echo "14a3e8c13d0b894a41aa1cfccbcb1f6af09dcbb8fd95c7040a540987ea2096a7 tns-csi-0.2.4.tar.gz" | sha256sum --check
# Extract into your Headlamp plugins directory # Extract into your Headlamp plugins directory
tar xzf tns-csi-1.0.0.tar.gz -C /headlamp/plugins/ tar xzf tns-csi-0.2.4.tar.gz -C /headlamp/plugins/
``` ```
The plugin directory should appear as `/headlamp/plugins/tns-csi/`. The plugin directory should appear as `/headlamp/plugins/tns-csi/`.
@@ -78,7 +81,7 @@ initContainers:
- -c - -c
- | - |
wget -O /tmp/plugin.tar.gz \ wget -O /tmp/plugin.tar.gz \
https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
tar xzf /tmp/plugin.tar.gz -C /headlamp/plugins/ tar xzf /tmp/plugin.tar.gz -C /headlamp/plugins/
volumeMounts: volumeMounts:
- name: plugins - name: plugins
@@ -95,10 +98,10 @@ cd headlamp-tns-csi-plugin
npm install npm install
npm run build npm run build
npm run package npm run package
# Produces tns-csi-<version>.tar.gz # Produces tns-csi-0.2.4.tar.gz
# Extract to your Headlamp plugins directory # Extract to your Headlamp plugins directory
tar xzf tns-csi-<version>.tar.gz -C /headlamp/plugins/ tar xzf tns-csi-0.2.4.tar.gz -C /headlamp/plugins/
``` ```
Or use `headlamp-plugin extract` for automatic placement: Or use `headlamp-plugin extract` for automatic placement:
+1 -1
View File
@@ -28,7 +28,7 @@ config:
pluginsManager: pluginsManager:
sources: sources:
- name: tns-csi - name: tns-csi
url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v1.0.0/tns-csi-1.0.0.tar.gz url: https://github.com/privilegedescalation/headlamp-tns-csi-plugin/releases/download/v0.2.4/tns-csi-0.2.4.tar.gz
``` ```
Then upgrade your Headlamp release: Then upgrade your Headlamp release:
+2 -3
View File
@@ -24,14 +24,14 @@ test.describe('TNS CSI plugin smoke tests', () => {
await page.waitForLoadState('networkidle'); await page.waitForLoadState('networkidle');
await expect(page).toHaveURL(/tns-csi/); await expect(page).toHaveURL(/tns-csi/);
await expect(page.getByRole('heading', { name: /TNS.CSI/i })).toBeVisible(); await expect(page.getByRole('heading', { name: /tns.csi.*overview/i })).toBeVisible();
}); });
test('TNS CSI page renders content', async ({ page }) => { test('TNS CSI page renders content', async ({ page }) => {
await page.goto('/c/main/tns-csi'); await page.goto('/c/main/tns-csi');
await waitForSidebar(page); await waitForSidebar(page);
await expect(page.getByRole('heading', { name: /TNS.CSI/i })).toBeVisible({ await expect(page.getByRole('heading', { name: /tns.csi.*overview/i })).toBeVisible({
timeout: 15_000, timeout: 15_000,
}); });
@@ -43,7 +43,6 @@ test.describe('TNS CSI plugin smoke tests', () => {
test('plugin settings page shows TNS CSI plugin entry', async ({ page }) => { test('plugin settings page shows TNS CSI plugin entry', async ({ page }) => {
await page.goto('/settings/plugins'); await page.goto('/settings/plugins');
await page.waitForLoadState('networkidle'); await page.waitForLoadState('networkidle');
await page.waitForSelector('[class*="PluginList"], [class*="plugins"], table, list', { timeout: 10_000 }).catch(() => {});
const pluginEntry = page.locator('text=/tns.csi/i').first(); const pluginEntry = page.locator('text=/tns.csi/i').first();
await expect(pluginEntry).toBeVisible({ timeout: 30_000 }); await expect(pluginEntry).toBeVisible({ timeout: 30_000 });
+4 -4
View File
@@ -24,7 +24,8 @@
"format:check": "prettier --check src/", "format:check": "prettier --check src/",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"e2e": "playwright test" "e2e": "playwright test",
"e2e:headed": "playwright test --headed"
}, },
"peerDependencies": { "peerDependencies": {
"react": "^18.0.0", "react": "^18.0.0",
@@ -48,12 +49,11 @@
"react-router-dom": "^5.3.0", "react-router-dom": "^5.3.0",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vitest": "^3.2.4", "vitest": "^3.2.4",
"@playwright/test": "^1.59.1" "@playwright/test": "^1.58.2"
}, },
"overrides": { "overrides": {
"tar": "^7.5.11", "tar": "^7.5.11",
"undici": "^7.24.3", "undici": "^7.24.3",
"vite": ">=6.4.2", "vite": ">=6.4.2"
"elliptic": ">=6.6.1"
} }
} }
+530 -530
View File
File diff suppressed because it is too large Load Diff