Skip to content

Commit 4a66e91

Browse files
committed
fix: server metrics delete pvc
1 parent 25786e7 commit 4a66e91

5 files changed

Lines changed: 13 additions & 28 deletions

File tree

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ markers =
2222
rawdeployment: Mark tests which are raw deployment tests
2323
minio: Mark tests which are using MinIO storage
2424
tls: Mark tests which are testing TLS
25+
metrics: Mark tests which are testing metrics
2526

2627
addopts =
2728
-s

tests/model_serving/model_server/authentication/test_non_admin_users.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def test_non_admin_deploy_raw_and_query_model(
6464
use_default_query=True,
6565
)
6666

67-
def test_raw_metrics(
67+
@pytest.mark.metrics
68+
def test_non_admin_raw_metrics(
6869
self,
6970
unprivileged_s3_caikit_raw_inference_service,
7071
prometheus,
@@ -84,5 +85,5 @@ def test_raw_metrics(
8485
validate_metrics_value(
8586
prometheus=prometheus,
8687
metrics_query="tgi_request_count",
87-
expected_value=str(total_runs + 1),
88+
expected_value=str(total_runs),
8889
)

tests/model_serving/model_server/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ def prometheus(admin_client: DynamicClient) -> Prometheus:
444444
def user_workload_monitoring_config_map(
445445
admin_client: DynamicClient, cluster_monitoring_config: ConfigMap
446446
) -> Generator[ConfigMap, None, None]:
447+
uwm_namespace = "openshift-user-workload-monitoring"
448+
447449
data = {
448450
"config.yaml": yaml.dump({
449451
"prometheus": {
@@ -457,11 +459,15 @@ def user_workload_monitoring_config_map(
457459
with update_configmap_data(
458460
client=admin_client,
459461
name="user-workload-monitoring-config",
460-
namespace="openshift-user-workload-monitoring",
462+
namespace=uwm_namespace,
461463
data=data,
462464
) as cm:
463465
yield cm
464466

467+
# UWM PVCs are not deleted once the configmap is deleted; forcefully deleting the PVCs to avoid having left-overs
468+
for pvc in PersistentVolumeClaim.get(dyn_client=admin_client, namespace=uwm_namespace):
469+
pvc.clean_up()
470+
465471

466472
@pytest.fixture(scope="class")
467473
def http_s3_ovms_external_route_model_mesh_serving_runtime(

tests/model_serving/model_server/metrics/conftest.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/model_serving/model_server/metrics/test_model_metrics.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
pytestmark = [
2020
pytest.mark.serverless,
2121
pytest.mark.usefixtures("valid_aws_config", "user_workload_monitoring_config_map"),
22+
pytest.mark.metrics,
2223
]
2324

2425

@@ -46,8 +47,7 @@
4647
class TestModelMetrics:
4748
@pytest.mark.smoke
4849
@pytest.mark.polarion("ODS-2555")
49-
@pytest.mark.dependency(name="test_model_metrics_num_success_requests")
50-
def test_model_metrics_num_success_requests(self, s3_models_inference_service, deleted_metrics, prometheus):
50+
def test_model_metrics_num_success_requests(self, s3_models_inference_service, prometheus):
5151
"""Verify number of successful model requests in OpenShift monitoring system (UserWorkloadMonitoring) metrics"""
5252
verify_inference_response(
5353
inference_service=s3_models_inference_service,
@@ -65,10 +65,6 @@ def test_model_metrics_num_success_requests(self, s3_models_inference_service, d
6565

6666
@pytest.mark.smoke
6767
@pytest.mark.polarion("ODS-2555")
68-
@pytest.mark.dependency(
69-
name="test_model_metrics_num_total_requests",
70-
depends=["test_model_metrics_num_success_requests"],
71-
)
7268
def test_model_metrics_num_total_requests(self, s3_models_inference_service, prometheus):
7369
"""Verify number of total model requests in OpenShift monitoring system (UserWorkloadMonitoring) metrics"""
7470
total_runs = 5
@@ -90,7 +86,6 @@ def test_model_metrics_num_total_requests(self, s3_models_inference_service, pro
9086

9187
@pytest.mark.smoke
9288
@pytest.mark.polarion("ODS-2555")
93-
@pytest.mark.dependency(depends=["test_model_metrics_num_total_requests"])
9489
def test_model_metrics_cpu_utilization(self, s3_models_inference_service, prometheus):
9590
"""Verify CPU utilization data in OpenShift monitoring system (UserWorkloadMonitoring) metrics"""
9691
assert get_metrics_value(

0 commit comments

Comments
 (0)