Files
pulse/tests/integration/scripts/default-mock-readiness.mjs
T
pulse-triage[bot] 5385cb0956 Fail shared E2E fixture admission before repeating browser setup
Main E2E 38020587365 exhausted twenty shared-readiness/login failures over 47 minutes, then probation hit the job limit before stable report uploads. Admit the same authenticated inventory and pool/disk history once before either tier, without retries or ignored failures, and upload completed stable failures before observational work. Share the existing readiness predicates and cover every identity/history requirement, actual spec cleanup and the workflow fail-fast command. Preserve phase thresholds, test tiers, pins and the stable verdict. This does not diagnose the hosted runtime failure.

Change-source: pulse-maintainer
2026-10-10 05:48:35 +01:00

33 lines
1.7 KiB
JavaScript

// 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));
}