Skip to content

Commit a2be539

Browse files
committed
ci: merge main branch
2 parents 25786e7 + 07a4fff commit a2be539

File tree

9 files changed

+197
-157
lines changed

9 files changed

+197
-157
lines changed

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/conftest.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
from utilities.infra import (
1818
create_isvc_view_role,
1919
get_pods_by_isvc_label,
20-
s3_endpoint_secret,
2120
create_inference_token,
2221
)
2322
from utilities.constants import (
2423
KServeDeploymentType,
2524
ModelFormat,
26-
ModelStoragePath,
2725
Protocols,
2826
ModelInferenceRuntime,
2927
RuntimeTemplates,
@@ -327,72 +325,6 @@ def http_s3_caikit_raw_inference_service_2(
327325
yield isvc
328326

329327

330-
# Unprivileged user tests
331-
332-
333-
@pytest.fixture(scope="class")
334-
def unprivileged_s3_caikit_serving_runtime(
335-
admin_client: DynamicClient,
336-
unprivileged_client: DynamicClient,
337-
unprivileged_model_namespace: Namespace,
338-
) -> Generator[ServingRuntime, Any, Any]:
339-
with ServingRuntimeFromTemplate(
340-
client=admin_client,
341-
unprivileged_client=unprivileged_client,
342-
name=f"{Protocols.HTTP}-{ModelInferenceRuntime.CAIKIT_TGIS_RUNTIME}",
343-
namespace=unprivileged_model_namespace.name,
344-
template_name=RuntimeTemplates.CAIKIT_TGIS_SERVING,
345-
multi_model=False,
346-
enable_http=True,
347-
enable_grpc=False,
348-
) as model_runtime:
349-
yield model_runtime
350-
351-
352-
@pytest.fixture(scope="class")
353-
def unprivileged_models_endpoint_s3_secret(
354-
unprivileged_client: DynamicClient,
355-
unprivileged_model_namespace: Namespace,
356-
aws_access_key_id: str,
357-
aws_secret_access_key: str,
358-
models_s3_bucket_name: str,
359-
models_s3_bucket_region: str,
360-
models_s3_bucket_endpoint: str,
361-
) -> Generator[Secret, Any, Any]:
362-
with s3_endpoint_secret(
363-
admin_client=unprivileged_client,
364-
name="models-bucket-secret",
365-
namespace=unprivileged_model_namespace.name,
366-
aws_access_key=aws_access_key_id,
367-
aws_secret_access_key=aws_secret_access_key,
368-
aws_s3_region=models_s3_bucket_region,
369-
aws_s3_bucket=models_s3_bucket_name,
370-
aws_s3_endpoint=models_s3_bucket_endpoint,
371-
) as secret:
372-
yield secret
373-
374-
375-
@pytest.fixture(scope="class")
376-
def unprivileged_s3_caikit_serverless_inference_service(
377-
request: FixtureRequest,
378-
unprivileged_client: DynamicClient,
379-
unprivileged_model_namespace: Namespace,
380-
unprivileged_s3_caikit_serving_runtime: ServingRuntime,
381-
unprivileged_models_endpoint_s3_secret: Secret,
382-
) -> Generator[InferenceService, Any, Any]:
383-
with create_isvc(
384-
client=unprivileged_client,
385-
name=f"{Protocols.HTTP}-{ModelFormat.CAIKIT}",
386-
namespace=unprivileged_model_namespace.name,
387-
runtime=unprivileged_s3_caikit_serving_runtime.name,
388-
model_format=unprivileged_s3_caikit_serving_runtime.instance.spec.supportedModelFormats[0].name,
389-
deployment_mode=KServeDeploymentType.SERVERLESS,
390-
storage_key=unprivileged_models_endpoint_s3_secret.name,
391-
storage_path=request.param["model-dir"],
392-
) as isvc:
393-
yield isvc
394-
395-
396328
@pytest.fixture(scope="class")
397329
def http_s3_caikit_tgis_serving_runtime(
398330
request: FixtureRequest,
@@ -411,27 +343,6 @@ def http_s3_caikit_tgis_serving_runtime(
411343
yield model_runtime
412344

413345

414-
@pytest.fixture(scope="class")
415-
def unprivileged_s3_caikit_raw_inference_service(
416-
request: FixtureRequest,
417-
unprivileged_client: DynamicClient,
418-
unprivileged_model_namespace: Namespace,
419-
unprivileged_s3_caikit_serving_runtime: ServingRuntime,
420-
unprivileged_models_endpoint_s3_secret: Secret,
421-
) -> Generator[InferenceService, Any, Any]:
422-
with create_isvc(
423-
client=unprivileged_client,
424-
name=f"{Protocols.HTTP}-{ModelFormat.CAIKIT}-raw",
425-
namespace=unprivileged_model_namespace.name,
426-
runtime=unprivileged_s3_caikit_serving_runtime.name,
427-
model_format=unprivileged_s3_caikit_serving_runtime.instance.spec.supportedModelFormats[0].name,
428-
deployment_mode=KServeDeploymentType.RAW_DEPLOYMENT,
429-
storage_key=unprivileged_models_endpoint_s3_secret.name,
430-
storage_path=ModelStoragePath.FLAN_T5_SMALL_CAIKIT,
431-
) as isvc:
432-
yield isvc
433-
434-
435346
@pytest.fixture()
436347
def patched_remove_authentication_model_mesh_runtime(
437348
admin_client: DynamicClient,

tests/model_serving/model_server/authentication/test_non_admin_users.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import pytest
22

33
from tests.model_serving.model_server.utils import (
4-
run_inference_multiple_times,
54
verify_inference_response,
65
)
76
from utilities.constants import ModelFormat, ModelStoragePath, Protocols
87
from utilities.inference_utils import Inference
98
from utilities.manifests.caikit_tgis import CAIKIT_TGIS_INFERENCE_CONFIG
10-
from utilities.monitoring import validate_metrics_value
119

1210

1311
@pytest.mark.parametrize(
@@ -63,26 +61,3 @@ def test_non_admin_deploy_raw_and_query_model(
6361
model_name=ModelFormat.CAIKIT,
6462
use_default_query=True,
6563
)
66-
67-
def test_raw_metrics(
68-
self,
69-
unprivileged_s3_caikit_raw_inference_service,
70-
prometheus,
71-
user_workload_monitoring_config_map,
72-
):
73-
"""Verify number of total model requests in OpenShift monitoring system (UserWorkloadMonitoring) metrics"""
74-
total_runs = 5
75-
76-
run_inference_multiple_times(
77-
isvc=unprivileged_s3_caikit_raw_inference_service,
78-
inference_config=CAIKIT_TGIS_INFERENCE_CONFIG,
79-
inference_type=Inference.ALL_TOKENS,
80-
protocol=Protocols.HTTP,
81-
model_name=ModelFormat.CAIKIT,
82-
iterations=total_runs,
83-
)
84-
validate_metrics_value(
85-
prometheus=prometheus,
86-
metrics_query="tgi_request_count",
87-
expected_value=str(total_runs + 1),
88-
)

tests/model_serving/model_server/conftest.py

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
from ocp_utilities.monitoring import Prometheus
1919
from pytest_testconfig import config as py_config
2020

21-
from utilities.constants import StorageClassName
2221
from utilities.constants import (
2322
KServeDeploymentType,
2423
ModelFormat,
2524
ModelInferenceRuntime,
25+
ModelStoragePath,
2626
Protocols,
2727
RuntimeTemplates,
28+
StorageClassName,
2829
)
2930
from utilities.constants import (
3031
ModelAndFormat,
@@ -444,6 +445,8 @@ def prometheus(admin_client: DynamicClient) -> Prometheus:
444445
def user_workload_monitoring_config_map(
445446
admin_client: DynamicClient, cluster_monitoring_config: ConfigMap
446447
) -> Generator[ConfigMap, None, None]:
448+
uwm_namespace = "openshift-user-workload-monitoring"
449+
447450
data = {
448451
"config.yaml": yaml.dump({
449452
"prometheus": {
@@ -457,11 +460,15 @@ def user_workload_monitoring_config_map(
457460
with update_configmap_data(
458461
client=admin_client,
459462
name="user-workload-monitoring-config",
460-
namespace="openshift-user-workload-monitoring",
463+
namespace=uwm_namespace,
461464
data=data,
462465
) as cm:
463466
yield cm
464467

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

466473
@pytest.fixture(scope="class")
467474
def http_s3_ovms_external_route_model_mesh_serving_runtime(
@@ -515,3 +522,87 @@ def http_s3_openvino_second_model_mesh_inference_service(
515522
model_version=request.param["model-version"],
516523
) as isvc:
517524
yield isvc
525+
526+
527+
@pytest.fixture(scope="class")
528+
def unprivileged_s3_caikit_raw_inference_service(
529+
request: FixtureRequest,
530+
unprivileged_client: DynamicClient,
531+
unprivileged_model_namespace: Namespace,
532+
unprivileged_s3_caikit_serving_runtime: ServingRuntime,
533+
unprivileged_models_endpoint_s3_secret: Secret,
534+
) -> Generator[InferenceService, Any, Any]:
535+
with create_isvc(
536+
client=unprivileged_client,
537+
name=f"{Protocols.HTTP}-{ModelFormat.CAIKIT}-raw",
538+
namespace=unprivileged_model_namespace.name,
539+
runtime=unprivileged_s3_caikit_serving_runtime.name,
540+
model_format=unprivileged_s3_caikit_serving_runtime.instance.spec.supportedModelFormats[0].name,
541+
deployment_mode=KServeDeploymentType.RAW_DEPLOYMENT,
542+
storage_key=unprivileged_models_endpoint_s3_secret.name,
543+
storage_path=ModelStoragePath.FLAN_T5_SMALL_CAIKIT,
544+
) as isvc:
545+
yield isvc
546+
547+
548+
@pytest.fixture(scope="class")
549+
def unprivileged_s3_caikit_serving_runtime(
550+
admin_client: DynamicClient,
551+
unprivileged_client: DynamicClient,
552+
unprivileged_model_namespace: Namespace,
553+
) -> Generator[ServingRuntime, Any, Any]:
554+
with ServingRuntimeFromTemplate(
555+
client=admin_client,
556+
unprivileged_client=unprivileged_client,
557+
name=f"{Protocols.HTTP}-{ModelInferenceRuntime.CAIKIT_TGIS_RUNTIME}",
558+
namespace=unprivileged_model_namespace.name,
559+
template_name=RuntimeTemplates.CAIKIT_TGIS_SERVING,
560+
multi_model=False,
561+
enable_http=True,
562+
enable_grpc=False,
563+
) as model_runtime:
564+
yield model_runtime
565+
566+
567+
@pytest.fixture(scope="class")
568+
def unprivileged_models_endpoint_s3_secret(
569+
unprivileged_client: DynamicClient,
570+
unprivileged_model_namespace: Namespace,
571+
aws_access_key_id: str,
572+
aws_secret_access_key: str,
573+
models_s3_bucket_name: str,
574+
models_s3_bucket_region: str,
575+
models_s3_bucket_endpoint: str,
576+
) -> Generator[Secret, Any, Any]:
577+
with s3_endpoint_secret(
578+
admin_client=unprivileged_client,
579+
name="models-bucket-secret",
580+
namespace=unprivileged_model_namespace.name,
581+
aws_access_key=aws_access_key_id,
582+
aws_secret_access_key=aws_secret_access_key,
583+
aws_s3_region=models_s3_bucket_region,
584+
aws_s3_bucket=models_s3_bucket_name,
585+
aws_s3_endpoint=models_s3_bucket_endpoint,
586+
) as secret:
587+
yield secret
588+
589+
590+
@pytest.fixture(scope="class")
591+
def unprivileged_s3_caikit_serverless_inference_service(
592+
request: FixtureRequest,
593+
unprivileged_client: DynamicClient,
594+
unprivileged_model_namespace: Namespace,
595+
unprivileged_s3_caikit_serving_runtime: ServingRuntime,
596+
unprivileged_models_endpoint_s3_secret: Secret,
597+
) -> Generator[InferenceService, Any, Any]:
598+
with create_isvc(
599+
client=unprivileged_client,
600+
name=f"{Protocols.HTTP}-{ModelFormat.CAIKIT}",
601+
namespace=unprivileged_model_namespace.name,
602+
runtime=unprivileged_s3_caikit_serving_runtime.name,
603+
model_format=unprivileged_s3_caikit_serving_runtime.instance.spec.supportedModelFormats[0].name,
604+
deployment_mode=KServeDeploymentType.SERVERLESS,
605+
storage_key=unprivileged_models_endpoint_s3_secret.name,
606+
storage_path=request.param["model-dir"],
607+
) as isvc:
608+
yield isvc

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)