Add Testsuite for Triton KServe Models (Rest and gRPC)#414
Add Testsuite for Triton KServe Models (Rest and gRPC)#414Raghul-M merged 7 commits intoopendatahub-io:mainfrom
Conversation
…constants) and supporting utils
📝 WalkthroughSummary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis update introduces comprehensive support for Triton model serving runtime tests, including new pytest fixtures, utility functions, and constants for configuring and validating inference via REST and gRPC protocols. It adds ONNX model inference tests with snapshot validation, centralizes S3 secret creation for test environments, and refines runtime image configuration options. Changes
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learningstests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (6)🔇 Additional comments (9)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
|
The following are automatically added/executed:
Available user actions:
Supported labels{'/lgtm', '/cherry-pick', '/wip', '/build-push-pr-image', '/verified', '/hold'} |
There was a problem hiding this comment.
Actionable comments posted: 6
♻️ Duplicate comments (3)
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json (2)
10-11: Same “shape as string” inconsistency as the other gRPC snapshotSee earlier comment – make the
shapeelement consistently integer or string across snapshots.
14-16: Large base-64 payload – repository size concernSame comment as for the serverless-grpc snapshot.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-rest-deployment].json (1)
6-1013: Same large-float-array concern as raw-REST snapshotSee previous comment – prefer toleranced checks or trimmed expectations to keep the repo slim and maintenance-friendly.
🧹 Nitpick comments (8)
tests/model_serving/model_runtime/triton/constant.py (2)
77-92: Type annotation is unreadable & wrong
PREDICT_RESOURCESis annotated as
dict[str, Union[list[dict[str, Union[str, dict[str, str]]]], dict[str, dict[str, str]]]],
which doesn’t match the actual structure (volumes,volume_mounts,resources).
Prefer a TypedDict or dataclass, or simply drop the overly complexUnion[…]here.
55-58: Hard-coded path prefixes block reuse
MODEL_PATH_PREFIX_*are cluster-specific. Consider moving them to a fixture or env-config so the same test-suite works on non-GPU clusters without code edits.tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py (1)
83-83: Fix class naming convention.The class name should follow PascalCase convention for better readability.
-class TestdensenetonnxModel: +class TestDensenetOnnxModel:tests/model_serving/model_runtime/triton/basic_model_deployment/triton_rest_serving_template.yaml (1)
54-55: Consider enabling autoSelect for PyTorch model format.For consistency with other model formats, consider enabling autoSelect for PyTorch.
- - name: pytorch + - autoSelect: true + name: pytorch + priority: 1 version: "1"tests/model_serving/model_runtime/triton/basic_model_deployment/triton_grpc_serving_template.yaml (1)
58-59: Consider enabling autoSelect for PyTorch model format.For consistency with other model formats and the REST template, consider enabling autoSelect for PyTorch.
- - name: pytorch + - autoSelect: true + name: pytorch + priority: 1 version: "1"tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py (1)
83-83: Extract magic number to a constant.The threshold value for stdin should be defined as a constant for better maintainability.
Add at the top of the file after imports:
GRPC_INLINE_PAYLOAD_THRESHOLD = 8000 # bytesThen update line 83:
- use_stdin = len(input_str.encode("utf-8")) > 8000 + use_stdin = len(input_str.encode("utf-8")) > GRPC_INLINE_PAYLOAD_THRESHOLDtests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-grpc-deployment].json (1)
14-16: Enormous base-64 payload bloats the repository
rawOutputContentsstores ~4 MB of base-64 text in every gRPC snapshot.
This balloons the Git history and slows cloning.Typical approaches:
- "rawOutputContents": [ - "<4 MB base-64>" - ] + "rawOutputContents": "<sha256 digest of tensor>" // compare against digest at runtimeor store the blob under
tests/_artifacts/and read it on demand.Consider one of the above to keep the repo lean.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-rest-deployment].json (1)
6-1013: Snapshot dwarfs source – consider toleranced assertions insteadStoring 1 000 FP32 logits (~8 kB) is fine, but four nearly-identical snapshots multiply quickly.
You can instead:
- Assert only the top-%K class indices / probabilities, or
- Compare each output with
pytest.approx(tol)instead of literal snapshot equality, generating inputs on-the-fly.Benefits: smaller repo, no manual updates when framework changes minutely affect floats.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-rest-deployment].json(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-grpc-deployment].json(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-rest-deployment].json(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/triton_grpc_serving_template.yaml(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/triton_rest_serving_template.yaml(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py(1 hunks)tests/model_serving/model_runtime/triton/constant.py(1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
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: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch. This file should be excluded from Buf linting as it's a reference implementation.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-grpc-deployment].json (2)
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch. This file should be excluded from Buf linting as it's a reference implementation.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json (2)
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch. This file should be excluded from Buf linting as it's a reference implementation.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py (1)
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.
tests/model_serving/model_runtime/triton/basic_model_deployment/triton_rest_serving_template.yaml (3)
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch. This file should be excluded from Buf linting as it's a reference implementation.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:15-17
Timestamp: 2025-06-03T06:31:57.214Z
Learning: The file utilities/manifests/common/grpc_predict_v2.proto is from the KServe V2 inference protocol standard and should not be modified to comply with local directory structure conventions.
tests/model_serving/model_runtime/triton/basic_model_deployment/triton_grpc_serving_template.yaml (3)
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch. This file should be excluded from Buf linting as it's a reference implementation.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:15-17
Timestamp: 2025-06-03T06:31:57.214Z
Learning: The file utilities/manifests/common/grpc_predict_v2.proto is from the KServe V2 inference protocol standard and should not be modified to comply with local directory structure conventions.
tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py (3)
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
Learnt from: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
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.
tests/model_serving/model_runtime/triton/constant.py (5)
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#328
File: tests/model_serving/model_runtime/mlserver/constant.py:20-25
Timestamp: 2025-06-16T05:50:12.556Z
Learning: In the MLServer test suite, the PROTO_FILE_PATH constant is intentionally kept as a relative path string and is used together with the root_dir fixture to construct absolute paths at runtime when accessing the grpc_predict_v2.proto file.
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:15-17
Timestamp: 2025-06-03T06:31:57.214Z
Learning: The file utilities/manifests/common/grpc_predict_v2.proto is from the KServe V2 inference protocol standard and should not be modified to comply with local directory structure conventions.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch. This file should be excluded from Buf linting as it's a reference implementation.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (6)
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.
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: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
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.
🪛 GitHub Actions: Tox Tests
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-grpc-deployment].json
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-rest-deployment].json
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/triton_rest_serving_template.yaml
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-rest-deployment].json
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/triton_grpc_serving_template.yaml
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py
[error] Pytest collection failed due to missing file error in conftest.py import dependency.
🔇 Additional comments (1)
tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-serverless-grpc-deployment].json (1)
10-11: Shape field is a string – double-check schema consistency with other snapshotsIn this gRPC snapshot
shapecontains"1000"as a string, while the REST snapshots encode it as the numeric value1000. If the test utilities deserialize the response to ints before the comparison, this will pass silently; otherwise the test will fail or require special-case logic.Uniformly use either an int or a string across all snapshots to avoid hidden brittle code paths.
tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py
Show resolved
Hide resolved
.../model_serving/model_runtime/triton/basic_model_deployment/triton_grpc_serving_template.yaml
Outdated
Show resolved
Hide resolved
tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
Outdated
Show resolved
Hide resolved
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py
Show resolved
Hide resolved
| grpc_template_yaml = TEMPLATE_FILE_PATH.get(Protocols.GRPC) | ||
| with Template( | ||
| client=admin_client, | ||
| yaml_file=grpc_template_yaml, |
There was a problem hiding this comment.
Avoid using yamls, throughout this repo we try to use Python classes and dicts. Also there is a lot of fields that can be reused between the two triton template files.
There was a problem hiding this comment.
replace the template YAML file with Python function
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py
Outdated
Show resolved
Hide resolved
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def cleanup_existing_isvc(request: SubRequest, admin_client: DynamicClient, model_namespace: Namespace) -> None: |
There was a problem hiding this comment.
I can't find where thid fixture is used, and I think we don't need it. Few tips:
- Fixtures represent objects, not actions, so from pytest pov it doesn't make sense to have a fixture that does the cleanup action. Instead, the object fixture itself (in this case, the isvc), shoudl handle its own cleanup.
- In 99% of the cases, openshift-python-wrapper should handle the cleanup automatically
There was a problem hiding this comment.
remove isvc cleanup function
tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
Show resolved
Hide resolved
tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (1)
264-276: Consider if this cleanup fixture is necessary.Based on previous review feedback, fixtures should represent objects rather than actions, and openshift-python-wrapper typically handles cleanup automatically. However, this fixture serves a specific purpose of cleaning up leftover resources from failed previous runs.
Consider whether this pre-test cleanup is essential or if the regular fixture cleanup mechanisms are sufficient.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (7)
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.
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: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: dbasunag
PR: opendatahub-io/opendatahub-tests#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#320
File: tests/model_registry/rest_api/conftest.py:200-216
Timestamp: 2025-06-05T14:32:40.247Z
Learning: In the opendatahub-tests repository, the test fixtures should raise exceptions on cleanup failures rather than just logging warnings. The user fege prefers strict cleanup behavior where tests fail if cleanup doesn't work properly, rather than silently continuing.
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.
🧬 Code Graph Analysis (1)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (9)
tests/model_serving/model_runtime/vllm/conftest.py (1)
serving_runtime(29-47)tests/model_registry/rbac/conftest.py (1)
service_account(48-56)tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py (2)
kserve_s3_endpoint_secret(38-64)get_template_name(204-210)utilities/constants.py (2)
KServeDeploymentType(6-9)Protocols(89-96)utilities/inference_utils.py (1)
create_isvc(547-757)utilities/infra.py (1)
get_pods_by_isvc_label(566-593)utilities/serving_runtime.py (1)
ServingRuntimeFromTemplate(11-230)tests/conftest.py (3)
admin_client(55-56)model_namespace(87-107)aws_secret_access_key(122-129)tests/model_serving/conftest.py (1)
s3_models_storage_uri(6-7)
🔇 Additional comments (4)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (4)
1-50: Well-structured imports and configuration fixtures.The imports are comprehensive and properly organized. The basic fixtures for configuration extraction follow pytest best practices.
139-212: Well-designed runtime and service fixtures.The fixtures properly handle resource management with contextmanagers and support flexible configuration through test parameters. The GPU resource allocation logic is correctly implemented.
214-246: Properly structured credential fixtures.The ServiceAccount and Secret fixtures are well-implemented with proper dependency injection and resource cleanup using contextmanagers.
248-262: Well-implemented utility fixtures.The snapshot fixture correctly uses JSONSnapshotExtension, and the pod fixture has proper error handling when no pods are found.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (3)
52-54: Consider adding parameter validation for the protocol fixture.The fixture directly accesses
request.param["protocol_type"]without validation, which could cause KeyError if the parameter is missing.Consider adding validation:
@pytest.fixture(scope="class") def protocol(request: pytest.FixtureRequest) -> str: - return request.param["protocol_type"] + if not hasattr(request, 'param') or "protocol_type" not in request.param: + raise ValueError("protocol_type parameter is required") + return request.param["protocol_type"]
194-203: Review the resource allocation logic for multi-GPU configurations.The GPU resource allocation logic is complex and modifies the resources dictionary in-place. Consider whether the volume configuration should be conditional on the accelerator type as well.
Consider making the logic more explicit:
resources = copy.deepcopy(cast(dict[str, dict[str, str]], PREDICT_RESOURCES["resources"])) if gpu_count > 0: identifier = ACCELERATOR_IDENTIFIER.get(supported_accelerator_type.lower(), Labels.Nvidia.NVIDIA_COM_GPU) - resources["requests"][identifier] = gpu_count - resources["limits"][identifier] = gpu_count + resources["requests"][identifier] = str(gpu_count) + resources["limits"][identifier] = str(gpu_count) if gpu_count > 1: service_config["volumes"] = PREDICT_RESOURCES["volumes"] service_config["volumes_mounts"] = PREDICT_RESOURCES["volume_mounts"]Note: Kubernetes resource values should be strings, not integers.
258-261: Improve error handling for pod retrieval.The current implementation only checks if pods exist but doesn't handle cases where multiple pods might exist or provide more detailed error information.
Consider enhancing the error handling:
@pytest.fixture def triton_pod_resource( admin_client: DynamicClient, triton_inference_service: InferenceService, ) -> Pod: pods = get_pods_by_isvc_label(client=admin_client, isvc=triton_inference_service) if not pods: - raise RuntimeError(f"No pods found for InferenceService {triton_inference_service.name}") + raise RuntimeError( + f"No pods found for InferenceService {triton_inference_service.name} " + f"in namespace {triton_inference_service.namespace}" + ) + LOGGER.info(f"Found {len(pods)} pod(s) for InferenceService {triton_inference_service.name}") return pods[0]
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py(1 hunks)tests/model_serving/model_runtime/triton/constant.py(1 hunks)utilities/constants.py(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- utilities/constants.py
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/model_serving/model_runtime/triton/constant.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (7)
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.
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#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
Learnt from: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#328
File: tests/model_serving/model_runtime/mlserver/constant.py:20-25
Timestamp: 2025-06-16T05:50:12.556Z
Learning: In the MLServer test suite, the PROTO_FILE_PATH constant is intentionally kept as a relative path string and is used together with the root_dir fixture to construct absolute paths at runtime when accessing the grpc_predict_v2.proto file.
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#320
File: tests/model_registry/rest_api/conftest.py:200-216
Timestamp: 2025-06-05T14:32:40.247Z
Learning: In the opendatahub-tests repository, the test fixtures should raise exceptions on cleanup failures rather than just logging warnings. The user fege prefers strict cleanup behavior where tests fail if cleanup doesn't work properly, rather than silently continuing.
🔇 Additional comments (4)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (4)
17-22: Import structure looks good.The imports from the triton constants module are well-organized and follow the repository pattern. The past issue with missing
__init__.pyfiles appears to be resolved since the import is working correctly.
80-141: Excellent implementation of the serving runtime creation.The function properly handles protocol-specific configurations, including:
- Conditional volume mounts for gRPC shared memory
- Protocol-specific ports and arguments
- Comprehensive model format support
- Proper resource specifications
This follows the repository pattern of using Python functions instead of YAML templates.
42-50: Well-implemented session-scoped fixtures.Both
root_dirandsupported_accelerator_typefixtures are properly scoped and follow pytest best practices. The accelerator type configuration with a sensible default is particularly good.
214-245: Excellent resource management with context managers.The service account and secret fixtures properly use context managers for automatic cleanup, which aligns with the repository's preference for automatic resource management over manual cleanup fixtures.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (1)
193-193: Fix type annotation syntax for Python version compatibility.The type annotation
dict[str, dict[str, str]]uses Python 3.9+ syntax. For broader compatibility, consider using the importedDictfrom typing.- resources = copy.deepcopy(cast(dict[str, dict[str, str]], PREDICT_RESOURCES["resources"])) + resources = copy.deepcopy(cast(Dict[str, Dict[str, str]], PREDICT_RESOURCES["resources"]))
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py(1 hunks)tests/model_serving/model_runtime/triton/constant.py(1 hunks)utilities/constants.py(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- utilities/constants.py
- tests/model_serving/model_runtime/triton/constant.py
- tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (8)
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.
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#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
Learnt from: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#328
File: tests/model_serving/model_runtime/mlserver/constant.py:20-25
Timestamp: 2025-06-16T05:50:12.556Z
Learning: In the MLServer test suite, the PROTO_FILE_PATH constant is intentionally kept as a relative path string and is used together with the root_dir fixture to construct absolute paths at runtime when accessing the grpc_predict_v2.proto file.
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#320
File: tests/model_registry/rest_api/conftest.py:200-216
Timestamp: 2025-06-05T14:32:40.247Z
Learning: In the opendatahub-tests repository, the test fixtures should raise exceptions on cleanup failures rather than just logging warnings. The user fege prefers strict cleanup behavior where tests fail if cleanup doesn't work properly, rather than silently continuing.
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.
🔇 Additional comments (5)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (5)
1-38: LGTM - Well-organized imports and setup.The imports are comprehensive and properly organized, following the repository's patterns. The logger setup is appropriate for the test configuration.
41-66: LGTM - Proper fixture scoping and parameterization.The fixtures are well-designed with appropriate scoping. The parameterized protocol fixture follows pytest best practices.
68-141: LGTM - Template creation properly refactored to use Python classes.The template creation has been well-refactored to use Python dictionaries and classes instead of YAML templates, addressing previous review feedback. The protocol-specific configuration is handled correctly.
143-211: LGTM - Well-designed fixtures with proper resource management.The fixtures are well-structured with appropriate scoping and use context managers for proper resource cleanup, which aligns with the repository's strict cleanup preferences.
213-261: LGTM - Service account, secret, and utility fixtures are well-implemented.The remaining fixtures follow good patterns with proper resource management and error handling. The pod resource fixture appropriately raises an error when no pods are found.
Signed-off-by: Vaibhav Jain <vajain@redhat.com>
59cf7a3 to
979bc24
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (1)
17-20: Verify the import structure is resolvedBased on past review comments, there was an issue with missing
__init__.pyfiles preventing the import fromtests.model_serving.model_runtime.triton.constant. Ensure thattests/model_serving/model_runtime/__init__.pyexists to make this import work properly.
🧹 Nitpick comments (3)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (3)
74-83: Consider extracting template metadata to constantsThe template name pattern and namespace reference could be extracted to make the code more maintainable and consistent across the test suite.
+TEMPLATE_NAME_PATTERN = "triton-{protocol}-runtime-template" + def create_triton_template( admin_client: DynamicClient, protocol: str, triton_runtime_image: str ) -> Generator[Template, Any, Any]: template_dict = { "apiVersion": "template.openshift.io/v1", "kind": "Template", "metadata": { - "name": f"triton-{protocol}-runtime-template", + "name": TEMPLATE_NAME_PATTERN.format(protocol=protocol), "namespace": py_config["applications_namespace"], },
270-278: Improve error handling for pod retrievalThe current error message could be more descriptive and include debugging information to help troubleshoot issues.
@pytest.fixture def triton_pod_resource( admin_client: DynamicClient, triton_inference_service: InferenceService, ) -> Pod: pods = get_pods_by_isvc_label(client=admin_client, isvc=triton_inference_service) if not pods: - raise RuntimeError(f"No pods found for InferenceService {triton_inference_service.name}") + raise RuntimeError( + f"No pods found for InferenceService {triton_inference_service.name} " + f"in namespace {triton_inference_service.namespace}. " + f"Check if the InferenceService is ready and pods are scheduled." + ) return pods[0]
133-142: Consider documenting supported model format prioritiesThe supported model formats configuration uses different priority values and autoSelect settings. Adding a comment explaining the priority strategy would improve maintainability.
+ # Model formats with priority=1 are preferred for auto-selection + # Formats without priority have lower precedence supported_model_formats: List[Dict[str, Any]] = [ {"name": "tensorrt", "version": "8", "autoSelect": True, "priority": 1}, {"name": "tensorflow", "version": "1", "autoSelect": True, "priority": 1},
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
conftest.py(1 hunks)tests/conftest.py(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/__snapshots__/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-rest-deployment].json(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py(1 hunks)tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py(1 hunks)tests/model_serving/model_runtime/triton/constant.py(1 hunks)utilities/constants.py(5 hunks)
✅ Files skipped from review due to trivial changes (1)
- utilities/constants.py
🚧 Files skipped from review as they are similar to previous changes (7)
- conftest.py
- tests/model_serving/model_runtime/triton/basic_model_deployment/snapshots/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json
- tests/conftest.py
- tests/model_serving/model_runtime/triton/basic_model_deployment/snapshots/test_onnx_model/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-rest-deployment].json
- tests/model_serving/model_runtime/triton/basic_model_deployment/test_onnx_model.py
- tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
- tests/model_serving/model_runtime/triton/constant.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#325
File: utilities/manifests/common/grpc_predict_v2.proto:16-16
Timestamp: 2025-06-03T06:31:46.614Z
Learning: The grpc_predict_v2.proto file in utilities/manifests/common/ is from the official KServe V2 inference protocol specification and should not be modified. The package declaration "inference" is standardized and should remain unchanged even if it triggers Buf linting errors about package directory mismatch.
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (8)
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.
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#338
File: tests/model_registry/rbac/test_mr_rbac.py:24-53
Timestamp: 2025-06-06T12:22:57.057Z
Learning: In the opendatahub-tests repository, prefer keeping test parameterization configurations inline rather than extracting them to separate variables/constants, as it makes triaging easier by avoiding the need to jump between different parts of the file to understand the test setup.
Learnt from: israel-hdez
PR: opendatahub-io/opendatahub-tests#346
File: tests/model_serving/model_server/inference_graph/conftest.py:85-92
Timestamp: 2025-06-11T16:40:11.593Z
Learning: The helper `create_isvc` (used in tests/model_serving utilities) already waits until the created InferenceService reports Condition READY=True before returning, so additional readiness waits in fixtures are unnecessary.
Learnt from: Snomaan6846
PR: opendatahub-io/opendatahub-tests#328
File: tests/model_serving/model_runtime/mlserver/constant.py:20-25
Timestamp: 2025-06-16T05:50:12.556Z
Learning: In the MLServer test suite, the PROTO_FILE_PATH constant is intentionally kept as a relative path string and is used together with the root_dir fixture to construct absolute paths at runtime when accessing the grpc_predict_v2.proto file.
Learnt from: fege
PR: opendatahub-io/opendatahub-tests#320
File: tests/model_registry/rest_api/conftest.py:200-216
Timestamp: 2025-06-05T14:32:40.247Z
Learning: In the opendatahub-tests repository, the test fixtures should raise exceptions on cleanup failures rather than just logging warnings. The user fege prefers strict cleanup behavior where tests fail if cleanup doesn't work properly, rather than silently continuing.
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.
🔇 Additional comments (3)
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py (3)
93-160: Excellent protocol-specific configuration handlingThe function correctly handles protocol differences with appropriate volumes, ports, and container arguments. The dynamic configuration based on gRPC vs REST protocols is well-implemented.
211-220: Good resource management for GPU configurationsThe logic correctly handles GPU resource allocation and multi-GPU volume configuration. The deep copy of resources ensures no mutation of the original configuration.
1-37: Well-structured imports and dependenciesThe imports are logically organized and all dependencies appear to be properly used throughout the file. The logger setup follows the project's patterns.
Signed-off-by: Vaibhav Jain <vajain@redhat.com>
|
@adolfo-ab We had incorporated all review comments. Could you please review it again. pre-commit.ci is failing with false positive scenerio. There is no secret in |
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py
Outdated
Show resolved
Hide resolved
tests/model_serving/model_runtime/triton/basic_model_deployment/utils.py
Show resolved
Hide resolved
Signed-off-by: Vaibhav Jain <vajain@redhat.com>
...del/TestdensenetonnxModel.test_densenetonnx_inference[densenetonnx-raw-grpc-deployment].json
Outdated
Show resolved
Hide resolved
tests/model_serving/model_runtime/triton/basic_model_deployment/conftest.py
Show resolved
Hide resolved
| template_dict = { | ||
| "apiVersion": "template.openshift.io/v1", | ||
| "kind": "Template", | ||
| "metadata": { | ||
| "name": f"triton-{protocol}-runtime-template", | ||
| "namespace": py_config["applications_namespace"], | ||
| }, | ||
| "objects": [create_triton_serving_runtime(protocol=protocol, triton_runtime_image=triton_runtime_image)], | ||
| "parameters": [], | ||
| } |
There was a problem hiding this comment.
for kind dict, you don't need to pass the kind and apiVersion, if I am not mistaken. pass the namespace to create_triton_serving_runtime() call here so that you can get the objects
I had already cross verified them. These are false positive. There is no secret in |
A PR can't be merged with pre-commit failing, it would fail any future PRs against the branch. Please do the needful. |
I raised below PR to exclude |
|
Status of building tag latest: 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>
* change: wait for container to be in the wanted status * change: update utils to get the reason for state * change: add expecptions * Add Testsuite for Triton KServe Models (Rest and gRPC) (#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> --------- Signed-off-by: Vaibhav Jain <vajain@redhat.com> Co-authored-by: Debarati Basu-Nag <dbasunag@redhat.com> Co-authored-by: Rashmi Panchamukhi <rpancham@redhat.com> Co-authored-by: Vaibhav Jain <vajain@redhat.com>
Addresses: https://issues.redhat.com/browse/RHOAIENG-21956