test: strengthen safety-critical coverage
This commit is contained in:
@@ -71,6 +71,26 @@ test('requires exact server SHA and matching request ID after a successful workf
|
||||
}).message, /exit code 70/i);
|
||||
});
|
||||
|
||||
test('server verification reports every incomplete or mismatched evidence field', () => {
|
||||
const sha = 'a'.repeat(40);
|
||||
const operation = { id: 'request-1', repository: 'jens/app', environment: 'production', sha, shortSha: sha.slice(0, 7) };
|
||||
const valid = { statusConfigured: true, statusReachable: true, statusRepository: operation.repository, statusEnvironment: operation.environment, liveSha: sha, requestedSha: sha, requestId: operation.id, lastExitCode: 0, healthy: true };
|
||||
const cases = [
|
||||
[{ ...valid, statusConfigured: false }, /is configured/i],
|
||||
[{ ...valid, statusRepository: '' }, /did not identify its repository/i],
|
||||
[{ ...valid, statusEnvironment: '' }, /did not identify its environment/i],
|
||||
[{ ...valid, statusEnvironment: 'staging' }, /belongs to staging/i],
|
||||
[{ ...valid, liveSha: '' }, /valid full commit SHA/i],
|
||||
[{ ...valid, requestedSha: '' }, /requested commit SHA/i],
|
||||
[{ ...valid, requestedSha: 'b'.repeat(40) }, /different requested commit/i],
|
||||
[{ ...valid, requestId: '' }, /deployment request ID/i],
|
||||
[{ ...valid, lastExitCode: null }, /exit code unknown/i],
|
||||
[{ ...valid, healthy: false, healthStatus: 'degraded' }, /degraded/i],
|
||||
[{ ...valid, healthy: null, error: 'probe failed' }, /probe failed/i]
|
||||
];
|
||||
for (const [state, pattern] of cases) assert.match(applicationVerificationFailure(operation, state).message, pattern);
|
||||
});
|
||||
|
||||
test('rollback accepts only the currently reported previous SHA and dispatches controlled inputs', async () => {
|
||||
const liveSha = 'a'.repeat(40);
|
||||
const previousSha = 'b'.repeat(40);
|
||||
|
||||
Reference in New Issue
Block a user