Skip to content

change: wait for container to be in the wanted status#426

Merged
dbasunag merged 8 commits intoopendatahub-io:mainfrom
fege:wait_pod
Jul 15, 2025
Merged

change: wait for container to be in the wanted status#426
dbasunag merged 8 commits intoopendatahub-io:mainfrom
fege:wait_pod

Conversation

@fege
Copy link
Copy Markdown
Contributor

@fege fege commented Jul 11, 2025

Description

How Has This Been Tested?

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@fege fege requested a review from a team as a code owner July 11, 2025 16:27
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 11, 2025

Caution

Review failed

The head commit changed during the review from 4a22c0c to 3a885b9.

📝 Walkthrough

Summary by CodeRabbit

  • Tests

    • Improved reliability of database migration failure tests by ensuring the system waits for the container to reach a crash loop state before verifying error logs.
  • New Features

    • Added a utility to wait for a container to reach a specified status, enhancing test robustness.

Summary by CodeRabbit

  • Tests
    • Improved reliability of database migration failure tests by ensuring the system waits for the container to enter a crash loop state before checking logs.

Walkthrough

A new utility function was introduced to wait for a container within a pod to reach a specific status, specifically "CRASH_LOOPBACK_OFF". This function is now used in a negative test for database migration, ensuring the test waits for the pod to crash before inspecting logs for errors.

Changes

Files/Paths Change Summary
tests/model_registry/negative_tests/... Enhanced test to wait for pod's rest-container to reach crash loop back-off before log inspection.
utilities/general.py Added wait_for_container_status function with retry logic and updated imports for new dependencies.

Possibly related PRs

Suggested labels

lgtm-by-fege

Suggested reviewers

  • lugi0
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@fege
Copy link
Copy Markdown
Contributor Author

fege commented Jul 11, 2025

/verified

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8db035 and 5efdc07.

