Skip to content

Commit

Permalink
Merge branch 'main' into KF-4522-Seldon-Core-Contributing-File
Browse files Browse the repository at this point in the history
  • Loading branch information
orfeas-k authored Oct 10, 2023
2 parents ebc82cf + cac23f3 commit 248aa6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 9 additions & 2 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
verbs=None,
)
SELDON_CM_NAME = "seldon-config"
WORKLOADS_NAMESPACE = "default"

with open("tests/integration/test_data/expected_seldon_cm.json", "r") as json_file:
SELDON_CONFIG = json.load(json_file)
Expand Down Expand Up @@ -102,6 +103,7 @@ async def test_configmap_changes_with_config(lightkube_client: Client, ops_test:
)


@pytest.mark.abort_on_fail
async def test_seldon_istio_relation(ops_test: OpsTest):
"""Test Seldon/Istio relation."""
# NOTE: This test is re-using deployment created in test_build_and_deploy()
Expand Down Expand Up @@ -162,11 +164,14 @@ async def check_alert_propagation(url, alert_name):
assert alert_rule is not None and alert_rule["state"] == "firing"


@pytest.mark.abort_on_fail
@pytest.mark.asyncio
async def test_seldon_alert_rules(ops_test: OpsTest):
"""Test Seldon alert rules."""
# NOTE: This test is re-using deployments created in test_build_and_deploy()
namespace = ops_test.model_name
# Use namespace "default" to create seldon deployments
# due to https://github.com/canonical/seldon-core-operator/issues/218
namespace = WORKLOADS_NAMESPACE
client = Client()

# setup Prometheus
Expand Down Expand Up @@ -277,7 +282,9 @@ async def test_seldon_alert_rules(ops_test: OpsTest):
async def test_seldon_deployment(ops_test: OpsTest):
"""Test Seldon Deployment scenario."""
# NOTE: This test is re-using deployment created in test_build_and_deploy()
namespace = ops_test.model_name
# Use namespace "default" to create seldon deployments
# due to https://github.com/canonical/seldon-core-operator/issues/218
namespace = WORKLOADS_NAMESPACE
client = Client()

this_ns = client.get(res=Namespace, name=namespace)
Expand Down
11 changes: 8 additions & 3 deletions tests/integration/test_seldon_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
verbs=None,
)
TEST_LABEL = {"testing-seldon-deployments": "true"}
WORKLOADS_NAMESPACE = "default"


@pytest.fixture(scope="session")
Expand All @@ -47,7 +48,7 @@ def lightkube_client() -> Client:
@pytest.fixture(scope="module")
def patch_namespace_with_seldon_label(lightkube_client: Client, ops_test: OpsTest):
"""Patch the current namespace with Seldon specific labels."""
this_ns = lightkube_client.get(res=Namespace, name=ops_test.model_name)
this_ns = lightkube_client.get(res=Namespace, name=WORKLOADS_NAMESPACE)
this_ns.metadata.labels.update({"serving.kubeflow.org/inferenceservice": "enabled"})
lightkube_client.patch(res=Namespace, name=this_ns.metadata.name, obj=this_ns)

Expand All @@ -58,7 +59,9 @@ def remove_seldon_deployment(lightkube_client: Client, ops_test: OpsTest):
yield

# remove Seldon Deployment
namespace = ops_test.model_name
# Use namespace "default" to create seldon deployments
# due to https://github.com/canonical/seldon-core-operator/issues/218
namespace = WORKLOADS_NAMESPACE
resource_to_delete = lightkube_client.list(
SELDON_DEPLOYMENT, namespace=namespace, labels=TEST_LABEL
)
Expand Down Expand Up @@ -274,7 +277,9 @@ async def test_seldon_predictor_server(
Workload deploys Seldon predictor servers defined in ConfigMap.
Each server is deployed and inference request is triggered, and response is evaluated.
"""
namespace = ops_test.model_name
# Use namespace "default" to create seldon deployments
# due to https://github.com/canonical/seldon-core-operator/issues/218
namespace = WORKLOADS_NAMESPACE
# retrieve predictor server information and create Seldon Depoloyment
with open(f"tests/assets/crs/{server_config}") as f:
deploy_yaml = yaml.safe_load(f.read())
Expand Down

0 comments on commit 248aa6e

Please sign in to comment.