mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 17:11:28 +01:00
Skipped quarantined tests fail the run, and the upgrade snooze sticks for git installs (GST-3344) (#4590)
A quarantined test that the runner skipped now fails the run, and "Not now" on the upgrade prompt now lasts its full snooze on git installs. Why: four outside reports showed a false pass, a snooze that came back after two hours, a model check that ignored `config.toml`, and two `$B` rules missing from /browse. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=red-team
This commit is contained in:
1 parent
0adfab9dd9
commit
e096fa850c
15 files changed
+175
-84
No files matched your search
@@ -219,6 +219,7 @@ function fakeRun(reports: (n: number, argv: string[]) => string | null, exits: (
|
||||
const suite = (cases: string, file = 'a.test.ts') => `<testsuites name="bun test"><testsuite name="${file}" file="${file}">${cases}</testsuite></testsuites>`;
|
||||
const pass = (name: string) => `<testcase name="${name}" classname="" file="a.test.ts"/>`;
|
||||
const fail = (name: string) => `<testcase name="${name}" classname="" file="a.test.ts"><failure message="boom"/></testcase>`;
|
||||
const skipped = (name: string) => `<testcase name="${name}" classname="" file="a.test.ts"><skipped/></testcase>`;
|
||||
const Q = new Set(['a.test.ts::::q']);
|
||||
const run = (f: ReturnType<typeof fakeRun>, extra: Partial<Parameters<typeof runFlaky>[0]> = {}) =>
|
||||
runFlaky({ command: ['bun', 'test'], junit: 'r.xml', maxReruns: 3, cwd: tmp(), spawn: f.spawn, env: {}, now: () => NOW, quarantined: Q, ...extra });
|
||||
@@ -307,6 +308,34 @@ describe('the quarantine attempt budget under the full green verdict', () => {
|
||||
expect(renderResult(r, '/l').at(-1)).toContain('failed=0 flaky=0 quarantined=1');
|
||||
});
|
||||
|
||||
// #4550: a quarantined test still runs, so a skip on the attempt that decides the run is a quarantined failure.
|
||||
test('a quarantined test the runner skipped is a quarantined failure and the run is red', async () => {
|
||||
const f = fakeRun(() => suite(skipped('q') + pass('a')), () => 0);
|
||||
const r = await run(f);
|
||||
expect(f.calls).toHaveLength(1);
|
||||
expect(r.exitCode).toBe(1);
|
||||
expect(r.outcomes).toMatchObject([{ status: 'quarantined-fail', attempts: ['skip'], reason: 'quarantined, and skipped on the final attempt instead of running' }]);
|
||||
expect(r.ledger.map(l => [l.kind, l.id, l.attempts])).toEqual([['quarantined-fail', 'a.test.ts::::q', ['skip']]]);
|
||||
expect(renderResult(r, '/l').at(-1)).toBe('FLAKY_RESULT: tests=2 failed=1 flaky=0 quarantined=1 reruns=0 command_exit=0 verdict=fail ledger=/l');
|
||||
});
|
||||
|
||||
test('a quarantined test that passed and was then skipped on the whole-command retry is a quarantined failure', async () => {
|
||||
const f = fakeRun(n => n === 1 ? suite(pass('q') + fail('a')) : suite(skipped('q') + pass('a')), n => n === 1 ? 1 : 0);
|
||||
const r = await run(f);
|
||||
expect(f.calls).toHaveLength(2);
|
||||
expect(r.exitCode).toBe(1);
|
||||
expect(r.ledger.find(l => l.id === 'a.test.ts::::q')).toMatchObject({ kind: 'quarantined-fail', attempts: ['pass', 'skip'] });
|
||||
});
|
||||
|
||||
test('a quarantined test skipped first and passing on the whole-command retry still passes, and an ordinary skip follows the runner', async () => {
|
||||
const retried = fakeRun(n => n === 1 ? suite(skipped('q') + fail('a')) : suite(pass('q') + pass('a')), n => n === 1 ? 1 : 0);
|
||||
const r = await run(retried);
|
||||
expect(r.exitCode).toBe(0);
|
||||
expect(r.outcomes.find(o => o.test.id === 'a.test.ts::::q')).toMatchObject({ status: 'quarantined-pass', attempts: ['skip', 'pass'] });
|
||||
const ordinary = await run(fakeRun(() => suite(skipped('s') + pass('a')), () => 0), { quarantined: new Set() });
|
||||
expect(ordinary).toMatchObject({ exitCode: 0, quarantined: 0, outcomes: [], ledger: [] });
|
||||
});
|
||||
|
||||
test('quarantined failures do not count against --max-reruns', async () => {
|
||||
const f = fakeRun(n => suite(pass('a') + (n === 1 ? fail('q') : pass('q'))), n => n === 1 ? 1 : 0);
|
||||
expect((await run(f, { maxReruns: 0 })).exitCode).toBe(0);
|
||||
|
||||
Reference in new issue
Block a user