Skip to content

test: Add test for kserve-raw model car#337

Merged
mwaykole merged 3 commits intoopendatahub-io:mainfrom
mwaykole:oci-test
Jun 5, 2025
Merged

test: Add test for kserve-raw model car#337
mwaykole merged 3 commits intoopendatahub-io:mainfrom
mwaykole:oci-test

Conversation

@mwaykole
Copy link
Copy Markdown
Member

@mwaykole mwaykole commented Jun 4, 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

Summary by CodeRabbit

  • New Features

    • Added a new constant for the Model Car MNIST image reference, improving test configuration flexibility.
  • Tests

    • Enhanced test coverage to support multiple deployment modes (serverless and raw deployment) for model car inference.
    • Updated test logic to allow a higher threshold for container restart counts before marking as failure.
    • Improved parameterization and marker usage for more comprehensive deployment scenario testing.
    • Generalized test fixtures to dynamically handle multiple deployment modes and external routing options.

Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>
@mwaykole mwaykole requested a review from a team as a code owner June 4, 2025 18:24
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 4, 2025

Walkthrough

The changes introduce support for multiple deployment modes in the model car inference service fixture, parameterize tests to run with both serverless and raw deployment modes, and centralize the OCI image reference in a new constant. Test logic is updated to accommodate these enhancements, including a relaxed threshold for container restart failures.

Changes

File(s) Change Summary
tests/model_serving/model_server/model_car/conftest.py Fixture renamed and now dynamically determines deployment mode and external routing from test parameters.
tests/model_serving/model_server/model_car/test_oci_image.py Tests parameterized for serverless and raw deployment; use new image constant; adjust restart threshold; updated fixture name.
utilities/constants.py Added ModelCarImage class with MNIST_8_1 OCI image reference constant.

Suggested labels

size/l, lgtm-by-mwaykole

Suggested reviewers

  • dbasunag

Poem

In the warren, tests now hop with glee,
Deployment modes as far as eyes can see!
Serverless or raw, the bunnies decide,
With image constants by their side.
Fewer restarts, more robust fun—
Model cars race, and all tests run!
🐇✨

✨ 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 4, 2025

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', '/hold', '/lgtm', '/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: 0

🧹 Nitpick comments (2)
utilities/constants.py (1)

214-218: Add class docstring and address line length issue.

The centralization of the OCI image reference is a good practice. However, please address the following code quality issues:

+class ModelCarImage:
+    """Constants for model car OCI image references."""
+    MNIST_8_1: str = (
+        "oci://quay.io/mwaykole/test@sha256:"
+        "8a3217bcfa2cc5fa3d07496cff8b234acdf2c9725dd307dc0a80401f55e1a11c"
+    )
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 216-216: Line too long (123/100)

(C0301)


[convention] 214-214: Missing class docstring

(C0115)


[refactor] 214-214: Too few public methods (0/2)

(R0903)

tests/model_serving/model_server/model_car/test_oci_image.py (1)

5-5: Address line length issue in import statement.

-from utilities.constants import ModelCarImage, ModelFormat, ModelName, Protocols, RuntimeTemplates, KServeDeploymentType
+from utilities.constants import (
+    KServeDeploymentType,
+    ModelCarImage,
+    ModelFormat,
+    ModelName,
+    Protocols,
+    RuntimeTemplates,
+)
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 5-5: Line too long (120/100)

(C0301)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55baa49 and 09fd814.

📒 Files selected for processing (3)
  • tests/model_serving/model_server/model_car/conftest.py (1 hunks)
  • tests/model_serving/model_server/model_car/test_oci_image.py (3 hunks)
  • utilities/constants.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/model_serving/model_server/model_car/conftest.py (2)
utilities/constants.py (1)
  • KServeDeploymentType (6-9)
utilities/inference_utils.py (1)
  • create_isvc (517-717)
🪛 Pylint (3.3.7)
utilities/constants.py

[convention] 216-216: Line too long (123/100)

(C0301)


[convention] 214-214: Missing class docstring

(C0115)


[refactor] 214-214: Too few public methods (0/2)

(R0903)

tests/model_serving/model_server/model_car/test_oci_image.py

[convention] 5-5: Line too long (120/100)

(C0301)


[convention] 56-56: Line too long (111/100)

(C0301)

🔇 Additional comments (5)
tests/model_serving/model_server/model_car/test_oci_image.py (2)

12-45: LGTM: Well-structured parameterized tests for multiple deployment modes.

The parameterization correctly covers both serverless and raw deployment modes using the same OCI image, with appropriate pytest markers for each case.

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 13-13: Line too long (106/100)

(C0301)


56-56:

Details

❓ Verification inconclusive

Verify the increased restart threshold is appropriate.

The restart threshold was changed from > 1 to > 2. This change could potentially mask legitimate restart issues and should be justified.

