@@ -135,7 +135,8 @@ export const operatorAuthUtils = {
135135 Cypress . env ( 'CUSTOM_COO_BUNDLE_IMAGE' ) ,
136136 Cypress . env ( 'FBC_STAGE_COO_IMAGE' ) ,
137137 Cypress . env ( 'MP_IMAGE' ) ,
138- Cypress . env ( 'MCP_CONSOLE_IMAGE' )
138+ Cypress . env ( 'MCP_CONSOLE_IMAGE' ) ,
139+ Cypress . env ( 'CHA_IMAGE' )
139140 ] ;
140141
141142 return [ ...baseKey , ...envVars . filter ( Boolean ) ] ;
@@ -309,15 +310,32 @@ const operatorUtils = {
309310 cy . get ( '[data-test="status-text"]' , { timeout : installTimeoutMilliseconds } ) . eq ( 0 ) . should ( 'contain.text' , 'Succeeded' , { timeout : installTimeoutMilliseconds } ) ;
310311 } ,
311312
312- setupMonitoringConsolePlugin ( MCP : { namespace : string } ) : void {
313- cy . log ( 'Set Monitoring Console Plugin image in operator CSV' ) ;
314- if ( Cypress . env ( 'MCP_CONSOLE_IMAGE' ) ) {
315- cy . log ( 'MCP_CONSOLE_IMAGE is set. the image will be patched in COO operator CSV' ) ;
313+ /**
314+ * Generic function to patch a component image in the COO CSV
315+ * @param MCP - The MCP namespace configuration
316+ * @param config - Configuration for the image patch
317+ * @param config.envVar - The Cypress environment variable name (also used as the shell script env var)
318+ * @param config.scriptPath - Path to the shell script that performs the patch
319+ * @param config.componentName - Human-readable name for logging
320+ */
321+ patchCOOCSVImage (
322+ MCP : { namespace : string } ,
323+ config : {
324+ envVar : string ;
325+ scriptPath : string ;
326+ componentName : string ;
327+ }
328+ ) : void {
329+ const imageValue = Cypress . env ( config . envVar ) ;
330+ cy . log ( `Set ${ config . componentName } image in operator CSV` ) ;
331+
332+ if ( imageValue ) {
333+ cy . log ( `${ config . envVar } is set. The image will be patched in COO operator CSV` ) ;
316334 cy . exec (
317- './cypress/fixtures/coo/update-mcp-image.sh' ,
335+ config . scriptPath ,
318336 {
319337 env : {
320- MCP_CONSOLE_IMAGE : Cypress . env ( 'MCP_CONSOLE_IMAGE' ) ,
338+ [ config . envVar ] : imageValue ,
321339 KUBECONFIG : Cypress . env ( 'KUBECONFIG_PATH' ) ,
322340 MCP_NAMESPACE : `${ MCP . namespace } `
323341 } ,
@@ -326,14 +344,30 @@ const operatorUtils = {
326344 }
327345 ) . then ( ( result ) => {
328346 expect ( result . code ) . to . eq ( 0 ) ;
329- cy . log ( `COO CSV updated successfully with Monitoring Console Plugin image: ${ result . stdout } ` ) ;
347+ cy . log ( `COO CSV updated successfully with ${ config . componentName } image: ${ result . stdout } ` ) ;
330348 cy . reload ( true ) ;
331349 } ) ;
332350 } else {
333- cy . log ( 'MCP_CONSOLE_IMAGE is NOT set. Skipping patching the image in COO operator CSV.' ) ;
351+ cy . log ( ` ${ config . envVar } is NOT set. Skipping patching the image in COO operator CSV.` ) ;
334352 }
335353 } ,
336354
355+ setupMonitoringConsolePlugin ( MCP : { namespace : string } ) : void {
356+ operatorUtils . patchCOOCSVImage ( MCP , {
357+ envVar : 'MCP_CONSOLE_IMAGE' ,
358+ scriptPath : './cypress/fixtures/coo/update-mcp-image.sh' ,
359+ componentName : 'Monitoring Console Plugin'
360+ } ) ;
361+ } ,
362+
363+ setupClusterHealthAnalyzer ( MCP : { namespace : string } ) : void {
364+ operatorUtils . patchCOOCSVImage ( MCP , {
365+ envVar : 'CHA_IMAGE' ,
366+ scriptPath : './cypress/fixtures/coo/update-cha-image.sh' ,
367+ componentName : 'cluster-health-analyzer'
368+ } ) ;
369+ } ,
370+
337371 setupDashboardsAndPlugins ( MCP : { namespace : string } ) : void {
338372
339373 cy . log ( 'Create perses-dev namespace.' ) ;
@@ -797,6 +831,7 @@ Cypress.Commands.add('beforeBlock', (MP: { namespace: string, operatorName: stri
797831 operatorUtils . installCOO ( MCP ) ;
798832 operatorUtils . waitForCOOReady ( MCP ) ;
799833 operatorUtils . setupMonitoringConsolePlugin ( MCP ) ;
834+ operatorUtils . setupClusterHealthAnalyzer ( MCP ) ;
800835 operatorUtils . setupDashboardsAndPlugins ( MCP ) ;
801836 operatorUtils . setupTroubleshootingPanel ( MCP ) ;
802837 operatorUtils . setupMonitoringPluginImage ( MP ) ;
0 commit comments