Skip to content

fix: update automation to reflect the changes around new source for other models#1232

Merged
dbasunag merged 4 commits intoopendatahub-io:mainfrom
dbasunag:automation_bug
Mar 17, 2026
Merged

fix: update automation to reflect the changes around new source for other models#1232
dbasunag merged 4 commits intoopendatahub-io:mainfrom
dbasunag:automation_bug

Conversation

@dbasunag
Copy link
Copy Markdown
Collaborator

@dbasunag dbasunag commented Mar 16, 2026

Pull Request

Summary

Tests needed to be readjusted due to introduction of a new source in default catalog configmap.

Related Issues

  • Fixes:
  • JIRA:

How it has been tested

  • Locally
  • Jenkins

Additional Requirements

  • If this PR introduces a new test image, did you create a PR to mirror it in disconnected environment?
  • If this PR introduces new marker(s)/adds a new component, was relevant ticket created to update relevant Jenkins job?

Summary by CodeRabbit

  • New Features

    • Added a third catalog ("Other Models") to the default model registry, raising available catalogs to three.
    • Models are now identified with source-prefixed identifiers to ensure uniqueness across catalogs.
  • Tests

    • Updated test expectations and filtering behavior to account for the additional catalog and source-prefixed model identifiers.

…ther models

Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com>
@github-actions
Copy link
Copy Markdown

The following are automatically added/executed:

  • PR size label.
  • Run pre-commit
  • Run tox
  • Add PR author as the PR assignee
  • Build image based on the PR

Available user actions:

  • To mark a PR as WIP, add /wip in a comment. To remove it from the PR comment /wip cancel to the PR.
  • To block merging of a PR, add /hold in a comment. To un-block merging of PR comment /hold cancel.
  • To mark a PR as approved, add /lgtm in a comment. To remove, add /lgtm cancel.
    lgtm label removed on each new commit push.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To Cherry-pick a merged PR /cherry-pick <target_branch_name> to the PR. If <target_branch_name> is valid,
    and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
  • To build and push image to quay, add /build-push-pr-image in a comment. This would create an image with tag
    pr-<pr_number> to quay repository. This image tag, however would be deleted on PR merge or close action.
Supported labels

{'/wip', '/cherry-pick', '/lgtm', '/verified', '/build-push-pr-image', '/hold'}

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

This PR expands the test infrastructure to support an additional catalog (OTHER_MODELS_CATALOG_ID), raising the default catalog count from 2 to 3. It introduces source-based filtering by adding a source_id parameter to model set matching logic and refactors hard-coded catalog identifiers into centralized constants. Model names are now prefixed with source IDs to create globally unique identifiers across sources.

Changes

Cohort / File(s) Summary
Catalog Constants & Configuration
tests/model_registry/model_catalog/constants.py, tests/model_registry/model_catalog/conftest.py
Adds constants OTHER_MODELS_CATALOG_ID, SAMPLE_MODEL_NAME3, CATALOG_CONTAINER, REDHAT_AI_CATALOG_ID, OTHER_MODELS, VALIDATED_CATALOG_ID. Adds OTHER_MODELS entry to DEFAULT_CATALOGS. Refactors default catalog keys to use these constants. Prefixes model names in conftest with REDHAT_AI_CATALOG_ID.
Test Utilities & API Filtering
tests/model_registry/model_catalog/catalog_config/utils.py
Adds models_with_source_id(models, source_id) to prefix models with source ID. Updates wait_for_model_set_match signature to accept source_id and propagates it; validate_filter_test_result now passes source_id. Adjusts expected default catalog count from 2 to 3.
Test Cases
tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py, tests/model_registry/model_catalog/catalog_config/test_default_source_inclusion_exclusion_cleanup.py, tests/model_registry/model_catalog/metadata/test_sources_endpoint.py
Updates tests to expect 3 default catalogs. Adds source_id=REDHAT_AI_CATALOG_ID to two wait_for_model_set_match calls in cleanup test. Imports and includes OTHER_MODELS_CATALOG_ID in source/assetType filter expectations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately describes the main change: updating automation tests to handle a new source in the default catalog ConfigMap.
Description check ✅ Passed Description provides a summary of the changes and indicates local testing was performed, but lacks detail on what specifically changed and why the new source requires test adjustments.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/model_registry/model_catalog/catalog_config/utils.py (1)

426-461: Docstring parameter order doesn't match function signature.

Function signature has source_id (line 430) before expected_models (line 431), but docstring documents expected_models (line 440) before source_id (line 441). Update docstring to match actual parameter order.

