Skip to content

Commit f2bf0d1

Browse files
authored
Merge branch 'main' into archive_model
2 parents c0bd288 + 55baa49 commit f2bf0d1

5 files changed

Lines changed: 621 additions & 607 deletions

File tree

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ markers =
1717
post_upgrade: Mark tests which should be run after upgrading the product.
1818
fuzzer: Mark tests that use fuzzing and are probably going to generate unanticipated failures.
1919
ocp_interop: Interop testing with Openshift.
20+
downstream_only: Tests that are specific to downstream
2021

2122
# Model server
2223
modelmesh: Mark tests which are model mesh tests

schemathesis.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
base-url = "https://${API_HOST}"

tests/model_registry/conftest.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import os
12
import pytest
3+
from pytest import Config
24
import schemathesis
35
from typing import Generator, Any
46
from ocp_resources.pod import Pod
@@ -259,15 +261,17 @@ def model_registry_instance_rest_endpoint(
259261

260262

261263
@pytest.fixture(scope="class")
262-
def generated_schema(model_registry_instance_rest_endpoint: str) -> BaseOpenAPISchema:
264+
def generated_schema(pytestconfig: Config, model_registry_instance_rest_endpoint: str) -> BaseOpenAPISchema:
265+
os.environ["API_HOST"] = model_registry_instance_rest_endpoint
266+
config = schemathesis.config.SchemathesisConfig.from_path(f"{pytestconfig.rootpath}/schemathesis.toml")
263267
schema = schemathesis.openapi.from_url(
264-
url="https://raw.githubusercontent.com/kubeflow/model-registry/main/api/openapi/model-registry.yaml"
268+
url="https://raw.githubusercontent.com/kubeflow/model-registry/main/api/openapi/model-registry.yaml",
269+
config=config,
265270
)
266-
schema.configure(base_url=f"https://{model_registry_instance_rest_endpoint}/")
267271
return schema
268272

269273

270-
@pytest.fixture
274+
@pytest.fixture()
271275
def state_machine(generated_schema: BaseOpenAPISchema, current_client_token: str) -> APIStateMachine:
272276
BaseAPIWorkflow = generated_schema.as_state_machine()
273277

@@ -277,12 +281,18 @@ class APIWorkflow(BaseAPIWorkflow): # type: ignore
277281
def setup(self) -> None:
278282
self.headers = {"Authorization": f"Bearer {current_client_token}", "Content-Type": "application/json"}
279283

284+
def before_call(self, case: Case) -> None:
285+
LOGGER.info(f"Checking: {case.method} {case.path}")
286+
280287
# these kwargs are passed to requests.request()
281288
def get_call_kwargs(self, case: Case) -> dict[str, Any]:
282289
return {"verify": False, "headers": self.headers}
283290

284291
def after_call(self, response: Response, case: Case) -> None:
285-
LOGGER.info(f"{case.method} {case.path} -> {response.status_code}")
292+
LOGGER.info(
293+
f"Method tested: {case.method}, API: {case.path}, response code:{response.status_code},"
294+
f" Full Response:{response.text}"
295+
)
286296

287297
return APIWorkflow
288298

tests/model_registry/image_validation/test_verify_rhoai_images.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
indirect=True,
3030
)
3131
@pytest.mark.usefixtures("updated_dsc_component_state_scope_class")
32+
@pytest.mark.downstream_only
3233
class TestModelRegistryImages:
3334
"""
3435
Tests to verify that all Model Registry component images (operator and instance container images)

0 commit comments

Comments
 (0)