Please verify this change is necessary by running the following script to check if there are documented issues with container restarts in model car deployments:


🏁 Script executed:

#!/bin/bash
# Description: Search for documentation or issues related to model car container restarts
# Expected: Evidence that >2 restarts is a reasonable threshold

# Search for restart-related issues in code comments
rg -i "restart.*model.*car|model.*car.*restart" --type py -A 3 -B 3

# Search for restart threshold configurations in other tests
rg "restartCount.*>" --type py -A 2 -B 2

# Search for any TODO/FIXME comments related to restarts
rg -i "todo.*restart|fixme.*restart|restart.*todo|restart.*fixme" --type py

Length of output: 2631


Verify restart threshold change

The test in tests/model_serving/model_server/model_car/test_oci_image.py now treats any container with restartCount > 2 as a failure, whereas elsewhere we only guard against restartCount > 0. Raising the threshold to 2 could mask legitimate restart issues unless justified by past pod behavior.

• Location:

  • tests/model_serving/model_server/model_car/test_oci_image.py:56

• Diff snippet:

-    container.name for container in pod.instance.status.containerStatuses if container.restartCount > 1
+    container.name for container in pod.instance.status.containerStatuses if container.restartCount > 2

Please confirm that allowing up to two restarts for model car pods is intentional and supported by deployment metrics or documented incidents.

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 56-56: Line too long (111/100)

(C0301)

tests/model_serving/model_server/model_car/conftest.py (3)

21-21: LGTM: Dynamic deployment mode extraction.

Good implementation of extracting the deployment mode from request parameters with a sensible default.


24-24: LGTM: Service naming includes deployment mode for better test isolation.

Including the deployment mode in the service name helps differentiate between test instances and avoids potential conflicts.


29-30: LGTM: Well-structured parameter passing to create_isvc.

The dynamic deployment mode and external route parameters are properly extracted and passed to the inference service creation function.

Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>
Raghul-M
Raghul-M previously approved these changes Jun 5, 2025
Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>
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 UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7fa2a68 and da9ae3b.

📒 Files selected for processing (1)
  • tests/model_serving/model_server/model_car/test_oci_image.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/model_serving/model_server/model_car/test_oci_image.py (5)
utilities/constants.py (6)
  • ModelCarImage (214-217)
  • ModelFormat (12-19)
  • ModelName (22-27)
  • Protocols (87-94)
  • RuntimeTemplates (65-73)
  • KServeDeploymentType (6-9)
utilities/inference_utils.py (1)
  • Inference (44-138)
tests/model_serving/model_server/model_car/conftest.py (1)
  • model_car_inference_service (15-33)
utilities/infra.py (1)
  • get_pods_by_isvc_label (471-498)
tests/model_serving/model_server/utils.py (1)
  • verify_inference_response (20-169)
🔇 Additional comments (6)
tests/model_serving/model_server/model_car/test_oci_image.py (6)

5-5: Good practice: Using constants for deployment types.

The import of KServeDeploymentType helps avoid magic strings and improves maintainability.


9-9: LGTM: Global markers align with parameterized tests.

The pytestmark correctly includes both serverless and rawdeployment markers to match the deployment types being tested.


13-13: Good refactoring: Generalized fixture name.

The fixture name change from model_car_serverless_inference_service to model_car_inference_service aligns with the generalized fixture in conftest.py that supports multiple deployment modes.


24-24: Excellent: Centralized OCI image reference.

Using the ModelCarImage.MNIST_8_1 constant instead of a hardcoded string improves maintainability and reduces the risk of typos.


25-42: LGTM: Comprehensive parameterization for deployment modes.

The parameterization correctly tests both SERVERLESS and RAW_DEPLOYMENT modes with appropriate pytest markers. This ensures the model car functionality works across different deployment scenarios.


49-71: LGTM: Test methods updated to use generalized fixture.

Both test methods correctly use the updated model_car_inference_service fixture, enabling them to run across different deployment modes.

@mwaykole mwaykole requested review from adolfo-ab and rnetser June 5, 2025 07:44
@mwaykole mwaykole enabled auto-merge (squash) June 5, 2025 09:03
@mwaykole mwaykole disabled auto-merge June 5, 2025 09:03
@mwaykole mwaykole enabled auto-merge (squash) June 5, 2025 09:05
@mwaykole mwaykole disabled auto-merge June 5, 2025 09:58
@mwaykole mwaykole merged commit eade4c8 into opendatahub-io:main Jun 5, 2025
11 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 5, 2025

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

adolfo-ab pushed a commit to adolfo-ab/opendatahub-tests that referenced this pull request Jun 11, 2025
* test: Add test for kserve-raw model car

Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>

* test: Add test for kserve-raw model car

Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>

* test: Add test for kserve-raw model car

Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>

---------

Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>
Co-authored-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>
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