@@ -21,7 +21,9 @@ const read = file => yaml.parse(fs.readFileSync(path.join(root, file), 'utf8'));
2121const workflow = read ( '.github/workflows/a11y-contract-shard.yml' ) ;
2222const ci = read ( '.github/workflows/ci.yml' ) ;
2323const job = workflow . jobs . shard ;
24- const step = name => job . steps . find ( item => item . name === name ) ;
24+ const room = workflow . jobs . room ;
25+ const step = name =>
26+ [ ...room . steps , ...job . steps ] . find ( item => item . name === name ) ;
2527const releaseLeg = ci . jobs [ 'a11y-contracts-shard' ] ;
2628const releaseStep = releaseLeg . steps . find (
2729 item => item . name === 'Run accessibility spec-test contracts' ,
@@ -37,10 +39,43 @@ describe('the single contract-leg dispatch', () => {
3739 ] ) ;
3840 expect ( workflow . permissions ) . toEqual ( { } ) ;
3941 expect ( job . permissions ) . toEqual ( { contents : 'read' } ) ;
42+ expect ( room . permissions ) . toEqual ( {
43+ actions : 'read' ,
44+ contents : 'read' ,
45+ 'pull-requests' : 'read' ,
46+ } ) ;
47+ } ) ;
48+
49+ it ( 'waits for room under the CI ceiling as a pull-request run does, so a main check or release re-check fits first' , ( ) => {
50+ expect ( job . needs ) . toEqual ( [ 'room' ] ) ;
51+ // The inputs are checked before the wait.
52+ expect ( room . steps [ 0 ] . name ) . toBe ( 'Check the inputs' ) ;
53+ const wait = step ( 'Wait for room under the CI ceiling' ) ;
54+ expect ( wait . uses ) . toBe ( './.ci-admission/.github/actions/ci-admission' ) ;
55+ expect ( wait . with ) . toEqual ( {
56+ phase : 'whole' ,
57+ peak : 2 ,
58+ main : 'false' ,
59+ 'max-wait-minutes' : 120 ,
60+ 'max-looks' : 30 ,
61+ } ) ;
62+ // The admission action comes from the dispatched ref (main), not the
63+ // commit under test.
64+ expect ( step ( 'Check out the admission action' ) . with ) . toEqual ( {
65+ 'sparse-checkout' :
66+ '.github/actions/ci-admission\n.github/scripts/lib\nscripts/lib\n' ,
67+ path : '.ci-admission' ,
68+ 'persist-credentials' : false ,
69+ } ) ;
70+ expect ( step ( 'Stop when CI is full' ) . if ) . toBe (
71+ "steps.room.outputs.full == 'true'" ,
72+ ) ;
73+ // A standard runner: the wait outlasts a slim job's fifteen minutes.
74+ expect ( room [ 'runs-on' ] ) . toBe ( 'ubuntu-latest' ) ;
4075 } ) ;
4176
4277 it ( 'never puts an input into a script: each reaches it through the environment' , ( ) => {
43- for ( const item of job . steps . filter ( entry => entry . run ) )
78+ for ( const item of [ ... room . steps , ... job . steps ] . filter ( entry => entry . run ) )
4479 expect ( item . run , item . name ) . not . toContain ( '${{' ) ;
4580 } ) ;
4681
0 commit comments