📒 Files selected for processing (2)
  • tests/model_registry/negative_tests/test_db_migration.py (2 hunks)
  • utilities/general.py (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#409
File: tests/model_registry/negative_tests/test_db_migration.py:47-57
Timestamp: 2025-07-09T08:50:22.172Z
Learning: In negative tests for model registry database migration failures (like test_db_migration_negative), the model registry pod is expected to be in a failed state (not Running) when the database is dirty. The test fetches logs from the failed pod to verify the expected error message about dirty database version, so waiting for Running status would be inappropriate.
utilities/general.py (1)
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#354
File: utilities/user_utils.py:71-76
Timestamp: 2025-06-17T00:29:48.834Z
Learning: In utilities/user_utils.py, the wait_for_user_creation function's retry decorator is intentionally configured to only catch ExceptionUserLogin, not ClusterLoginError. The function catches the result of login_with_user_password and raises ExceptionUserLogin based on the boolean return value, which is the intended retry pattern.
tests/model_registry/negative_tests/test_db_migration.py (6)
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#409
File: tests/model_registry/negative_tests/test_db_migration.py:47-57
Timestamp: 2025-07-09T08:50:22.172Z
Learning: In negative tests for model registry database migration failures (like test_db_migration_negative), the model registry pod is expected to be in a failed state (not Running) when the database is dirty. The test fetches logs from the failed pod to verify the expected error message about dirty database version, so waiting for Running status would be inappropriate.
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#320
File: tests/model_registry/rest_api/conftest.py:257-264
Timestamp: 2025-06-18T08:27:21.114Z
Learning: In tests/model_registry/rest_api/conftest.py, the user fege prefers using next() without a default value to raise StopIteration when the mysql container is not found, rather than gracefully handling it with None checks. This is a deliberate "fail fast" design choice.
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#401
File: tests/model_registry/rest_api/mariadb/conftest.py:89-110
Timestamp: 2025-07-04T00:17:47.799Z
Learning: In tests/model_registry/rest_api/mariadb/conftest.py, the model_registry_with_mariadb fixture should always use OAUTH_PROXY_CONFIG_DICT for the oauth_proxy parameter regardless of the is_model_registry_oauth parameter value, based on expected product behavior for MariaDB-backed ModelRegistry instances.
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#354
File: tests/model_registry/rbac/test_mr_rbac.py:64-77
Timestamp: 2025-06-16T11:26:53.789Z
Learning: In Model Registry RBAC tests, client instantiation tests are designed to verify the ability to create and use the MR python client, with actual API functionality testing covered by separate existing tests.
Learnt from: adolfo-ab
PR: opendatahub-io/opendatahub-tests#334
File: tests/model_explainability/trustyai_service/test_trustyai_service.py:52-65
Timestamp: 2025-06-05T10:05:17.642Z
Learning: For TrustyAI image validation tests: operator image tests require admin_client, related_images_refs, and trustyai_operator_configmap fixtures, while service image tests would require different fixtures like trustyai_service_with_pvc_storage, model_namespace, and current_client_token.
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#354
File: tests/model_registry/rbac/conftest.py:166-175
Timestamp: 2025-06-16T11:25:39.599Z
Learning: In tests/model_registry/rbac/conftest.py, predictable names are intentionally used for test resources (like RoleBindings and groups) instead of random names. This design choice prioritizes exposing cleanup failures from previous test runs through name collisions rather than masking such issues with random names. The philosophy is that test failures should be observable and informative to help debug underlying infrastructure or cleanup issues.
🧬 Code Graph Analysis (2)
utilities/general.py (2)
utilities/constants.py (2)
  • KServeDeploymentType (6-9)
  • Timeout (209-220)
utilities/exceptions.py (2)
  • UnexpectedResourceCountError (121-122)
  • ResourceValueMismatch (125-128)
tests/model_registry/negative_tests/test_db_migration.py (1)
utilities/general.py (1)
  • wait_for_container_status (337-357)
🔇 Additional comments (3)
utilities/general.py (1)

14-15: LGTM: Import additions are appropriate.

The new imports support the utility function being added.

tests/model_registry/negative_tests/test_db_migration.py (2)

10-10: LGTM: Import addition is appropriate.

The new import supports the test enhancement.


55-56: Confirm CrashLoopBackOff status constant in Pod.Status

Since Pod is defined in the external ocp_resources package (not in this repo), we weren’t able to locate CRASH_LOOPBACK_OFF locally. Please verify in your environment that Pod.Status.CRASH_LOOPBACK_OFF exists and corresponds to Kubernetes’ “CrashLoopBackOff” reason. For example:

from ocp_resources.pod import Pod
print([s for s in dir(Pod.Status) if "CRASH" in s])

• File: tests/model_registry/negative_tests/test_db_migration.py
• Lines: 55–56

@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

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

lugi0
lugi0 previously approved these changes Jul 14, 2025
Copy link
Copy Markdown
Contributor

@lugi0 lugi0 left a comment

Choose a reason for hiding this comment

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

LGTM but please double check if the code rabbit suggestion is needed

@fege
Copy link
Copy Markdown
Contributor Author

fege commented Jul 14, 2025

/verified

@rhods-ci-bot rhods-ci-bot added the Verified Verified pr in Jenkins label Jul 14, 2025
@github-actions
Copy link
Copy Markdown

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

@dbasunag
Copy link
Copy Markdown
Collaborator

/build-push-pr-image

dbasunag
dbasunag previously approved these changes Jul 15, 2025
@github-actions
Copy link
Copy Markdown

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

…o#414)

* Add ONNX test case with config files (gRPC/REST templates, conftest, constants) and supporting utils

* Incorporate review comments

Signed-off-by: Vaibhav Jain <vajain@redhat.com>

* Fix pre-commit errors

Signed-off-by: Vaibhav Jain <vajain@redhat.com>

* Incorporate review comments

Signed-off-by: Vaibhav Jain <vajain@redhat.com>

---------

Signed-off-by: Vaibhav Jain <vajain@redhat.com>
Co-authored-by: Vaibhav Jain <vajain@redhat.com>
Co-authored-by: Debarati Basu-Nag <dbasunag@redhat.com>
@github-actions github-actions bot added size/m and removed size/xxl labels Jul 15, 2025
@fege fege requested review from dbasunag and lugi0 July 15, 2025 07:51
@fege
Copy link
Copy Markdown
Contributor Author

fege commented Jul 15, 2025

/verified

@rhods-ci-bot rhods-ci-bot added the Verified Verified pr in Jenkins label Jul 15, 2025
Copy link
Copy Markdown
Contributor

@sheltoncyril sheltoncyril 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 merged commit f4ec852 into opendatahub-io:main Jul 15, 2025
9 of 10 checks passed
@github-actions
Copy link
Copy Markdown

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.

6 participants