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.

Fail shared E2E fixture admission before repeating browser setup

pulse-triage[bot]5385cb0956f7
diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml
index 5db15dc616..10ea2aedde 100644
--- a/.github/workflows/test-e2e.yml
+++ b/.github/workflows/test-e2e.yml
@@ -254,6 +254,29 @@ jobs:
PULSE_MULTI_TENANT_ENABLED: "true"
run: node scripts/pretest.mjs
+ # One shared fixture fault previously consumed 47 minutes of repeated
+ # setup/login failures before probation hit the job limit. Admit the
+ # same authenticated inventory and history once, before either tier.
+ - name: Admit the default mock runtime
+ id: fixture
+ timeout-minutes: 8
+ working-directory: tests/integration
+ env:
+ PULSE_E2E_BOOTSTRAP_TOKEN: 0123456789abcdef0123456789abcdef0123456789abcdef
+ PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "true"
+ PULSE_MULTI_TENANT_ENABLED: "true"
+ run: npx playwright test --config=fixture-readiness.config.ts
+
+ - name: Upload failed fixture admission
+ if: ${{ !cancelled() && steps.fixture.outcome == 'failure' }}
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: fixture-readiness-shard-${{ matrix.shard }}
+ path: |
+ tests/integration/playwright-report-readiness/
+ tests/integration/test-results-readiness/
+ retention-days: 7
+
# Two-tier run (see PROBATION_SPECS in tests/integration/e2e-tiering.mjs
# for the tier mechanism and the promotion/demotion rule). The stable tier
# is the gate; the probation tier reuses the same containers but reports
@@ -281,6 +304,26 @@ jobs:
working-directory: tests/integration
run: node scripts/report-stable-e2e-failures.mjs test-results/junit.xml
+ # Preserve the completed stable failure before observational work can
+ # reach the job deadline. Probation must not take its receipts with it.
+ - name: Upload Playwright report
+ if: ${{ !cancelled() && steps.stable.outcome == 'failure' }}
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: playwright-report-shard-${{ matrix.shard }}
+ path: tests/integration/playwright-report/
+ retention-days: 3
+
+ # The HTML report already contains screenshots, videos and traces.
+ # Keep only the separate machine-readable result here.
+ - name: Upload JUnit results
+ if: ${{ !cancelled() && steps.stable.outcome == 'failure' }}
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: junit-results-shard-${{ matrix.shard }}
+ path: tests/integration/test-results/junit.xml
+ retention-days: 3
+
# Runs even when the stable tier failed (its data still counts toward
# promotion), but not when the stable tier was skipped — that means the
# environment never came up and every probation spec would fail on it.
@@ -332,24 +375,6 @@ jobs:
echo "=== Mock GitHub server logs ==="
docker logs pulse-mock-github 2>&1 || echo "No pulse-mock-github container"
- - name: Upload Playwright report
- if: failure()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: playwright-report-shard-${{ matrix.shard }}
- path: tests/integration/playwright-report/
- retention-days: 3
-
- # The HTML report already contains screenshots, videos and traces.
- # Keep only the separate machine-readable result here.
- - name: Upload JUnit results
- if: failure()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: junit-results-shard-${{ matrix.shard }}
- path: tests/integration/test-results/junit.xml
- retention-days: 3
-
# continue-on-error keeps the job green on a probation failure, so
# failure() never fires for these; key off the step outcome instead.
- name: Upload probation Playwright report
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 6b4ceaf531..51278df518 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -5729,6 +5729,23 @@ helper must also prove that storage-pool and physical-disk history cover the
suite's deepest seven-day chart window. The compose harness must seed that
same seven-day window by default instead of forcing every parallel shard to
build unrelated 90-day preview history.
+Core E2E must admit that same authenticated default fixture once, through
+`tests/integration/fixture-readiness.config.ts` and its dedicated spec, after
+container startup and before either test tier. An absent opt-in, incomplete
+inventory or insufficient pool/disk history fails the shard before suite work;
+it must not become repeated per-test setup failures. The policy lives in
+`tests/integration/scripts/default-mock-readiness.mjs`, consumed by the existing
+authenticated helper, with unchanged 120/180-second phase waits and history
+depth. Admission has no retry or ignored failure and a separate bounded report;
+it does not replace later fixture checks or any product/browser assertion.
+Completed stable-tier failure reports and JUnit must be uploaded before the
+observational probation pass, so a later probation cancellation cannot suppress
+those completed receipts. The job deadline, stable/probation selection and verdict
+gate stay unchanged. `scripts/tests/test-e2e-fixture-admission.sh` covers every
+required platform identity, both history scopes and depth, actual admission-spec
+error/cleanup behavior, the workflow's fail-fast command and receipt ordering.
+These controls prove fixture/gate orchestration, not the cause of a hosted
+runtime fault, provider transience or native monitoring recovery.
Managed runtime recovery and browser bootstrap proofs therefore need to keep
helper coverage that demonstrates browser-shell request tracking remains
trustworthy when the same test also performs direct health or security-status
diff --git a/scripts/tests/test-e2e-fixture-admission.sh b/scripts/tests/test-e2e-fixture-admission.sh
new file mode 100644
index 0000000000..1aaa237410
--- /dev/null
+++ b/scripts/tests/test-e2e-fixture-admission.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+set -euo pipefail
+root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+node --test "${root}/tests/integration/scripts/fixture-readiness.test.mjs"
diff --git a/scripts/tests/test_e2e_test_images.py b/scripts/tests/test_e2e_test_images.py
index 921157ae93..38f9d2bd55 100644
--- a/scripts/tests/test_e2e_test_images.py
+++ b/scripts/tests/test_e2e_test_images.py
@@ -255,6 +255,45 @@ class E2EImageBundleTest(unittest.TestCase):
class E2EImageWorkflowTest(unittest.TestCase):
+ def assert_fixture_admission(self, workflow):
+ consumer = job_block(workflow, "e2e")
+ image_admission = consumer.index("- name: Admit the source-bound test images")
+ startup = consumer.index("- name: Start test containers")
+ fixture_admission = consumer.index("- name: Admit the default mock runtime")
+ stable = consumer.index("- name: Run stable-tier E2E suite")
+ probation = consumer.index("- name: Run probation-tier E2E suite")
+ self.assertLess(image_admission, startup)
+ self.assertLess(startup, fixture_admission)
+ self.assertLess(fixture_admission, stable)
+ end = consumer.index("\n - name:", fixture_admission)
+ admission = consumer[fixture_admission:end]
+ self.assertIn("npx playwright test --config=fixture-readiness.config.ts", admission)
+ self.assertIn('PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "true"', admission)
+ for ignored in ("continue-on-error", "if:", "||"):
+ self.assertNotIn(ignored, admission)
+ for receipt in ("Upload Playwright report", "Upload JUnit results"):
+ start = consumer.index(f"- name: {receipt}\n")
+ self.assertLess(stable, start)
+ self.assertLess(start, probation)
+ end = consumer.index("\n - name:", start)
+ self.assertIn("!cancelled() && steps.stable.outcome == 'failure'", consumer[start:end])
+
+ def test_fixture_admission_cannot_skip_source_images_or_lose_completed_receipts(self):
+ self.assert_fixture_admission(WORKFLOW.read_text())
+
+ def test_ignored_fixture_and_late_receipt_mutants_are_rejected(self):
+ source = WORKFLOW.read_text()
+ for old, new in (
+ ("run: npx playwright test --config=fixture-readiness.config.ts",
+ "run: npx playwright test --config=fixture-readiness.config.ts || true"),
+ (" id: fixture\n", " id: fixture\n continue-on-error: true\n"),
+ ('PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "true"', 'PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "false"'),
+ ("!cancelled() && steps.stable.outcome == 'failure'", "failure()"),
+ ):
+ with self.subTest(mutation=new):
+ with self.assertRaises(AssertionError):
+ self.assert_fixture_admission(source.replace(old, new))
+
def assert_workflow(self, workflow):
producer = job_block(workflow, "test-images")
self.assertIn("needs: tier-selection", producer)
diff --git a/tests/integration/fixture-readiness.config.ts b/tests/integration/fixture-readiness.config.ts
new file mode 100644
index 0000000000..769234ac73
--- /dev/null
+++ b/tests/integration/fixture-readiness.config.ts
@@ -0,0 +1,27 @@
+import { defineConfig, devices } from '@playwright/test';
+import { preferredBrowserBaseURL } from './tests/runtime-defaults';
+
+// This is admission to the existing suite, not another tier or a replacement
+// for its browser assertions. Use the same authenticated readiness helper.
+export default defineConfig({
+ testDir: './fixture-readiness',
+ testMatch: 'default-mock-ready.spec.ts',
+ outputDir: 'test-results-readiness',
+ workers: 1,
+ retries: 0,
+ forbidOnly: !!process.env.CI,
+ timeout: 360_000,
+ globalTimeout: 420_000,
+ reporter: [
+ ['list'],
+ ['html', { outputFolder: 'playwright-report-readiness', open: 'never' }],
+ ['junit', { outputFile: 'test-results-readiness/junit.xml' }],
+ ],
+ use: {
+ ...devices['Desktop Chrome'],
+ baseURL: preferredBrowserBaseURL(),
+ ignoreHTTPSErrors: ['1', 'true', 'yes', 'on'].includes(
+ String(process.env.PULSE_E2E_INSECURE_TLS || '').trim().toLowerCase(),
+ ),
+ },
+});
diff --git a/tests/integration/fixture-readiness/default-mock-ready.spec.ts b/tests/integration/fixture-readiness/default-mock-ready.spec.ts
new file mode 100644
index 0000000000..97361971ea
--- /dev/null
+++ b/tests/integration/fixture-readiness/default-mock-ready.spec.ts
@@ -0,0 +1,23 @@
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { test } from '@playwright/test';
+import { createAuthenticatedStorageState } from '../tests/helpers';
+
+test('admit the authenticated default mock inventory and seven-day history', async ({ browser }) => {
+ if (!['1', 'true', 'yes', 'on'].includes(
+ String(process.env.PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY || '').trim().toLowerCase(),
+ )) {
+ throw new Error('default mock admission requires PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY=true');
+ }
+
+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'pulse-e2e-readiness-'));
+ try {
+ // The existing helper performs first-run authentication and the complete
+ // inventory/pool/disk-history checks. It also retains the usual shared
+ // cookie session for subsequent fixtures; do not add another login path.
+ await createAuthenticatedStorageState(browser, path.join(directory, 'session.json'));
+ } finally {
+ fs.rmSync(directory, { recursive: true, force: true });
+ }
+});
diff --git a/tests/integration/scripts/default-mock-readiness.d.mts b/tests/integration/scripts/default-mock-readiness.d.mts
new file mode 100644
index 0000000000..cb437cf08b
--- /dev/null
+++ b/tests/integration/scripts/default-mock-readiness.d.mts
@@ -0,0 +1,2 @@
+export function defaultMockInventoryReady(state: unknown): boolean;
+export function defaultMockHistoryReady(charts: unknown): boolean;
diff --git a/tests/integration/scripts/default-mock-readiness.mjs b/tests/integration/scripts/default-mock-readiness.mjs
new file mode 100644
index 0000000000..e71c726664
--- /dev/null
+++ b/tests/integration/scripts/default-mock-readiness.mjs
@@ -0,0 +1,32 @@
+// The shared fixture's existing admission requirements. Keep browser setup
+// and the early CI probe on one policy; readiness is not application acceptance.
+const hasSource = (resource, source) =>
+ Array.isArray(resource?.sources) && resource.sources.includes(source);
+
+export function defaultMockInventoryReady(state) {
+ const resources = Array.isArray(state?.resources) ? state.resources : [];
+ const infrastructure = Array.isArray(state?.connectedInfrastructure)
+ ? state.connectedInfrastructure : [];
+ return resources.some(r => r?.name === 'nvme-primary' && r.type === 'storage' && hasSource(r, 'vmware')) &&
+ resources.some(r => r?.type === 'k8s-cluster' && hasSource(r, 'kubernetes')) &&
+ resources.some(r => r?.name === 'tank' && hasSource(r, 'truenas')) &&
+ resources.some(r => ['vm', 'system-container'].includes(r?.type) && hasSource(r, 'proxmox')) &&
+ resources.some(r => r?.name === 'esxi-01.lab.local' && r.type === 'agent' && hasSource(r, 'vmware')) &&
+ resources.some(r => r?.type === 'docker-host') &&
+ resources.some(r => r?.type === 'pbs') &&
+ resources.some(r => r?.type === 'pmg') &&
+ infrastructure.some(entry => entry?.name === 'esxi-01.lab.local');
+}
+
+function hasDeepSeries(points) {
+ if (!Array.isArray(points)) return false;
+ const timestamps = points.map(point => Number(point?.timestamp))
+ .filter(Number.isFinite).sort((left, right) => left - right);
+ return timestamps.length >= 2 &&
+ timestamps[timestamps.length - 1] - timestamps[0] > 5 * 24 * 60 * 60 * 1000;
+}
+
+export function defaultMockHistoryReady(charts) {
+ return Object.values(charts?.pools ?? {}).some(pool => hasDeepSeries(pool?.used)) &&
+ Object.values(charts?.disks ?? {}).some(disk => hasDeepSeries(disk?.temperature));
+}
diff --git a/tests/integration/scripts/fixture-readiness.test.mjs b/tests/integration/scripts/fixture-readiness.test.mjs
new file mode 100644
index 0000000000..61a4830878
--- /dev/null
+++ b/tests/integration/scripts/fixture-readiness.test.mjs
@@ -0,0 +1,197 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { spawnSync } from 'node:child_process';
+import { fileURLToPath } from 'node:url';
+import { runInNewContext } from 'node:vm';
+import test from 'node:test';
+import { defaultMockInventoryReady, defaultMockHistoryReady } from './default-mock-readiness.mjs';
+
+const integrationRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const root = path.resolve(integrationRoot, '..', '..');
+const source = file => fs.readFileSync(path.join(integrationRoot, file), 'utf8');
+const workflow = fs.readFileSync(process.env.PULSE_READINESS_TEST_WORKFLOW ||
+ path.join(root, '.github/workflows/test-e2e.yml'), 'utf8');
+const steps = workflow.split('\n e2e:\n')[1].split('\n agent-registration:\n')[0];
+const step = name => steps.split(` - name: ${name}\n`)[1]?.split('\n - name:')[0];
+
+const readyInventory = () => ({
+ connectedInfrastructure: [{ name: 'esxi-01.lab.local' }],
+ resources: [
+ { name: 'nvme-primary', type: 'storage', sources: ['vmware'] },
+ { type: 'k8s-cluster', sources: ['kubernetes'] },
+ { name: 'tank', sources: ['truenas'] },
+ { type: 'vm', sources: ['proxmox'] },
+ { name: 'esxi-01.lab.local', type: 'agent', sources: ['vmware'] },
+ { type: 'docker-host' }, { type: 'pbs' }, { type: 'pmg' },
+ ],
+});
+const series = [{ timestamp: 1 }, { timestamp: 7 * 24 * 60 * 60 * 1000 }];
+const readyHistory = () => ({ pools: { tank: { used: series } }, disks: { sdc: { temperature: series } } });
+
+test('complete existing inventory passes, including the container alternative', () => {
+ const state = readyInventory();
+ assert.equal(defaultMockInventoryReady(state), true);
+ state.resources[3].type = 'system-container';
+ assert.equal(defaultMockInventoryReady(state), true);
+});
+
+test('each required resource and connected-host identity is necessary', () => {
+ for (let i = 0; i < readyInventory().resources.length; i++) {
+ const state = readyInventory();
+ state.resources.splice(i, 1);
+ assert.equal(defaultMockInventoryReady(state), false, `missing resource ${i}`);
+ }
+ const state = readyInventory();
+ state.connectedInfrastructure = [{ name: 'another-host' }];
+ assert.equal(defaultMockInventoryReady(state), false);
+});
+
+test('platform attribution and fixed names cannot borrow another source', () => {
+ for (let i = 0; i < 5; i++) {
+ const state = readyInventory();
+ state.resources[i].sources = ['unrelated'];
+ assert.equal(defaultMockInventoryReady(state), false);
+ }
+ for (const i of [0, 2, 4]) {
+ const state = readyInventory();
+ state.resources[i].name = 'unrelated';
+ assert.equal(defaultMockInventoryReady(state), false);
+ }
+});
+
+test('unknown or malformed inventory cannot pass admission', () => {
+ for (const state of [null, undefined, {}, { resources: {} }, { resources: [null] }]) {
+ assert.equal(defaultMockInventoryReady(state), false);
+ }
+ const state = readyInventory();
+ state.resources[0].sources = 'vmware';
+ assert.equal(defaultMockInventoryReady(state), false);
+});
+
+test('both pool and physical-disk history are required at the original depth', () => {
+ assert.equal(defaultMockHistoryReady(readyHistory()), true);
+ for (const charts of [null, undefined, {}, { pools: readyHistory().pools }, { disks: readyHistory().disks }]) {
+ assert.equal(defaultMockHistoryReady(charts), false);
+ }
+ for (const points of [[], [{ timestamp: 1 }], [{ timestamp: 'bad' }, { timestamp: 700_000_000 }],
+ [{ timestamp: 0 }, { timestamp: 5 * 24 * 60 * 60 * 1000 }]]) {
+ for (const kind of ['pool', 'disk']) {
+ const charts = readyHistory();
+ if (kind === 'pool') charts.pools.tank.used = points;
+ else charts.disks.sdc.temperature = points;
+ assert.equal(defaultMockHistoryReady(charts), false, `${kind}: ${JSON.stringify(points)}`);
+ }
+ }
+ const charts = readyHistory();
+ charts.pools.tank.used = [...series].reverse();
+ assert.equal(defaultMockHistoryReady(charts), true);
+});
+
+async function invokeAdmission(flag, check) {
+ let invocation;
+ // Execute the committed spec body with controlled browser/check callbacks,
+ // not a copy of its orchestration. Real Playwright discovery is also checked
+ // by the owning exact-source command.
+ const body = source('fixture-readiness/default-mock-ready.spec.ts').replace(/^import .*;\n/gm, '');
+ runInNewContext(body, {
+ fs, os, path, Error,
+ process: { env: { PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: flag } },
+ test: (_name, callback) => { invocation = callback({ browser: 'owned-browser' }); },
+ createAuthenticatedStorageState: check,
+ });
+ await invocation;
+}
+
+test('the real admission spec calls shared authentication once and clears temporary state', async () => {
+ let calls = 0;
+ let filename;
+ await invokeAdmission('true', async (browser, statePath) => {
+ calls++;
+ filename = statePath;
+ assert.equal(browser, 'owned-browser');
+ fs.writeFileSync(statePath, 'controlled session');
+ });
+ assert.equal(calls, 1);
+ assert.equal(fs.existsSync(path.dirname(filename)), false);
+});
+
+test('original inventory/history failure escapes unchanged and clears temporary state', async () => {
+ for (const message of ['default mock inventory should be complete before browser fixtures start',
+ 'default mock history should cover the seven-day Core E2E chart window before browser fixtures start']) {
+ let calls = 0;
+ let filename;
+ const failure = new Error(message);
+ await assert.rejects(invokeAdmission('true', async (_browser, statePath) => {
+ calls++;
+ filename = statePath;
+ fs.writeFileSync(statePath, 'partial controlled session');
+ throw failure;
+ }), err => err === failure);
+ assert.equal(calls, 1);
+ assert.equal(fs.existsSync(path.dirname(filename)), false);
+ }
+});
+
+test('missing readiness opt-in fails instead of admitting unchecked fixtures', async () => {
+ for (const flag of [undefined, '', 'false']) {
+ let called = false;
+ await assert.rejects(invokeAdmission(flag, async () => { called = true; }),
+ /requires PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY=true/);
+ assert.equal(called, false);
+ }
+});
+
+test('dedicated discovery cannot retry, absorb or mix admission with either tier', () => {
+ const config = source('fixture-readiness.config.ts');
+ for (const required of ["testDir: './fixture-readiness'", "testMatch: 'default-mock-ready.spec.ts'",
+ 'workers: 1', 'retries: 0', 'timeout: 360_000', 'globalTimeout: 420_000',
+ 'test-results-readiness/junit.xml', 'playwright-report-readiness']) {
+ assert.ok(config.includes(required), required);
+ }
+ assert.ok(!config.includes('PULSE_E2E_TIER'));
+ const helper = source('tests/helpers.ts');
+ assert.match(helper, /defaultMockInventoryReady\(await response\.json\(\)\)/);
+ assert.match(helper, /defaultMockHistoryReady\(await response\.json\(\)\)/);
+ assert.match(helper, /timeout: 120_000/);
+ assert.match(helper, /timeout: 180_000/);
+});
+
+test('workflow admission precedes both tiers without an ignored failure', () => {
+ const admission = step('Admit the default mock runtime');
+ assert.ok(admission, 'missing fixture admission');
+ assert.match(admission, /PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "true"/);
+ assert.match(admission, /timeout-minutes: 8/);
+ assert.match(admission, /working-directory: tests\/integration/);
+ assert.doesNotMatch(admission, /continue-on-error|\n if:|\|\|/);
+ assert.ok(steps.indexOf('- name: Admit the default mock runtime') < steps.indexOf('- name: Run stable-tier E2E suite'));
+});
+
+test('actual workflow shell admits healthy fixtures and stops broken ones before suite work', () => {
+ const command = step('Admit the default mock runtime')?.match(/\n run: (.+)/)?.[1] || '';
+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'pulse-admission-command-'));
+ try {
+ fs.writeFileSync(path.join(directory, 'npx'), '#!/bin/sh\n[ "$*" = "playwright test --config=fixture-readiness.config.ts" ] || exit 9\n' +
+ 'echo "controlled default mock readiness result"\nexit "$ADMISSION_EXIT"\n', { mode: 0o700 });
+ for (const status of [0, 1]) {
+ const marker = path.join(directory, `suite-${status}`);
+ const result = spawnSync('bash', ['--noprofile', '--norc', '-e', '-o', 'pipefail', '-c',
+ `${command}\nprintf suite-started > "${marker}"`], {
+ cwd: integrationRoot, encoding: 'utf8', env: { ...process.env, PATH: `${directory}:${process.env.PATH}`, ADMISSION_EXIT: String(status) },
+ });
+ assert.equal(result.status, status, result.stdout + result.stderr);
+ assert.equal(fs.existsSync(marker), status === 0);
+ }
+ } finally { fs.rmSync(directory, { recursive: true, force: true }); }
+});
+
+test('completed stable failure receipts are uploaded before probation can be cancelled', () => {
+ for (const name of ['Upload Playwright report', 'Upload JUnit results']) {
+ assert.ok(steps.indexOf(`- name: ${name}`) < steps.indexOf('- name: Run probation-tier E2E suite'), name);
+ assert.match(step(name), /!cancelled\(\) && steps\.stable\.outcome == 'failure'/);
+ }
+ assert.match(step('Upload failed fixture admission'), /!cancelled\(\) && steps\.fixture\.outcome == 'failure'/);
+ assert.match(step('Run probation-tier E2E suite (non-gating)'), /continue-on-error: true/);
+ assert.ok(steps.includes('timeout-minutes: 60'));
+});
diff --git a/tests/integration/scripts/managed-local-backend.test.mjs b/tests/integration/scripts/managed-local-backend.test.mjs
index 14eb00e25b..7a02adbb2f 100644
--- a/tests/integration/scripts/managed-local-backend.test.mjs
+++ b/tests/integration/scripts/managed-local-backend.test.mjs
@@ -200,8 +200,9 @@ test('shared browser readiness waits for the bounded mock history contract', asy
assert.match(compose, /PULSE_MOCK_TRENDS_SEED_DURATION=\$\{PULSE_MOCK_TRENDS_SEED_DURATION:-168h\}/);
assert.match(helpers, /"\/api\/storage-charts\?range=10080"/);
- assert.match(helpers, /hasDeepSeries\(pool\.used\)/);
- assert.match(helpers, /hasDeepSeries\(disk\.temperature\)/);
+ assert.match(helpers, /defaultMockInventoryReady\(await response\.json\(\)\)/);
+ assert.match(helpers, /defaultMockHistoryReady\(await response\.json\(\)\)/);
+ assert.match(helpers, /default-mock-readiness\.mjs/);
assert.match(helpers, /default mock history should cover the seven-day Core E2E chart window/);
});
diff --git a/tests/integration/tests/helpers.ts b/tests/integration/tests/helpers.ts
index 8a0a04f786..a830f5ebd6 100644
--- a/tests/integration/tests/helpers.ts
+++ b/tests/integration/tests/helpers.ts
@@ -20,6 +20,11 @@ import {
runtimeStatePath,
} from "./runtime-defaults";
+import {
+ defaultMockInventoryReady,
+ defaultMockHistoryReady,
+} from "../scripts/default-mock-readiness.mjs";
+
const helpersDir = path.dirname(fileURLToPath(import.meta.url));
const runtimePrimaryAPIToken = (): string => {
@@ -1140,26 +1145,6 @@ async function storageStateHasLiveSession(
}
}
-type E2ERuntimeStateResource = {
- name?: string;
- sources?: string[];
- type?: string;
-};
-
-type E2ERuntimeState = {
- connectedInfrastructure?: Array<{ name?: string }>;
- resources?: E2ERuntimeStateResource[];
-};
-
-type E2EMetricPoint = {
- timestamp?: number;
-};
-
-type E2EStorageCharts = {
- pools?: Record<string, { used?: E2EMetricPoint[] }>;
- disks?: Record<string, { temperature?: E2EMetricPoint[] }>;
-};
-
const requiresDefaultMockRuntimeReadiness = (): boolean =>
["1", "true", "yes", "on"].includes(
String(process.env.PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY || "")
@@ -1167,11 +1152,6 @@ const requiresDefaultMockRuntimeReadiness = (): boolean =>
.toLowerCase(),
);
-const resourceHasSource = (
- resource: E2ERuntimeStateResource,
- source: string,
-): boolean => resource.sources?.includes(source) === true;
-
export async function waitForDefaultMockRuntimeReady(page: Page): Promise<void> {
if (!requiresDefaultMockRuntimeReadiness()) {
return;
@@ -1185,48 +1165,7 @@ export async function waitForDefaultMockRuntimeReady(page: Page): Promise<void>
return false;
}
- const state = (await response.json()) as E2ERuntimeState;
- const resources = Array.isArray(state.resources) ? state.resources : [];
- const infrastructure = Array.isArray(state.connectedInfrastructure)
- ? state.connectedInfrastructure
- : [];
-
- return (
- resources.some(
- (resource) =>
- resource.name === "nvme-primary" &&
- resource.type === "storage" &&
- resourceHasSource(resource, "vmware"),
- ) &&
- resources.some(
- (resource) =>
- resource.type === "k8s-cluster" &&
- resourceHasSource(resource, "kubernetes"),
- ) &&
- resources.some(
- (resource) =>
- resource.name === "tank" &&
- resourceHasSource(resource, "truenas"),
- ) &&
- resources.some(
- (resource) =>
- (resource.type === "vm" ||
- resource.type === "system-container") &&
- resourceHasSource(resource, "proxmox"),
- ) &&
- resources.some(
- (resource) =>
- resource.name === "esxi-01.lab.local" &&
- resource.type === "agent" &&
- resourceHasSource(resource, "vmware"),
- ) &&
- resources.some((resource) => resource.type === "docker-host") &&
- resources.some((resource) => resource.type === "pbs") &&
- resources.some((resource) => resource.type === "pmg") &&
- infrastructure.some(
- (entry) => entry.name === "esxi-01.lab.local",
- )
- );
+ return defaultMockInventoryReady(await response.json());
},
{
message:
@@ -1237,17 +1176,6 @@ export async function waitForDefaultMockRuntimeReady(page: Page): Promise<void>
)
.toBe(true);
- const hasDeepSeries = (points: E2EMetricPoint[] | undefined): boolean => {
- const timestamps = (points ?? [])
- .map((point) => Number(point.timestamp))
- .filter(Number.isFinite)
- .sort((left, right) => left - right);
- if (timestamps.length < 2) {
- return false;
- }
- return timestamps[timestamps.length - 1] - timestamps[0] > 5 * 24 * 60 * 60 * 1000;
- };
-
// Inventory becomes available before the monitor has finished building its
// historical mock timeline. Do not advertise the shared browser fixture as
// ready until the deepest Core E2E chart window is queryable for both pools
@@ -1264,15 +1192,7 @@ export async function waitForDefaultMockRuntimeReady(page: Page): Promise<void>
return false;
}
- const charts = (await response.json()) as E2EStorageCharts;
- return (
- Object.values(charts.pools ?? {}).some((pool) =>
- hasDeepSeries(pool.used),
- ) &&
- Object.values(charts.disks ?? {}).some((disk) =>
- hasDeepSeries(disk.temperature),
- )
- );
+ return defaultMockHistoryReady(await response.json());
},
{
message: