An open source design system that's fully customizable and agent ready
TypeScript
test: a main release-check at tonight's load starts within one admission look (AST-030 DEC-16) (#9307)
Cindy Zhangbfaa6177f54b
diff --git a/.github/scripts/ci-admission.test.mjs b/.github/scripts/ci-admission.test.mjsindex 5481de9704..073b7e1abd 100644--- a/.github/scripts/ci-admission.test.mjs+++ b/.github/scripts/ci-admission.test.mjs@@ -396,6 +396,49 @@ describe('ci admission', () => {expect(result.calls).toBe(2 + 3 + 1 + 12);});+ it("starts a main release-check at tonight's load on its second look, which the three-minute floor still held", async () => {+ // 2026-11-01 10:12Z: a release-check on main waited 579 s, its looks+ // reading 85, 83, 64, 60 and 50 other jobs + 36. Tonight's load: CI 38 and+ // Main 6 live, small workflows 5, nine stale runs. 44 + 18 + 36 = 98 is+ // over ninety, so it waits while pull-request runs yield to it; once one+ // pull-request run's 12 jobs end, 32 + 18 + 36 = 86 fits. The runs were+ // admitted under a minute ago, so their jobs have all appeared; the old+ // three-minute window still counted them at their most on the second+ // look, two minutes later, and kept the check waiting.+ const stale = Array.from({length: 9}, (_, i) => ({+ ...slim(720 + i),+ status: 'queued',+ updated_at: ago(3 * 24 * 60),+ }));+ const rest = [+ admittedRun(92, 2, {admittedMinutesAgo: 0.9}),+ admittedRun(93, 7, {admittedMinutesAgo: 0.85}),+ admittedRun(94, 9, {admittedMinutesAgo: 6.6}),+ admittedRun(95, 8, {admittedMinutesAgo: 0.8}),+ admittedRun(96, 6, {+ event: 'push',+ path: '.github/workflows/deploy.yml',+ admittedMinutesAgo: 0.9,+ }),+ ...slims(5),+ ...stale,+ ];+ const tonight = [admittedRun(91, 12, {admittedMinutesAgo: 0.9}), ...rest];+ const result = await admit({+ active: look => (look < 2 ? tonight : rest),+ isMain: true,+ peak: 36,+ });+ expect(result.looks).toBe(2);+ expect(result.warning).toEqual([]);+ expect(result.info).toContain(+ 'Waiting for room: about 62 other jobs + 36.',+ );+ expect(result.info.at(-2)).toContain('about 50 other jobs + 36 <= 90');+ // The second look comes about two minutes in.+ expect(result.lookTimes[1]).toBeLessThanOrEqual(2 * 60_000 + 20_000);+ });+it('counts live jobs, and a run admitted in the last 45 seconds at least at its most', async () => {// 4 x 12 live + 18 small + 13 = 79: room.expect((await admit({active: prs(4), peak: 13})).looks).toBe(1);@@ -411,7 +454,7 @@ describe('ci admission', () => {);});- it("admits at once at tonight's load, which the three-minute floor and stale runs counted as 81", async () => {+ it("admits at once at tonight's load, which the three-minute floor and stale runs counted far over ninety", async () => {// 2026-11-01 ~10:00Z: 49 jobs ran (CI 38, Main 6, small workflows 5)// while pull-request runs waited twelve minutes, "about 81 other jobs".// Runs admitted one to three minutes ago were counted at 16 or 14 though