mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-10 18:50:18 +01:00
Fix ship-queue ready tests after the pre-merge check got stricter (GST-2282) (#4271)
* Give the ship-queue ready tests complete pregate records The notes-push and fresh-base suites wrote a one-check pregate record, which ready refuses as a partial run since #4258. They now write every registered check, as the other queue tests do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Add a changelog entry for the ship-queue ready test fix Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ccc3f0fc14
commit
b1702eea91
3 files changed
+7
-2
No files matched your search
@@ -0,0 +1 @@
|
||||
- **The free test suite is green on main again.** Two `gstack-ship-queue ready` tests still wrote a pre-merge check record with a single check, which `ready` has refused since the pre-merge check started requiring every registered check (GST-2194). Their fixtures now record every check, so the tests exercise what they were written for. No product behavior changed (GST-2282).
|
||||
@@ -9,10 +9,12 @@ import { afterEach, describe, expect, test } from 'bun:test';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { EXIT } from '../../lib/headless-artifacts';
|
||||
import { CHECK_IDS } from '../../lib/pregate/index';
|
||||
import { cleanup, runBin } from '../../test/helpers/restamp-fixture';
|
||||
import { line, openPr, queue, repoKey, trainFixture, type TrainFixture } from '../../test/helpers/ship-queue-train-fixture';
|
||||
|
||||
const NOTES = 'refs/notes/gstack-trains';
|
||||
const FULL_CHECKS = CHECK_IDS.map(id => ({ id, status: 'pass' }));
|
||||
const fixtures: TrainFixture[] = [];
|
||||
afterEach(() => { while (fixtures.length) cleanup(fixtures.pop()!.repo); });
|
||||
|
||||
@@ -23,7 +25,7 @@ function readyFixture() {
|
||||
fx.write(d => { d.ci[head] = [{ status: 'completed', conclusion: 'success' }]; });
|
||||
const tree = runBin(fx.repo, 'gstack-wtree', []).out.trim();
|
||||
const pregate = path.join(fx.repo.root, 'pregate.json');
|
||||
fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: [{ id: 'unit', status: 'pass' }] }));
|
||||
fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: FULL_CHECKS }));
|
||||
return { fx, head, pregate };
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { afterEach, describe, expect, test } from 'bun:test';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { EXIT } from '../lib/headless-artifacts';
|
||||
import { CHECK_IDS } from '../lib/pregate/index';
|
||||
import { REVIEW_EXCLUDE_KEY_VERSION } from '../lib/ship-policy';
|
||||
import { BASE_POLICY, cleanup, makeFixtureRepo, runBin, type FixtureRepo } from './helpers/restamp-fixture';
|
||||
import { ghQueueShim } from './helpers/ship-queue-fixture';
|
||||
@@ -17,6 +18,7 @@ const repos: FixtureRepo[] = [];
|
||||
afterEach(() => { while (repos.length) cleanup(repos.pop()!); });
|
||||
|
||||
const green = { check_runs: [{ status: 'completed', conclusion: 'success' }] };
|
||||
const FULL_CHECKS = CHECK_IDS.map(id => ({ id, status: 'pass' }));
|
||||
const queue = (repo: FixtureRepo, args: string[], env: Record<string, string>) => runBin(repo, 'gstack-ship-queue', [...args, '--base', 'main'], env);
|
||||
|
||||
function write(repo: FixtureRepo, files: Record<string, string>, message: string): string {
|
||||
@@ -55,7 +57,7 @@ function stackedAfterParentLanded() {
|
||||
const landed = land(repo, 'parent');
|
||||
const tree = runBin(repo, 'gstack-wtree', []).out.trim();
|
||||
const pregate = path.join(repo.root, 'pregate.json');
|
||||
fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: [{ id: 'unit', status: 'pass' }] }));
|
||||
fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: FULL_CHECKS }));
|
||||
const ready = (digest: string) => queue(repo, ['ready', '--pr', '2', '--pregate', pregate], ghQueueShim(repo, { prs: { '2': { headRefOid: head, url: 'https://github.com/o/r/pull/2', body: shippedBody('2', head, { review_exclude: { source: 'origin/main', patterns: ['fixtures/goldens/**'], applied: ['fixtures/goldens/**'], excluded: 1, excluded_bytes: 0, kept: 0, gate_tagged: [], patterns_sha256: 'b'.repeat(64), list_sha256: 'c'.repeat(64), digest } }) } }, checks: { [head]: green } }));
|
||||
const probe = ready('a'.repeat(64));
|
||||
expect(probe.status, probe.out + probe.err).toBe(EXIT.refused);
|
||||
|
||||
Reference in new issue
Block a user