@@ -240,25 +240,39 @@ export const verifyModelCatalogSourceEnabled = (
240240
241241/**
242242 * Check if a specific model catalog source is currently enabled.
243- * Checks the model-catalog-default-sources ConfigMap for the source's enabled status.
243+ * Checks model-catalog-sources (user overrides) first, then falls back to
244+ * model-catalog-default-sources. This mirrors the precedence used by
245+ * verifyModelCatalogSourceEnabled and the BFF itself.
244246 * @param sourceId The ID of the source to check (e.g., 'redhat_ai_models')
245247 * @returns A Cypress chainable that resolves with true if enabled, false otherwise.
246248 */
247249export const isModelCatalogSourceEnabled = ( sourceId : string ) : Cypress . Chainable < boolean > => {
248250 const namespace = getModelRegistryNamespace ( ) ;
249251 const parseCmd = getYamlParseCommand ( sourceId ) ;
250- const command = `oc get configmap model-catalog-default-sources -n ${ namespace } -o jsonpath='{.data.sources\\.yaml}' | ${ parseCmd } ` ;
252+ const userCommand = `oc get configmap model-catalog-sources -n ${ namespace } -o jsonpath='{.data.sources\\.yaml}' 2>/dev/null | ${ parseCmd } ` ;
253+ const defaultCommand = `oc get configmap model-catalog-default-sources -n ${ namespace } -o jsonpath='{.data.sources\\.yaml}' | ${ parseCmd } ` ;
251254
252- return execWithOutput ( command , 30 ) . then ( ( result : CommandLineResult ) => {
253- if ( result . code !== 0 ) {
254- const maskedStderr = maskSensitiveInfo ( result . stderr ) ;
255- cy . log ( `ERROR: Failed to check source enabled status` ) ;
256- cy . log ( `stderr: ${ maskedStderr } ` ) ;
257- return cy . wrap ( false ) ;
255+ return execWithOutput ( userCommand , 30 ) . then ( ( userResult : CommandLineResult ) => {
256+ const userValue = userResult . stdout . trim ( ) ;
257+
258+ if ( userResult . code === 0 && ( userValue === 'true' || userValue === 'false' ) ) {
259+ const isEnabled = userValue === 'true' ;
260+ cy . log ( `Source ${ sourceId } is currently enabled: ${ isEnabled } (from user configmap)` ) ;
261+ return cy . wrap ( isEnabled ) ;
258262 }
259- const isEnabled = result . stdout . trim ( ) === 'true' ;
260- cy . log ( `Source ${ sourceId } is currently enabled: ${ isEnabled } ` ) ;
261- return cy . wrap ( isEnabled ) ;
263+
264+ return execWithOutput ( defaultCommand , 30 ) . then ( ( defaultResult : CommandLineResult ) => {
265+ if ( defaultResult . code !== 0 ) {
266+ const maskedStderr = maskSensitiveInfo ( defaultResult . stderr ) ;
267+ cy . log ( `ERROR: Failed to check source enabled status` ) ;
268+ cy . log ( `stderr: ${ maskedStderr } ` ) ;
269+ return cy . wrap ( false ) ;
270+ }
271+ const defaultValue = defaultResult . stdout . trim ( ) ;
272+ const isEnabled = defaultValue === '' ? true : defaultValue === 'true' ;
273+ cy . log ( `Source ${ sourceId } is currently enabled: ${ isEnabled } (from default configmap)` ) ;
274+ return cy . wrap ( isEnabled ) ;
275+ } ) ;
262276 } ) ;
263277} ;
264278
0 commit comments