Skip to content

Commit 8842255

Browse files
committed
ci: Merge branch 'main' of github.com:fege/opendatahub-tests into secure-db
2 parents 35b9762 + 55baa49 commit 8842255

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
@@ -269,15 +271,17 @@ def model_registry_instance_rest_endpoint(
269271

270272

271273
@pytest.fixture(scope="class")
272-
def generated_schema(model_registry_instance_rest_endpoint: str) -> BaseOpenAPISchema:
274+
def generated_schema(pytestconfig: Config, model_registry_instance_rest_endpoint: str) -> BaseOpenAPISchema:
275+
os.environ["API_HOST"] = model_registry_instance_rest_endpoint
276+
config = schemathesis.config.SchemathesisConfig.from_path(f"{pytestconfig.rootpath}/schemathesis.toml")
273277
schema = schemathesis.openapi.from_url(
274-
url="https://raw.githubusercontent.com/kubeflow/model-registry/main/api/openapi/model-registry.yaml"
278+
url="https://raw.githubusercontent.com/kubeflow/model-registry/main/api/openapi/model-registry.yaml",
279+
config=config,
275280
)
276-
schema.configure(base_url=f"https://{model_registry_instance_rest_endpoint}/")
277281
return schema
278282

279283

280-
@pytest.fixture
284+
@pytest.fixture()
281285
def state_machine(generated_schema: BaseOpenAPISchema, current_client_token: str) -> APIStateMachine:
282286
BaseAPIWorkflow = generated_schema.as_state_machine()
283287

@@ -287,12 +291,18 @@ class APIWorkflow(BaseAPIWorkflow): # type: ignore
287291
def setup(self) -> None:
288292
self.headers = {"Authorization": f"Bearer {current_client_token}", "Content-Type": "application/json"}
289293

294+
def before_call(self, case: Case) -> None:
295+
LOGGER.info(f"Checking: {case.method} {case.path}")
296+
290297
# these kwargs are passed to requests.request()
291298
def get_call_kwargs(self, case: Case) -> dict[str, Any]:
292299
return {"verify": False, "headers": self.headers}
293300

294301
def after_call(self, response: Response, case: Case) -> None:
295-
LOGGER.info(f"{case.method} {case.path} -> {response.status_code}")
302+
LOGGER.info(
303+
f"Method tested: {case.method}, API: {case.path}, response code:{response.status_code},"
304+
f" Full Response:{response.text}"
305+
)
296306

297307
return APIWorkflow
298308

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)