Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Stabilize vSphere drawer verification

rcourtman19ec17372ed3
diff --git a/tests/integration/tests/39-vmware-resource-detail-drawer.spec.ts b/tests/integration/tests/39-vmware-resource-detail-drawer.spec.ts
index 6770502905..3289a6e0ef 100644
--- a/tests/integration/tests/39-vmware-resource-detail-drawer.spec.ts
+++ b/tests/integration/tests/39-vmware-resource-detail-drawer.spec.ts
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'node:url';
import { expect, test as base } from '@playwright/test';
import { createAuthenticatedStorageState } from './helpers';
+import { installVmwareWorkloadResourceRoute } from './vmware-workload-fixture';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const SCREENSHOT_PATH = '/tmp/vmware-resource-detail-drawer.png';
@@ -37,7 +38,8 @@ const test = base.extend<{}, WorkerFixtures>({
// The retired /infrastructure resource deep-link was replaced by the vSphere
// platform page: expanding a VM row opens the shared guest drawer, which
-// carries the read-only vCenter placement context from live websocket state.
+// carries the read-only vCenter placement context from the canonical resource
+// contract.
test.describe('VMware resource detail drawer', () => {
test.setTimeout(180_000);
@@ -48,11 +50,11 @@ test.describe('VMware resource detail drawer', () => {
unexpectedVmwareApiCall = route.request().url();
await route.abort();
});
+ await installVmwareWorkloadResourceRoute(page);
await page.goto('/vmware', { waitUntil: 'domcontentloaded' });
await expect(page.locator('[data-testid="vmware-page"]')).toBeVisible();
- // First websocket state frame can lag on a freshly booted backend.
const expandButton = page.getByRole('button', { name: 'Expand warehouse-api-01' });
await expect(expandButton).toBeVisible({ timeout: 30_000 });
await expandButton.click();
diff --git a/tests/integration/tests/41-vmware-phase1-exclusion-integrity.spec.ts b/tests/integration/tests/41-vmware-phase1-exclusion-integrity.spec.ts
index ccc9d8b90e..9fa59e9c7d 100644
--- a/tests/integration/tests/41-vmware-phase1-exclusion-integrity.spec.ts
+++ b/tests/integration/tests/41-vmware-phase1-exclusion-integrity.spec.ts
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'node:url';
import { expect, test as base } from '@playwright/test';
import { createAuthenticatedStorageState } from './helpers';
+import { installVmwareWorkloadResourceRoute } from './vmware-workload-fixture';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const SCREENSHOT_PATH = '/tmp/vmware-phase1-exclusion-integrity.png';
@@ -58,83 +59,11 @@ test.describe('VMware phase-1 exclusion integrity', () => {
await route.abort();
});
- await page.route('**/api/resources**', async (route) => {
- const requestUrl = new URL(route.request().url());
- if (
- requestUrl.pathname !== '/api/resources' ||
- requestUrl.searchParams.get('type') !==
- 'vm,system-container,app-container,pod'
- ) {
- await route.continue();
- return;
- }
-
- await route.fulfill({
- status: 200,
- contentType: 'application/json',
- body: JSON.stringify({
- data: [
- {
- id: 'vmware:vc-mock-1:vm:vm-201',
- type: 'vm',
- name: 'warehouse-api-01',
- displayName: 'warehouse-api-01',
- status: 'online',
- lastSeen: '2026-07-19T12:00:00Z',
- sources: ['vmware'],
- platformScopes: ['vmware-vsphere'],
- platformType: 'vmware-vsphere',
- canonicalIdentity: {
- primaryId: 'vmware:vc-mock-1:vm:vm-201',
- displayName: 'warehouse-api-01',
- hostname: 'warehouse-api-01.internal',
- aliases: ['vm-201', 'warehouse-api-01'],
- },
- metrics: {
- cpu: { value: 18, percent: 18, unit: 'percent' },
- memory: {
- used: 4_294_967_296,
- total: 8_589_934_592,
- percent: 50,
- unit: 'bytes',
- },
- disk: {
- used: 68_719_476_736,
- total: 137_438_953_472,
- percent: 50,
- unit: 'bytes',
- },
- },
- vmware: {
- connectionId: 'vc-mock-1',
- connectionName: 'Lab vCenter',
- vcenterHost: 'vcsa.lab.local',
- entityType: 'vm',
- managedObjectId: 'vm-201',
- datacenterName: 'Primary DC',
- clusterName: 'Production Cluster',
- runtimeHostId: 'host-101',
- runtimeHostName: 'esxi-01.lab.local',
- powerState: 'POWERED_ON',
- guestHostname: 'warehouse-api-01.internal',
- guestIpAddresses: ['10.42.10.121'],
- },
- },
- ],
- meta: {
- page: 1,
- limit: 200,
- total: 1,
- totalPages: 1,
- },
- }),
- });
- });
+ await installVmwareWorkloadResourceRoute(page);
await page.goto('/vmware', { waitUntil: 'domcontentloaded' });
await expect(page.locator('[data-testid="vmware-page"]')).toBeVisible();
- // First websocket state frame can lag on a freshly booted backend.
const expandButton = page.getByRole('button', { name: 'Expand warehouse-api-01' });
await expect(expandButton).toBeVisible({ timeout: 30_000 });
await expandButton.click();
diff --git a/tests/integration/tests/vmware-workload-fixture.ts b/tests/integration/tests/vmware-workload-fixture.ts
new file mode 100644
index 0000000000..a62052f3e9
--- /dev/null
+++ b/tests/integration/tests/vmware-workload-fixture.ts
@@ -0,0 +1,83 @@
+import type { Page } from '@playwright/test';
+
+const VMWARE_WORKLOAD_QUERY = 'vm,system-container,app-container,pod';
+
+const VMWARE_WORKLOAD_RESOURCE = {
+ id: 'vmware:vc-mock-1:vm:vm-201',
+ type: 'vm',
+ name: 'warehouse-api-01',
+ displayName: 'warehouse-api-01',
+ status: 'online',
+ lastSeen: '2026-07-19T12:00:00Z',
+ sources: ['vmware'],
+ platformScopes: ['vmware-vsphere'],
+ platformType: 'vmware-vsphere',
+ canonicalIdentity: {
+ primaryId: 'vmware:vc-mock-1:vm:vm-201',
+ displayName: 'warehouse-api-01',
+ hostname: 'warehouse-api-01.internal',
+ aliases: ['vm-201', 'warehouse-api-01'],
+ },
+ identity: {
+ hostnames: ['warehouse-api-01.internal'],
+ ipAddresses: ['10.42.10.121'],
+ clusterName: 'Production Cluster',
+ },
+ metrics: {
+ cpu: { value: 18, percent: 18, unit: 'percent' },
+ memory: {
+ used: 4_294_967_296,
+ total: 8_589_934_592,
+ percent: 50,
+ unit: 'bytes',
+ },
+ disk: {
+ used: 68_719_476_736,
+ total: 137_438_953_472,
+ percent: 50,
+ unit: 'bytes',
+ },
+ },
+ vmware: {
+ connectionId: 'vc-mock-1',
+ connectionName: 'Lab vCenter',
+ vcenterHost: 'vcsa.lab.local',
+ entityType: 'vm',
+ managedObjectId: 'vm-201',
+ datacenterName: 'Primary DC',
+ clusterName: 'Production Cluster',
+ runtimeHostId: 'host-101',
+ runtimeHostName: 'esxi-01.lab.local',
+ powerState: 'POWERED_ON',
+ guestOsFamily: 'LINUX',
+ guestHostname: 'warehouse-api-01.internal',
+ guestIpAddresses: ['10.42.10.121'],
+ },
+} as const;
+
+export async function installVmwareWorkloadResourceRoute(page: Page): Promise<void> {
+ await page.route('**/api/resources**', async (route) => {
+ const requestUrl = new URL(route.request().url());
+ if (
+ requestUrl.pathname !== '/api/resources' ||
+ requestUrl.searchParams.get('type') !== VMWARE_WORKLOAD_QUERY
+ ) {
+ await route.continue();
+ return;
+ }
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ data: [VMWARE_WORKLOAD_RESOURCE],
+ meta: {
+ page: 1,
+ limit: 200,
+ total: 1,
+ totalPages: 1,
+ },
+ }),
+ });
+ });
+}