Collapse passed provisioning checks (Refs #83)
This commit is contained in:
@@ -20,8 +20,57 @@ function fixture(): ProvisioningDetail {
|
||||
collection: null, progress: progress(), capacity: { evaluatedAt: at, pools: [] }, warningMessages: []
|
||||
};
|
||||
}
|
||||
function completedFixture(): ProvisioningDetail {
|
||||
const detail = fixture();
|
||||
detail.deployment.state = 'done';
|
||||
detail.deployment.finished_at = at;
|
||||
detail.progress = progress({ checks: (['container', 'game', 'map', 'plutonium-release', 'plutonium-version'] as const).map(key => ({
|
||||
key, label: key, result: 'pass', source: 'agent', checkedAt: at, receivedAt: at,
|
||||
expected: `Expected ${key}`, actual: `Observed ${key}`, message: null
|
||||
})) });
|
||||
return detail;
|
||||
}
|
||||
|
||||
describe('provisioning outcome and evidence presentation', () => {
|
||||
it('summarizes recorded passed checks and retains their details in closed timeline groups', () => {
|
||||
const detail = completedFixture();
|
||||
expect(provisioningOutcome(detail).checksSummary).toBe('All 5 checks passed');
|
||||
const body = render(ProvisioningProgressView, { props: { detail } }).body;
|
||||
expect(body.match(/<details\b/g)).toHaveLength(3);
|
||||
expect(body).not.toMatch(/<details\b[^>]*\bopen\b/);
|
||||
for (const check of detail.progress!.checks) {
|
||||
expect(body).toContain(check.expected);
|
||||
expect(body).toContain(check.actual);
|
||||
}
|
||||
expect(body).toContain('Host agent');
|
||||
expect(body).toContain('Evidence received');
|
||||
detail.progress!.checks = detail.progress!.checks.slice(0, 1);
|
||||
expect(provisioningOutcome(detail).checksSummary).toBe('All 1 check passed');
|
||||
detail.progress!.checks = [];
|
||||
expect(provisioningOutcome(detail).checksSummary).toBeNull();
|
||||
detail.progress = null;
|
||||
expect(provisioningOutcome(detail).checksSummary).toBeNull();
|
||||
});
|
||||
|
||||
it.each(['fail', 'waiting', 'unknown'] as const)('keeps %s evidence visible even with a recorded completed outcome', result => {
|
||||
const detail = completedFixture();
|
||||
detail.progress!.checks[2].result = result;
|
||||
expect(provisioningOutcome(detail).checksSummary).toBeNull();
|
||||
const body = render(ProvisioningProgressView, { props: { detail } }).body;
|
||||
const openGroups = body.match(/<details\b[^>]*\bopen\b[^>]*>[\s\S]*?<\/details>/g);
|
||||
expect(openGroups).toHaveLength(1);
|
||||
expect(openGroups![0]).toContain('Observed map');
|
||||
});
|
||||
|
||||
it.each(['queued', 'waiting', 'running', 'awaiting-health', 'warning', 'failed', 'interrupted', 'cancelled'])(
|
||||
'keeps %s evidence expanded without claiming the operation passed all checks', state => {
|
||||
const detail = completedFixture();
|
||||
detail.deployment.state = state;
|
||||
expect(provisioningOutcome(detail).checksSummary).toBeNull();
|
||||
const body = render(ProvisioningProgressView, { props: { detail } }).body;
|
||||
expect(body.match(/<details\b[^>]*\bopen\b/g)).toHaveLength(3);
|
||||
});
|
||||
|
||||
it('shows recorded usernames and preserves unknown manual requesters', () => {
|
||||
expect(provisioningRequester({ triggered_by: 'ui', requested_by: 'alice' })).toBe('alice');
|
||||
expect(provisioningRequester({ triggered_by: 'rebalance:run', requested_by: 'bob' })).toBe('bob');
|
||||
|
||||
Reference in New Issue
Block a user