test MR failure when using http protocol for endpoint#336
test MR failure when using http protocol for endpoint#336lugi0 merged 4 commits intoopendatahub-io:mainfrom
Conversation
Signed-off-by: lugi0 <lgiorgi@redhat.com>
## Walkthrough
The test suite for the model registry's OAuth proxy was updated by adding a new test for encrypted proxy connections, refining test parameterization, and introducing explicit typing and updated skip messages. The new test verifies error handling when connecting to an encrypted OAuth proxy over HTTP, while parameterization for an existing test was shifted from the class to the method level.
## Changes
| File(s) | Change Summary |
|-------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| tests/model_registry/python_client/test_model_registry_creation_oauth.py | Added test for encrypted OAuth proxy error handling, moved parameterization to method level, added explicit typing, and updated skip messages. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Test as TestModelRegistryCreationOAuth
participant Service as model_registry_instance_oauth_service
participant Client as ModelRegistryClient
Test->>Service: Retrieve REST endpoint
Test->>Client: Instantiate with server, port, token (HTTP, insecure)
Client-->>Test: Raises ServerDisconnectedError
Test->>Test: Assert exception and messagePossibly related PRs
Suggested reviewers
Poem
|
|
The following are automatically added/executed:
Available user actions:
Supported labels{'/hold', '/wip', '/lgtm', '/verified'} |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/model_registry/python_client/test_model_registry_creation_oauth.py (2)
55-59: Add missing docstring and fix parameter annotation.The test method is missing a docstring to explain its purpose.
+ """Test registering a model with OAuth proxy configuration.""" def test_registering_model_with_oauth( self: Self, admin_client: DynamicClient,🧰 Tools
🪛 Pylint (3.3.7)
[convention] 55-55: Missing function or method docstring
(C0116)
100-116: Consider breaking long lines for better readability.Some lines exceed the 100-character limit. Consider breaking them for improved readability.
- if py_config["distribution"] == "downstream" and get_product_version(admin_client=admin_client) < MINVER: + if (py_config["distribution"] == "downstream" and + get_product_version(admin_client=admin_client) < MINVER): pytest.skip("Skipping test for RHOAI < 2.21") - rest_endpoint = get_endpoint_from_mr_service(svc=model_registry_instance_oauth_service, protocol=Protocols.REST) + rest_endpoint = get_endpoint_from_mr_service( + svc=model_registry_instance_oauth_service, + protocol=Protocols.REST + ) - assert str(exc_info.value) == "Server disconnected", f"Expected Server disconnected, but got {exc_info.value}" + assert str(exc_info.value) == "Server disconnected", ( + f"Expected Server disconnected, but got {exc_info.value}" + )🧰 Tools
🪛 Pylint (3.3.7)
[convention] 100-100: Line too long (113/100)
(C0301)
[convention] 104-104: Line too long (120/100)
(C0301)
[convention] 116-116: Line too long (118/100)
(C0301)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/model_registry/python_client/test_model_registry_creation_oauth.py(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/model_registry/python_client/test_model_registry_creation_oauth.py (5)
utilities/constants.py (1)
Protocols(87-94)tests/model_registry/utils.py (1)
get_endpoint_from_mr_service(49-53)tests/conftest.py (2)
admin_client(53-54)current_client_token(86-87)tests/model_registry/conftest.py (1)
model_registry_instance_oauth_service(228-246)utilities/infra.py (1)
get_product_version(747-770)
🪛 Pylint (3.3.7)
tests/model_registry/python_client/test_model_registry_creation_oauth.py
[error] 10-10: Unable to import 'kubernetes.dynamic'
(E0401)
[error] 11-11: Unable to import 'ocp_resources.service'
(E0401)
[error] 14-14: Unable to import 'aiohttp.client_exceptions'
(E0401)
[convention] 10-10: third party import "kubernetes.dynamic.DynamicClient" should be placed before first party imports "utilities.infra.get_product_version", "utilities.constants.DscComponents", "tests.model_registry.constants.MODEL_NAME"
(C0411)
[convention] 11-11: third party import "ocp_resources.service.Service" should be placed before first party imports "utilities.infra.get_product_version", "utilities.constants.DscComponents", "tests.model_registry.constants.MODEL_NAME"
(C0411)
[convention] 14-14: third party import "aiohttp.client_exceptions.ServerDisconnectedError" should be placed before first party imports "utilities.infra.get_product_version", "utilities.constants.DscComponents", "tests.model_registry.constants.MODEL_NAME", "utilities.constants.Protocols", "tests.model_registry.utils.get_endpoint_from_mr_service"
(C0411)
[convention] 12-12: Imports from package utilities are not grouped
(C0412)
[convention] 13-13: Imports from package tests are not grouped
(C0412)
[convention] 55-55: Missing function or method docstring
(C0116)
[convention] 100-100: Line too long (113/100)
(C0301)
[convention] 104-104: Line too long (120/100)
(C0301)
[convention] 116-116: Line too long (118/100)
(C0301)
[convention] 94-94: Missing function or method docstring
(C0116)
🔇 Additional comments (2)
tests/model_registry/python_client/test_model_registry_creation_oauth.py (2)
10-14: LGTM: New imports support the test functionality.The added imports are necessary to support the new test method and parameterization changes. The static analysis warnings about import order are not critical in a test environment.
🧰 Tools
🪛 Pylint (3.3.7)
[error] 10-10: Unable to import 'kubernetes.dynamic'
(E0401)
[error] 11-11: Unable to import 'ocp_resources.service'
(E0401)
[error] 14-14: Unable to import 'aiohttp.client_exceptions'
(E0401)
[convention] 10-10: third party import "kubernetes.dynamic.DynamicClient" should be placed before first party imports "utilities.infra.get_product_version", "utilities.constants.DscComponents", "tests.model_registry.constants.MODEL_NAME"
(C0411)
[convention] 11-11: third party import "ocp_resources.service.Service" should be placed before first party imports "utilities.infra.get_product_version", "utilities.constants.DscComponents", "tests.model_registry.constants.MODEL_NAME"
(C0411)
[convention] 14-14: third party import "aiohttp.client_exceptions.ServerDisconnectedError" should be placed before first party imports "utilities.infra.get_product_version", "utilities.constants.DscComponents", "tests.model_registry.constants.MODEL_NAME", "utilities.constants.Protocols", "tests.model_registry.utils.get_endpoint_from_mr_service"
(C0411)
[convention] 12-12: Imports from package utilities are not grouped
(C0412)
[convention] 13-13: Imports from package tests are not grouped
(C0412)
20-53: LGTM: Improved parameterization structure.Moving the
model_registry_clientparameterization from class-level to method-level makes the test configuration more explicit and easier to understand. The parameterization is now applied only to the specific test that needs it.
dbasunag
left a comment
There was a problem hiding this comment.
minor nitpick. Looks good from my side.
Signed-off-by: lugi0 <lgiorgi@redhat.com>
|
Status of building tag latest: success. |
…#336) * feat: test failure when using http protocol Signed-off-by: lugi0 <lgiorgi@redhat.com> * fix: typo and small refactor Signed-off-by: lugi0 <lgiorgi@redhat.com> --------- Signed-off-by: lugi0 <lgiorgi@redhat.com>
Description
How Has This Been Tested?
Merge criteria:
Summary by CodeRabbit