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.

Verify complete bounded backup posture batches for large estates

pulse-triage[bot]e28d6e12acf6
diff --git a/tests/integration/tests/90-operational-trust-protection-posture.spec.ts b/tests/integration/tests/90-operational-trust-protection-posture.spec.ts
index beab0e4f2b..cc11ddb593 100644
--- a/tests/integration/tests/90-operational-trust-protection-posture.spec.ts
+++ b/tests/integration/tests/90-operational-trust-protection-posture.spec.ts
@@ -1,7 +1,45 @@
import { expect, test, type Page } from "@playwright/test";
-import { ensureAuthenticated, primaryNavigationLink } from "./helpers";
+import { apiRequest, ensureAuthenticated, primaryNavigationLink } from "./helpers";
const DESKTOP_VIEWPORT = { width: 1440, height: 900 };
+const POSTURE_BATCH_SIZE = 200;
+
+async function proxmoxWorkloadResourceIDs(page: Page): Promise<string[]> {
+ const ids: string[] = [];
+ let totalPages = 1;
+ let total = 0;
+ for (let pageNumber = 1; pageNumber <= totalPages; pageNumber += 1) {
+ const params = new URLSearchParams({
+ type: "vm,system-container,oci-container",
+ source: "proxmox",
+ page: String(pageNumber),
+ limit: String(POSTURE_BATCH_SIZE),
+ });
+ const response = await apiRequest(page, `/api/resources?${params}`);
+ expect(response.ok(), "The fixture workload inventory must be readable").toBe(true);
+ const payload = (await response.json()) as {
+ data: { id: string }[];
+ meta: { page: number; total: number; totalPages: number };
+ };
+ expect(payload.meta.page).toBe(pageNumber);
+ expect(Number.isInteger(payload.meta.totalPages)).toBe(true);
+ expect(payload.meta.totalPages).toBeGreaterThan(0);
+ if (pageNumber === 1) {
+ totalPages = payload.meta.totalPages;
+ total = payload.meta.total;
+ }
+ expect(payload.meta.totalPages).toBe(totalPages);
+ expect(payload.meta.total).toBe(total);
+ for (const resource of payload.data) {
+ expect(resource.id.trim()).not.toBe("");
+ ids.push(resource.id);
+ }
+ }
+ expect(ids.length).toBeGreaterThan(0);
+ expect(ids).toHaveLength(total);
+ expect(new Set(ids).size, "The inventory must not repeat a workload").toBe(total);
+ return ids.sort((left, right) => left.localeCompare(right));
+}
async function openDesktopProxmoxBackups(page: Page) {
const proxmoxTab = primaryNavigationLink(page, "Proxmox");
@@ -19,7 +57,7 @@ async function openDesktopProxmoxBackups(page: Page) {
test.describe("Operational trust protection posture", () => {
test.setTimeout(180_000);
- test("uses one bounded posture query and keeps evidence in the workload drill-down", async ({
+ test("uses bounded posture batches and keeps evidence in the workload drill-down", async ({
page,
}, testInfo) => {
test.skip(
@@ -36,6 +74,7 @@ test.describe("Operational trust protection posture", () => {
await page.setViewportSize(DESKTOP_VIEWPORT);
await ensureAuthenticated(page);
+ const workloadIDs = await proxmoxWorkloadResourceIDs(page);
await openDesktopProxmoxBackups(page);
const coverageLink = page
.getByRole("navigation", { name: "Backup views" })
@@ -53,12 +92,22 @@ test.describe("Operational trust protection posture", () => {
.filter({ has: page.locator('th:has-text("Posture")') })
.first();
await expect(coverageTable).toBeVisible();
- await expect.poll(() => postureRequests.length).toBe(1);
-
- const postureURL = new URL(postureRequests[0]);
- const requestedResourceIDs = postureURL.searchParams.getAll("resourceId");
- expect(requestedResourceIDs.length).toBeGreaterThan(0);
- expect(requestedResourceIDs.length).toBeLessThanOrEqual(200);
+ // The default mock estate now exceeds one 200-workload batch. Assert the
+ // exact complete partition, not one request for every fleet size (or a
+ // relaxed upper bound that would allow missing or repeated subjects).
+ const expectedBatchCount = Math.ceil(workloadIDs.length / POSTURE_BATCH_SIZE);
+ await expect.poll(() => postureRequests.length).toBe(expectedBatchCount);
+ const requestedIDs: string[] = [];
+ for (const request of postureRequests) {
+ const postureURL = new URL(request);
+ expect(postureURL.searchParams.get("limit")).toBe(String(POSTURE_BATCH_SIZE));
+ const batchIDs = postureURL.searchParams.getAll("resourceId");
+ expect(batchIDs.length).toBeGreaterThan(0);
+ expect(batchIDs.length).toBeLessThanOrEqual(POSTURE_BATCH_SIZE);
+ expect(new Set(batchIDs).size).toBe(batchIDs.length);
+ requestedIDs.push(...batchIDs);
+ }
+ expect(requestedIDs.sort((left, right) => left.localeCompare(right))).toEqual(workloadIDs);
// The default monitor stays compact. Explanation and provider/restore
// evidence appear only after the operator asks for the row's details.