📝 Proposed docstring fix
     """
     Wait for specific model set to appear using `@retry` decorator.
 
     Args:
         model_catalog_rest_url: API URL list
         model_registry_rest_headers: API headers
         source_label: Source to query
-        expected_models: Expected set of model names
         source_id: Source to query
+        expected_models: Expected set of model names
 
     Returns:
         Set of matched models
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/model_registry/model_catalog/catalog_config/utils.py` around lines 426
- 461, The docstring for wait_for_model_set_match lists the Args in the wrong
order; update the Args section so parameter entries match the function signature
order: model_catalog_rest_url, model_registry_rest_headers, source_label,
source_id, expected_models (with their existing descriptions), ensuring
source_id appears before expected_models to match the signature used in the
function body.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/model_registry/model_catalog/constants.py`:
- Around line 40-46: The constant OTHER_MODELS_CATALOG_ID currently sets
"labels": None which causes AttributeError when other code (e.g., conftest.py
tests that call labels.append() and metadata/utils.py functions that call
labels.extend()) expects a list; update the constant OTHER_MODELS_CATALOG_ID to
use an empty list for "labels" instead of None so it matches the list-based
handling used by validate_default_catalog(), conftest.py, and metadata/utils.py.

---

Nitpick comments:
In `@tests/model_registry/model_catalog/catalog_config/utils.py`:
- Around line 426-461: The docstring for wait_for_model_set_match lists the Args
in the wrong order; update the Args section so parameter entries match the
function signature order: model_catalog_rest_url, model_registry_rest_headers,
source_label, source_id, expected_models (with their existing descriptions),
ensuring source_id appears before expected_models to match the signature used in
the function body.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: eb289dd1-4c2b-4064-85b9-5641b336a59d

📥 Commits

Reviewing files that changed from the base of the PR and between a5ff7e3 and 74099b4.

📒 Files selected for processing (6)
  • tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py
  • tests/model_registry/model_catalog/catalog_config/test_default_source_inclusion_exclusion_cleanup.py
  • tests/model_registry/model_catalog/catalog_config/utils.py
  • tests/model_registry/model_catalog/conftest.py
  • tests/model_registry/model_catalog/constants.py
  • tests/model_registry/model_catalog/metadata/test_sources_endpoint.py

Comment thread tests/model_registry/model_catalog/constants.py
@dbasunag
Copy link
Copy Markdown
Collaborator Author

/build-push-pr-image

@github-actions
Copy link
Copy Markdown

Status of building tag pr-1232: success.
Status of pushing tag pr-1232 to image registry: success.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/model_registry/model_catalog/catalog_config/test_default_source_inclusion_exclusion_cleanup.py (1)

228-265: ⚠️ Potential issue | 🟠 Major

Phase 2 mixes two different expected outcomes.

included_models=["*"] with excluded_models=["*granite*"] should leave every non-granite model in REDHAT_AI_CATALOG_ID, but this block waits for and asserts prometheus_models only. This only passes if that source happens to contain no other non-granite entries. If the intent is “prometheus only”, narrow the phase-2 patch instead of the expectation.

Suggested fix
                 # Verify granite models are removed (cleanup behavior)
                 try:
+                    expected_remaining_models = baseline_redhat_ai_models["api_models"] - granite_models
                     phase2_api_models = wait_for_model_set_match(
                         model_catalog_rest_url=model_catalog_rest_url,
                         model_registry_rest_headers=model_registry_rest_headers,
                         source_label=REDHAT_AI_CATALOG_NAME,
-                        expected_models=prometheus_models,
+                        expected_models=expected_remaining_models,
                         source_id=REDHAT_AI_CATALOG_ID,
                     )
                 except TimeoutExpiredError as e:
-                    pytest.fail(f"Phase 2: Timeout waiting for prometheus models {prometheus_models}: {e}")
+                    pytest.fail(f"Phase 2: Timeout waiting for non-granite models {expected_remaining_models}: {e}")
@@
-                # Should only have prometheus models now
-                assert phase2_api_models == prometheus_models, (
-                    f"Phase 2: Expected only prometheus {prometheus_models}, got {phase2_api_models}"
+                assert phase2_api_models == expected_remaining_models, (
+                    f"Phase 2: Expected non-granite models {expected_remaining_models}, got {phase2_api_models}"
                 )
-                assert phase2_db_models == prometheus_models, "Phase 2: DB should match API"
+                assert phase2_db_models == expected_remaining_models, "Phase 2: DB should match API"

As per coding guidelines, **: REVIEW PRIORITIES: 3. Bug-prone patterns and error handling gaps.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@tests/model_registry/model_catalog/catalog_config/test_default_source_inclusion_exclusion_cleanup.py`
around lines 228 - 265, The test mixes a broad include with a narrow
expectation: in the modify_catalog_source call (phase2_patch) you set
included_models=["*"] and excluded_models=["*granite*"] but then call
wait_for_model_set_match and assert phase2_api_models == prometheus_models;
update the test so the intent matches the patch — either narrow the phase2_patch
included_models to target prometheus only (e.g., include pattern matching
prometheus) or change the expectation to compute/verify the set of all
non-granite models for REDHAT_AI_CATALOG_ID (use the same filtering logic used
by modify_catalog_source) and assert phase2_api_models and phase2_db_models
equal that non-granite set, and adjust the LOGGER message accordingly.
♻️ Duplicate comments (1)
tests/model_registry/model_catalog/constants.py (1)

40-45: ⚠️ Potential issue | 🟠 Major

Use a list for OTHER_MODELS_CATALOG_ID["labels"].

The other DEFAULT_CATALOGS entries use a list here, and the catalog update helpers mutate labels with list operations. Keeping this source at None turns the first append/extend into an AttributeError.

Suggested fix
     OTHER_MODELS_CATALOG_ID: {
         "name": OTHER_MODELS,
         "type": "yaml",
         "properties": {"yamlCatalogPath": "/shared-data/other-models-catalog.yaml"},
-        "labels": None,
+        "labels": [],
         "enabled": True,
     },

As per coding guidelines, **: REVIEW PRIORITIES: 3. Bug-prone patterns and error handling gaps.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/model_registry/model_catalog/constants.py` around lines 40 - 45, The
OTHER_MODELS_CATALOG_ID entry in DEFAULT_CATALOGS sets "labels" to None which
causes an AttributeError when catalog update helpers perform list mutations;
change the "labels" value for OTHER_MODELS_CATALOG_ID to an empty list ([]) so
functions that call list methods (e.g., append/extend) on labels operate safely;
locate the dictionary named OTHER_MODELS_CATALOG_ID in
tests/model_registry/model_catalog/constants.py and replace the None labels
value with an empty list.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@tests/model_registry/model_catalog/catalog_config/test_default_source_inclusion_exclusion_cleanup.py`:
- Around line 228-265: The test mixes a broad include with a narrow expectation:
in the modify_catalog_source call (phase2_patch) you set included_models=["*"]
and excluded_models=["*granite*"] but then call wait_for_model_set_match and
assert phase2_api_models == prometheus_models; update the test so the intent
matches the patch — either narrow the phase2_patch included_models to target
prometheus only (e.g., include pattern matching prometheus) or change the
expectation to compute/verify the set of all non-granite models for
REDHAT_AI_CATALOG_ID (use the same filtering logic used by
modify_catalog_source) and assert phase2_api_models and phase2_db_models equal
that non-granite set, and adjust the LOGGER message accordingly.

---

Duplicate comments:
In `@tests/model_registry/model_catalog/constants.py`:
- Around line 40-45: The OTHER_MODELS_CATALOG_ID entry in DEFAULT_CATALOGS sets
"labels" to None which causes an AttributeError when catalog update helpers
perform list mutations; change the "labels" value for OTHER_MODELS_CATALOG_ID to
an empty list ([]) so functions that call list methods (e.g., append/extend) on
labels operate safely; locate the dictionary named OTHER_MODELS_CATALOG_ID in
tests/model_registry/model_catalog/constants.py and replace the None labels
value with an empty list.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 182e69b2-8d79-4bb4-a4be-b55aa2afea65

📥 Commits

Reviewing files that changed from the base of the PR and between 74099b4 and 9c02032.

📒 Files selected for processing (4)
  • tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py
  • tests/model_registry/model_catalog/catalog_config/test_default_source_inclusion_exclusion_cleanup.py
  • tests/model_registry/model_catalog/constants.py
  • tests/model_registry/model_catalog/metadata/test_sources_endpoint.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py
  • tests/model_registry/model_catalog/metadata/test_sources_endpoint.py

Copy link
Copy Markdown
Contributor

@fege fege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Copy Markdown
Contributor

@fege fege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@SB159
Copy link
Copy Markdown
Contributor

SB159 commented Mar 17, 2026

/lgtm

@dbasunag dbasunag enabled auto-merge (squash) March 17, 2026 13:57
@dbasunag dbasunag merged commit 59e57c4 into opendatahub-io:main Mar 17, 2026
9 checks passed
@dbasunag dbasunag deleted the automation_bug branch March 17, 2026 13:59
@github-actions
Copy link
Copy Markdown

Status of building tag latest: success.
Status of pushing tag latest to image registry: success.

ssaleem-rh pushed a commit to ssaleem-rh/opendatahub-tests that referenced this pull request Mar 23, 2026
…ther models (opendatahub-io#1232)

Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com>
Signed-off-by: Shehan Saleem <ssaleem@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants