@@ -78,7 +78,8 @@ describe('Jenkins resume', () => {
7878 const jobURL = `https://ci.nodejs.org/job/node-test-pull-request/${ jobid } /` ;
7979 const menuURL = `${ jobURL } contextMenu` ;
8080 const unavailableMessage = `Cannot resume PR CI job ${ jobid } : Jenkins does not offer a ` +
81- '"Resume build" action. Start a new CI run with: ' +
81+ '"Resume build" action. Check the existing CI run in Jenkins and rebase the PR if needed. ' +
82+ 'To start a new CI run manually: ' +
8283 `ncu-ci run https://github.com/${ owner } /${ repo } /pull/${ prid } ` ;
8384 const apiURL = `${ jobURL } api/json?tree=${ encodeURIComponent ( resumeTree ) } ` ;
8485 const fullAPIURL = new PRBuild ( null , null , jobid ) . apiUrl ;
@@ -152,10 +153,26 @@ describe('Jenkins resume', () => {
152153 assert . deepEqual ( cli . _calls . stopSpinner . at ( - 1 ) , [
153154 unavailableMessage , cli . SPINNER_STATUS . FAILED
154155 ] ) ;
156+ assert . doesNotMatch ( cli . _calls . stopSpinner . at ( - 1 ) [ 0 ] , / r e q u e s t - c i | r e s u m e - c i / ) ;
155157 assert . deepEqual ( cli . _calls . error , [ [ jobURL ] ] ) ;
156158 } ) ;
157159 }
158160
161+ it ( 'suggests manual recovery for an unavailable nodejs/node run' , async ( ) => {
162+ jobRunner = new ResumePRJob ( cli , request , 'nodejs' , 'node' , prid ) ;
163+ menuRequest . resolves ( { status : 200 , json : async ( ) => ( { items : [ ] } ) } ) ;
164+ assert . equal ( await jobRunner . resume ( ) , false ) ;
165+ sinon . assert . notCalled ( resumeRequest ) ;
166+ assert . deepEqual ( cli . _calls . stopSpinner . at ( - 1 ) , [
167+ `Cannot resume PR CI job ${ jobid } : Jenkins does not offer a "Resume build" action. ` +
168+ 'Check the existing CI run in Jenkins and rebase the PR if needed. ' +
169+ 'To start a new CI run manually: ' +
170+ `ncu-ci run https://github.com/nodejs/node/pull/${ prid } ` ,
171+ cli . SPINNER_STATUS . FAILED
172+ ] ) ;
173+ assert . doesNotMatch ( cli . _calls . stopSpinner . at ( - 1 ) [ 0 ] , / r e q u e s t - c i | r e s u m e - c i / ) ;
174+ } ) ;
175+
159176 describe ( 'resume ancestry' , ( ) => {
160177 const ancestorId = jobid - 1 ;
161178 const resumeCause = ( id , overrides = { } ) => ( {
@@ -1030,16 +1047,20 @@ describe('ncu-ci resume CLI', () => {
10301047 { status : 404 , statusText : 'Not Found' } ) ;
10311048 assert . equal ( status , 1 , output ) ;
10321049 assert . match ( output , / C a n n o t r e s u m e P R C I j o b 6 5 4 3 2 1 : J e n k i n s d o e s n o t o f f e r a " R e s u m e b u i l d " a c t i o n / ) ;
1033- assert . match ( output , / n c u - c i r u n h t t p s : \/ \/ g i t h u b .c o m \/ n o d e j s \/ n o d e \/ p u l l \/ 1 2 3 4 5 6 / ) ;
1050+ assert . ok ( output . includes ( 'Check the existing CI run in Jenkins and rebase the PR if needed. ' +
1051+ 'To start a new CI run manually: ncu-ci run https://github.com/nodejs/node/pull/123456' ) ) ;
1052+ assert . doesNotMatch ( output , / r e q u e s t - c i | r e s u m e - c i / ) ;
10341053 assert . doesNotMatch ( output , / P R C I j o b s u c c e s s f u l l y r e s u m e d / ) ;
10351054 } ) ;
10361055
1037- it ( 'exits 1 with a new-run command when Jenkins offers no resume action' , ( t ) => {
1056+ it ( 'exits 1 with manual recovery guidance when Jenkins offers no resume action' , ( t ) => {
10381057 const { status, output } = run ( t , [ 'resume' , 'https://github.com/nodejs/node/pull/123456' ] ,
10391058 true , 'README.md' , resumeBuildData , approvedSHA , { status : 200 } , { items : [ ] } ) ;
10401059 assert . equal ( status , 1 , output ) ;
10411060 assert . match ( output , / C a n n o t r e s u m e P R C I j o b 6 5 4 3 2 1 : J e n k i n s d o e s n o t o f f e r a " R e s u m e b u i l d " a c t i o n / ) ;
1042- assert . match ( output , / n c u - c i r u n h t t p s : \/ \/ g i t h u b .c o m \/ n o d e j s \/ n o d e \/ p u l l \/ 1 2 3 4 5 6 / ) ;
1061+ assert . ok ( output . includes ( 'Check the existing CI run in Jenkins and rebase the PR if needed. ' +
1062+ 'To start a new CI run manually: ncu-ci run https://github.com/nodejs/node/pull/123456' ) ) ;
1063+ assert . doesNotMatch ( output , / r e q u e s t - c i | r e s u m e - c i / ) ;
10431064 assert . ok ( output . includes ( jobURL ) ) ;
10441065 assert . doesNotMatch ( output , / C h e c k i n g f a i l u r e s | R e s u m i n g P R C I | P R C I j o b s u c c e s s f u l l y r e s u m e d / ) ;
10451066 } ) ;
0 commit comments