Skip to content

Commit

Permalink
add odh_model_controller deployment smoke tests (#39)
Browse files Browse the repository at this point in the history
* add odh_model_controller smoke tests

* add comments

---------

Co-authored-by: Milind Waykole <[email protected]>
  • Loading branch information
rnetser and mwaykole authored Nov 18, 2024
1 parent ef7aeb9 commit b62eeb4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
Empty file.
31 changes: 31 additions & 0 deletions tests/model_serving/model_server/operator/test_operator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pytest
from kubernetes.dynamic import DynamicClient
from ocp_resources.deployment import Deployment
from ocp_resources.exceptions import MissingResourceResError

from utilities.constants import APPLICATIONS_NAMESPACE


@pytest.fixture(scope="class")
def odh_model_controller_deployment(admin_client: DynamicClient):
deployment = Deployment(
client=admin_client,
name="odh-model-controller",
namespace=APPLICATIONS_NAMESPACE,
)
if deployment.exists:
return deployment

raise MissingResourceResError(name=deployment.name)


class TestOperator:
@pytest.mark.smoke
def test_odh_model_controller_deployment(self, odh_model_controller_deployment):
# Check odh-model-controller deployment expected number of replicas
assert odh_model_controller_deployment.instance.spec.replicas == 1

@pytest.mark.smoke
def test_odh_model_controller_replicas(self, odh_model_controller_deployment):
# Check odh-model-controller deployment replicas are running
odh_model_controller_deployment.wait_for_replicas()
1 change: 1 addition & 0 deletions utilities/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APPLICATIONS_NAMESPACE: str = "redhat-ods-applications"
4 changes: 3 additions & 1 deletion utilities/serving_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from ocp_resources.serving_runtime import ServingRuntime
from ocp_resources.template import Template

from utilities.constants import APPLICATIONS_NAMESPACE


class ServingRuntimeFromTemplate(ServingRuntime):
def __init__(self, client: DynamicClient, name: str, namespace: str, template_name: str):
Expand All @@ -18,7 +20,7 @@ def get_model_template(self) -> Template:
template = Template(
client=self.client,
name=self.template_name,
namespace="redhat-ods-applications",
namespace=APPLICATIONS_NAMESPACE,
)
if template.exists:
return template
Expand Down

0 comments on commit b62eeb4

Please sign in to comment.