@@ -89,6 +89,26 @@ test('the stable build gate includes every independent correctness check', () =>
8989} ) ;
9090
9191
92+ test ( 'the plugin contract consumer resolves packaged artifacts in a separate Maven invocation' , ( ) => {
93+ const jobs = workflows . get ( 'ci.yml' ) . jobs ;
94+ const job = jobs . plugin_contract ;
95+ assert . ok ( job , 'The external consumer must run in CI' ) ;
96+ assert . deepEqual ( Array . from ( job . needs ) , [ 'changes' ] ) ;
97+ assert . ok ( job . if . includes ( "needs.changes.outputs.code == 'true'" ) ) ;
98+ const commands = job . steps . filter ( step => step . run ) . map ( step => step . run ) ;
99+ const producer = commands . findIndex ( command => command . includes ( '-pl shenyu-web -am install' ) ) ;
100+ const consumer = commands . findIndex ( command => command . includes ( '-f shenyu-examples/shenyu-examples-plugin-contract/pom.xml' ) ) ;
101+ assert . ok ( producer >= 0 && consumer > producer , 'Install the producer before testing the separate consumer' ) ;
102+ assert . ok ( commands [ producer ] . includes ( '-DskipTests' ) ) ;
103+ assert . ok ( ! commands [ producer ] . includes ( '-Dmaven.test.skip' ) ) ;
104+ assert . ok ( commands [ consumer ] . includes ( 'test org.apache.rat:apache-rat-plugin:0.15:check' ) ) ;
105+ assert . ok ( commands [ consumer ] . includes ( '-DfailIfNoTests=true' ) ) ;
106+ assert . ok ( ! commands [ consumer ] . includes ( '-am' ) ) ;
107+ assert . ok ( ! / - D (?: s k i p T e s t s | m a v e n \. t e s t \. s k i p | c h e c k s t y l e \. s k i p | r a t \. s k i p ) (?: [ = \s ] | $ ) / . test ( commands [ consumer ] ) ) ;
108+ assert . ok ( jobs . requirement . needs . includes ( 'plugin_contract' ) ) ;
109+ assert . ok ( jobs . requirement . steps . some ( step => step . run ?. includes ( 'needs.plugin_contract.result' ) ) ) ;
110+ } ) ;
111+
92112test ( 'a slow starter subtree runs once in its own shard' , ( ) => {
93113 const groups = workflows . get ( 'ci.yml' ) . jobs . test_group . strategy . matrix . include ;
94114 const agent = groups . find ( group => group . name === 'starters-agent' ) ;
@@ -283,18 +303,28 @@ test('aggregate jobs still report failures but do not keep cancelled PR runs ali
283303 }
284304} ) ;
285305
286- test ( 'ingress validates the Maven wrapper before its first Maven invocation' , ( ) => {
287- const steps = workflows . get ( 'integrated-test-k8s-ingress.yml' ) . jobs . build . steps ;
288- const preflight = steps . findIndex ( step => step . name === 'Ensure Maven wrapper JAR' ) ;
289- const firstMaven = steps . findIndex ( step => / \. \/ m v n w \b / . test ( step . run ?? '' ) ) ;
290- assert . ok ( preflight >= 0 && firstMaven > preflight ) ;
291- assert . equal ( steps [ preflight ] . shell , 'bash' ) ;
306+ test ( 'CI validates the Maven wrapper before every independent Maven job' , ( ) => {
307+ for ( const [ name , job ] of Object . entries ( workflows . get ( 'ci.yml' ) . jobs ) ) {
308+ const steps = job . steps ?? [ ] ;
309+ const firstMaven = steps . findIndex ( step => / \. \/ m v n w \b / . test ( step . run ?? '' ) ) ;
310+ if ( firstMaven < 0 ) continue ;
311+ const preflight = steps . findIndex ( step => step . run === 'bash .github/scripts/ensure-maven-wrapper.sh' ) ;
312+ assert . ok ( preflight >= 0 && preflight < firstMaven , name ) ;
313+ }
314+ } ) ;
315+
316+ test ( 'integration builds validate the Maven wrapper before their first Maven invocation' , ( ) => {
317+ for ( const name of [ 'integrated-test-k8s-ingress.yml' , 'integrated-test.yml' ] ) {
318+ const steps = workflows . get ( name ) . jobs . build . steps ;
319+ const preflight = steps . findIndex ( step => step . run === 'bash .github/scripts/ensure-maven-wrapper.sh' ) ;
320+ const firstMaven = steps . findIndex ( step => / \. \/ m v n w \b / . test ( step . run ?? '' ) ) ;
321+ assert . ok ( preflight >= 0 && firstMaven > preflight , name ) ;
322+ assert . equal ( steps [ preflight ] . shell , 'bash' ) ;
323+ }
292324} ) ;
293325
294- test ( 'ingress Maven wrapper preflight handles cached, downloaded and failed artifacts' , { timeout : 45000 } , async t => {
295- const preflight = workflows . get ( 'integrated-test-k8s-ingress.yml' ) . jobs . build . steps
296- . find ( step => step . name === 'Ensure Maven wrapper JAR' ) ;
297- assert . ok ( preflight , 'The ingress job must validate the wrapper before running Maven' ) ;
326+ test ( 'Maven wrapper preflight handles cached, downloaded and failed artifacts' , { timeout : 45000 } , async t => {
327+ const preflight = readFileSync ( resolve ( root , '.github/scripts/ensure-maven-wrapper.sh' ) , 'utf8' ) ;
298328 const temporary = mkdtempSync ( resolve ( root , '.github/scripts/.wrapper-test-' ) ) ;
299329 t . after ( ( ) => rmSync ( temporary , { recursive : true , force : true } ) ) ;
300330
@@ -342,7 +372,7 @@ test('ingress Maven wrapper preflight handles cached, downloaded and failed arti
342372 writeFileSync ( resolve ( wrapper , 'maven-wrapper.properties' ) , fixture . missingUrl
343373 ? 'distributionUrl=unused\n'
344374 : `wrapperUrl=http://127.0.0.1:${ server . address ( ) . port } /wrapper.jar\n` ) ;
345- const execution = run ( 'bash' , [ '--noprofile' , '--norc' , '-e' , '-o' , 'pipefail' , '-c' , preflight . run ] , {
375+ const execution = run ( 'bash' , [ '--noprofile' , '--norc' , '-e' , '-o' , 'pipefail' , '-c' , preflight ] , {
346376 cwd : working ,
347377 env : { ...process . env , NO_PROXY : '127.0.0.1' , no_proxy : '127.0.0.1' } ,
348378 timeout : 20000 ,
0 commit comments