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.

Prove VMware onboarding failure classes

rcourtman099bb04de70e
diff --git a/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_PROOF_MATRIX.md b/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_PROOF_MATRIX.md
index 3d0f422bb3..9b68addb07 100644
--- a/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_PROOF_MATRIX.md
+++ b/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_PROOF_MATRIX.md
@@ -198,6 +198,11 @@ Pass when:
4. a green result reflects the declared phase-1 floor rather than one partial
VMware API-family success
+Automated non-live proof should continue to cover the shared browser path for
+`unsupported_version`, `auth`, `tls`, and `network` classifications so the
+first real lab run is not the first operator-visible exercise of those failure
+shapes.
+
### `VC-2` Saved Connection Retest
1. Save a working VMware connection.
diff --git a/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx b/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx
index 2adbe77fe7..68b62a5368 100644
--- a/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx
@@ -227,4 +227,74 @@ describe('useVMwareSettingsPanelState', () => {
tone: 'warning',
});
});
+
+ it.each([
+ {
+ category: 'auth',
+ error: 'VMware authentication failed while creating the VI JSON API session',
+ expected: {
+ guidance: 'Verify the username, password, and account scope in vCenter before retrying.',
+ title: 'Authentication failed',
+ tone: 'danger',
+ },
+ },
+ {
+ category: 'tls',
+ error: 'VMware TLS validation failed during Automation API session bootstrap',
+ expected: {
+ guidance:
+ 'Install a trusted certificate for vCenter, or enable Skip TLS verification only for controlled lab environments.',
+ title: 'TLS validation failed',
+ tone: 'warning',
+ },
+ },
+ {
+ category: 'network',
+ error: 'VMware network error during VI JSON login',
+ expected: {
+ guidance:
+ 'Confirm DNS, reachability, port 443, and any firewall rules from the Pulse server to vCenter.',
+ title: 'Pulse could not reach vCenter',
+ tone: 'danger',
+ },
+ },
+ ])(
+ 'maps $category failures onto shared draft onboarding guidance',
+ async ({ category, error, expected }) => {
+ vi.mocked(VMwareAPI.listConnections).mockResolvedValueOnce([] as never);
+ vi.mocked(VMwareAPI.testConnection).mockRejectedValueOnce(
+ Object.assign(new Error('Failed to connect to VMware vCenter'), {
+ status: 400,
+ code: 'vmware_connection_failed',
+ details: {
+ category,
+ error,
+ },
+ }),
+ );
+
+ const { result } = renderHook(() => useVMwareSettingsPanelState());
+
+ await waitFor(() => expect(result.loading()).toBe(false));
+
+ result.openCreateDialog();
+ result.updateForm({
+ host: `${category}.lab.local`,
+ username: '[email protected]',
+ password: 'secret',
+ });
+ const succeeded = await result.testCurrentForm();
+
+ expect(succeeded).toBe(false);
+ expect(notificationStore.error).toHaveBeenCalledWith(error);
+ expect(result.connectionFailure()).toEqual({
+ category,
+ code: 'vmware_connection_failed',
+ guidance: expected.guidance,
+ message: error,
+ title: expected.title,
+ tone: expected.tone,
+ });
+ },
+ );
});
diff --git a/tests/integration/tests/22-vmware-settings-platform-connections.spec.ts b/tests/integration/tests/22-vmware-settings-platform-connections.spec.ts
index f73dc3793b..9ee3952274 100644
--- a/tests/integration/tests/22-vmware-settings-platform-connections.spec.ts
+++ b/tests/integration/tests/22-vmware-settings-platform-connections.spec.ts
@@ -286,6 +286,97 @@ test.describe("VMware platform connections settings", () => {
expect(createCalls).toBe(0);
});
+ test("surfaces shared draft onboarding guidance for auth, TLS, and network failures", async ({
+ page,
+ }) => {
+ const scenarios = [
+ {
+ category: "auth",
+ error:
+ "VMware authentication failed while creating the VI JSON API session",
+ expectedTitle: "Authentication failed",
+ expectedGuidance:
+ "Verify the username, password, and account scope in vCenter before retrying.",
+ },
+ {
+ category: "tls",
+ error:
+ "VMware TLS validation failed during Automation API session bootstrap",
+ expectedTitle: "TLS validation failed",
+ expectedGuidance:
+ "Install a trusted certificate for vCenter, or enable Skip TLS verification only for controlled lab environments.",
+ },
+ {
+ category: "network",
+ error: "VMware network error during VI JSON login",
+ expectedTitle: "Pulse could not reach vCenter",
+ expectedGuidance:
+ "Confirm DNS, reachability, port 443, and any firewall rules from the Pulse server to vCenter.",
+ },
+ ];
+ let draftFailureIndex = 0;
+
+ await page.route("**/api/vmware/connections**", async (route) => {
+ const request = route.request();
+ const method = request.method();
+ const pathname = new URL(request.url()).pathname;
+
+ if (pathname === "/api/vmware/connections" && method === "GET") {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify([]),
+ });
+ return;
+ }
+
+ if (pathname === "/api/vmware/connections/test" && method === "POST") {
+ const scenario = scenarios[Math.min(draftFailureIndex, scenarios.length - 1)];
+ draftFailureIndex += 1;
+ await route.fulfill({
+ status: 400,
+ contentType: "application/json",
+ body: JSON.stringify({
+ error: "Failed to connect to VMware vCenter",
+ code: "vmware_connection_failed",
+ status_code: 400,
+ details: {
+ category: scenario.category,
+ error: scenario.error,
+ },
+ }),
+ });
+ return;
+ }
+
+ await route.continue();
+ });
+
+ await page.goto("/settings/infrastructure/platforms/vmware", {
+ waitUntil: "domcontentloaded",
+ });
+ await page.waitForURL(/\/settings\/infrastructure\/platforms\/vmware/, {
+ timeout: 15_000,
+ });
+
+ for (const scenario of scenarios) {
+ await page.getByRole("button", { name: "Add VMware connection" }).click();
+ await page.getByLabel("Host").fill(`${scenario.category}.lab.local`);
+ await page.getByLabel("Username").fill("[email protected]");
+ await page.getByLabel("Password").fill("super-secret");
+ await page.getByRole("button", { name: "Test connection" }).click();
+
+ const feedback = page.getByTestId("vmware-connection-test-feedback");
+ await expect(feedback).toBeVisible();
+ await expect(feedback).toContainText(scenario.expectedTitle);
+ await expect(feedback).toContainText(scenario.error);
+ await expect(feedback).toContainText(scenario.expectedGuidance);
+
+ await page.getByRole("button", { name: "Cancel" }).click();
+ await expect(page.getByRole("dialog")).not.toBeVisible();
+ }
+ });
+
test("adds, edits, retests, and deletes VMware connections through the canonical settings workflow", async ({
page,
}) => {