Skip to content

test: add new test for no assetType#1364

Merged
dbasunag merged 2 commits intoopendatahub-io:mainfrom
dbasunag:tests_for_label
Apr 7, 2026
Merged

test: add new test for no assetType#1364
dbasunag merged 2 commits intoopendatahub-io:mainfrom
dbasunag:tests_for_label

Conversation

@dbasunag
Copy link
Copy Markdown
Collaborator

@dbasunag dbasunag commented Apr 7, 2026

Pull Request

Summary

Related Issues

  • Fixes:
  • JIRA:

Please review and indicate 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

  • Tests
    • Added test coverage for labels API endpoint default behavior when called without asset type parameters, validating proper response filtering.

Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com>

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

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', '/hold', '/lgtm', '/verified', '/build-push-pr-image'}

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

A new test function validates the default behavior of the labels API endpoint when invoked without an asset_type parameter, asserting that the response is non-empty and all returned labels have assetType equal to "models".

Changes

Cohort / File(s) Summary
Labels API Test Coverage
tests/model_registry/model_catalog/metadata/test_labels_endpoint.py
Added test test_labels_endpoint_default_no_asset_type() to validate API behavior when asset_type parameter is omitted. Includes mismatch validation logic and separate control flow for default behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description uses the required template structure but the Summary section is empty, providing no substantive explanation of what the test does or why it is needed. Fill in the Summary section with a brief description of what the new test validates and the business/technical need it addresses.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: add new test for no assetType' directly describes the main change: adding a new test for the no assetType scenario.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

🤖 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/metadata/test_labels_endpoint.py`:
- Around line 57-63: The test currently only checks non-empty api_labels and
assetType values which can miss regressions; update the test to call the labels
endpoint twice — once with no params (api_labels) and once with the explicit
query asset_type="models" (e.g., api_labels_models) — then assert that the two
responses are equivalent by invoking the existing verify_labels_match helper to
compare them, replacing the mismatches list/assert; ensure you still assert
non-empty and that verify_labels_match is used for consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 6dbc120f-a6e4-4af8-b663-e8c3934f447b

📥 Commits

Reviewing files that changed from the base of the PR and between 64e4e96 and 928c75f.

📒 Files selected for processing (1)
  • tests/model_registry/model_catalog/metadata/test_labels_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

@SB159 SB159 left a comment

Choose a reason for hiding this comment

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

/lgtm

@dbasunag dbasunag enabled auto-merge (squash) April 7, 2026 12:56
@dbasunag dbasunag merged commit d3bb355 into opendatahub-io:main Apr 7, 2026
9 checks passed
@dbasunag dbasunag deleted the tests_for_label branch April 7, 2026 13:13
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

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

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