@@ -12,17 +12,24 @@ import { FIPS_GH_LABELS, FIPS_VERSION } from '#pipeline-utils/pr_labels';
1212
1313const mockAreChangesSkippable = jest . fn ( ) ;
1414const mockDoAnyChangesMatch = jest . fn ( ) ;
15+ const mockDoAllChangesMatch = jest . fn ( ) ;
1516const mockGetAgentImageConfig = jest . fn ( ) ;
17+ const mockFlushCancelOnGateFailureMetadata = jest . fn ( ) ;
1618const mockRunPreBuild = jest . fn ( ) ;
1719const mockGetEvalPipeline = jest . fn ( ) ;
20+ const mockIsAutomatedVersionBumpPR = jest . fn ( ) ;
1821
1922jest . mock ( '#pipeline-utils' , ( ) => {
2023 const actual = jest . requireActual ( '#pipeline-utils' ) ;
2124 return {
2225 ...actual ,
26+ getKibanaDir : jest . fn ( ) . mockReturnValue ( '/kibana' ) ,
2327 areChangesSkippable : mockAreChangesSkippable ,
2428 doAnyChangesMatch : mockDoAnyChangesMatch ,
29+ doAllChangesMatch : mockDoAllChangesMatch ,
2530 getAgentImageConfig : mockGetAgentImageConfig ,
31+ flushCancelOnGateFailureMetadata : mockFlushCancelOnGateFailureMetadata ,
32+ isAutomatedVersionBumpPR : mockIsAutomatedVersionBumpPR ,
2633 } ;
2734} ) ;
2835
@@ -60,7 +67,7 @@ const waitForExit = () => {
6067
6168describe ( 'pull_request pipeline generation' , ( ) => {
6269 beforeEach ( ( ) => {
63- jest . clearAllMocks ( ) ;
70+ jest . resetAllMocks ( ) ;
6471 jest . resetModules ( ) ;
6572 process . env = { ...ORIGINAL_ENV } ;
6673
@@ -69,9 +76,11 @@ describe('pull_request pipeline generation', () => {
6976
7077 mockAreChangesSkippable . mockResolvedValue ( false ) ;
7178 mockDoAnyChangesMatch . mockResolvedValue ( false ) ;
79+ mockDoAllChangesMatch . mockResolvedValue ( false ) ;
7280 mockGetAgentImageConfig . mockReturnValue ( 'agents:\n provider: gcp\n' ) ;
7381 mockRunPreBuild . mockResolvedValue ( undefined ) ;
7482 mockGetEvalPipeline . mockReturnValue ( null ) ;
83+ mockIsAutomatedVersionBumpPR . mockResolvedValue ( false ) ;
7584 } ) ;
7685
7786 afterEach ( ( ) => {
@@ -95,7 +104,7 @@ describe('pull_request pipeline generation', () => {
95104 } ) ;
96105
97106 it ( 'emits valid renovate-only pipeline and skips pre-build' , async ( ) => {
98- mockAreChangesSkippable . mockResolvedValueOnce ( false ) . mockResolvedValueOnce ( true ) ;
107+ mockDoAllChangesMatch . mockResolvedValueOnce ( true ) ;
99108 const warnSpy = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
100109 const emitted = waitForEmission ( ) ;
101110
@@ -164,4 +173,17 @@ describe('pull_request pipeline generation', () => {
164173 expect . any ( Error )
165174 ) ;
166175 } ) ;
176+
177+ it ( 'emits empty pipeline for automated version bump PRs from kibanamachine' , async ( ) => {
178+ mockIsAutomatedVersionBumpPR . mockResolvedValueOnce ( true ) ;
179+ const emitted = waitForEmission ( ) ;
180+
181+ await importPipelineModule ( ) ;
182+ const output = await emitted ;
183+
184+ const parsed = yamlLoad ( output ) as Record < string , unknown > ;
185+ expect ( parsed ) . toEqual ( { steps : [ ] } ) ;
186+ expect ( mockRunPreBuild ) . not . toHaveBeenCalled ( ) ;
187+ expect ( mockAreChangesSkippable ) . not . toHaveBeenCalled ( ) ;
188+ } ) ;
167189} ) ;
0 commit comments