diff --git a/tests/model_serving/model_server/kserve/authentication/conftest.py b/tests/model_serving/model_server/kserve/authentication/conftest.py index 04a3741a0..22331e669 100644 --- a/tests/model_serving/model_server/kserve/authentication/conftest.py +++ b/tests/model_serving/model_server/kserve/authentication/conftest.py @@ -21,20 +21,16 @@ ModelName, Protocols, RuntimeTemplates, + Timeout, ) from utilities.inference_utils import create_isvc from utilities.infra import ( create_inference_token, create_isvc_view_role, - get_pods_by_isvc_label, ) -from utilities.jira import is_jira_open from utilities.logger import RedactedString -from utilities.opendatahub_logger import get_logger from utilities.serving_runtime import ServingRuntimeFromTemplate -LOGGER = get_logger(name=__name__) - # HTTP/REST model serving @pytest.fixture(scope="class") @@ -77,15 +73,9 @@ def http_raw_inference_token(model_service_account: ServiceAccount, http_raw_rol @pytest.fixture() def patched_remove_raw_authentication_isvc( - admin_client: DynamicClient, unprivileged_client: DynamicClient, http_s3_ovms_raw_inference_service: InferenceService, ) -> Generator[InferenceService, Any, Any]: - predictor_pod = get_pods_by_isvc_label( - client=unprivileged_client, - isvc=http_s3_ovms_raw_inference_service, - )[0] - with ResourceEditor( patches={ http_s3_ovms_raw_inference_service: { @@ -95,12 +85,20 @@ def patched_remove_raw_authentication_isvc( } } ): - if is_jira_open(jira_id="RHOAIENG-52129", admin_client=admin_client): - LOGGER.info("RHOAIENG-52129 is open; waiting for predictor pod rollout after auth toggle") - predictor_pod.wait_deleted() - + http_s3_ovms_raw_inference_service.wait_for_condition( + condition=http_s3_ovms_raw_inference_service.Condition.READY, + status=http_s3_ovms_raw_inference_service.Condition.Status.TRUE, + timeout=Timeout.TIMEOUT_2MIN, + ) yield http_s3_ovms_raw_inference_service + # ResourceEditor restores auth on exit; wait for ISVC to reconcile before next test + http_s3_ovms_raw_inference_service.wait_for_condition( + condition=http_s3_ovms_raw_inference_service.Condition.READY, + status=http_s3_ovms_raw_inference_service.Condition.Status.TRUE, + timeout=Timeout.TIMEOUT_2MIN, + ) + @pytest.fixture(scope="class") def model_service_account_2( diff --git a/tests/model_serving/model_server/kserve/authentication/test_kserve_token_authentication_raw.py b/tests/model_serving/model_server/kserve/authentication/test_kserve_token_authentication_raw.py index 240f2de9f..6f90d2f93 100644 --- a/tests/model_serving/model_server/kserve/authentication/test_kserve_token_authentication_raw.py +++ b/tests/model_serving/model_server/kserve/authentication/test_kserve_token_authentication_raw.py @@ -1,11 +1,8 @@ import pytest -from ocp_resources.resource import ResourceEditor from tests.model_serving.model_server.utils import verify_inference_response -from utilities.constants import Annotations, Protocols +from utilities.constants import Protocols from utilities.inference_utils import Inference -from utilities.infra import check_pod_status_in_time, get_pods_by_isvc_label -from utilities.jira import is_jira_issue_open from utilities.manifests.onnx import ONNX_INFERENCE_CONFIG pytestmark = pytest.mark.usefixtures("valid_aws_config") @@ -49,40 +46,6 @@ def test_disabled_raw_model_authentication(self, patched_remove_raw_authenticati use_default_query=True, ) - @pytest.mark.smoke - @pytest.mark.xfail(condition=is_jira_issue_open(jira_id="RHOAIENG-52129"), reason="RHOAIENG-52129", run=False) - def test_raw_disable_enable_authentication_no_pod_rollout(self, http_s3_ovms_raw_inference_service): - """Verify no pod rollout when disabling and enabling authentication""" - pod = get_pods_by_isvc_label( - client=http_s3_ovms_raw_inference_service.client, - isvc=http_s3_ovms_raw_inference_service, - )[0] - - ResourceEditor( - patches={ - http_s3_ovms_raw_inference_service: { - "metadata": { - "annotations": {Annotations.KserveAuth.SECURITY: "false"}, - } - } - } - ).update() - - check_pod_status_in_time(pod=pod, status={pod.Status.RUNNING}) - - ResourceEditor( - patches={ - http_s3_ovms_raw_inference_service: { - "metadata": { - "annotations": {Annotations.KserveAuth.SECURITY: "true"}, - } - } - } - ).update() - - check_pod_status_in_time(pod=pod, status={pod.Status.RUNNING}) - - @pytest.mark.dependency(depends=["test_disabled_raw_model_authentication"]) def test_re_enabled_raw_model_authentication(self, http_s3_ovms_raw_inference_service, http_raw_inference_token): """Verify model query after authentication is re-enabled""" verify_inference_response( diff --git a/tests/model_serving/model_server/kserve/storage/oci/test_oci_image.py b/tests/model_serving/model_server/kserve/storage/oci/test_oci_image.py index 39d5f4bd2..96be3820b 100644 --- a/tests/model_serving/model_server/kserve/storage/oci/test_oci_image.py +++ b/tests/model_serving/model_server/kserve/storage/oci/test_oci_image.py @@ -55,7 +55,6 @@ def test_model_car_no_restarts(self, model_car_inference_service): @pytest.mark.tier1 @pytest.mark.ocp_interop - @pytest.mark.skip(reason="Skipping due to RHOAIENG-12306") def test_model_car_using_rest(self, model_car_inference_service): """Verify model query with token using REST""" verify_inference_response( @@ -68,7 +67,6 @@ def test_model_car_using_rest(self, model_car_inference_service): @pytest.mark.tier1 @pytest.mark.ocp_interop - @pytest.mark.skip(reason="Skipping due to RHOAIENG-38674") def test_model_status_loaded(self, model_car_inference_service): """Verify model status on the InferenceService resource is in a valid state.""" model_status = model_car_inference_service.instance.status.modelStatus diff --git a/utilities/infra.py b/utilities/infra.py index 82224dd4e..dd81bfc1d 100644 --- a/utilities/infra.py +++ b/utilities/infra.py @@ -802,7 +802,9 @@ def verify_no_failed_pods( return -def check_pod_status_in_time(pod: Pod, status: set[str], duration: int = Timeout.TIMEOUT_2MIN, wait: int = 1) -> None: +def check_pod_status_in_time( + pod: Pod, status: set[str], duration: int = Timeout.TIMEOUT_2MIN, wait: int = 1 +) -> None: # skip-unused-code """ Checks if a pod status is maintained for a given duration. If not, an AssertionError is raised. diff --git a/utilities/jira.py b/utilities/jira.py index 3f0a217d3..d1ede98d5 100644 --- a/utilities/jira.py +++ b/utilities/jira.py @@ -48,7 +48,7 @@ def get_jira_issue_fields(jira_id: str) -> Any: return get_jira_connection().issue(id=jira_id, fields="status, fixVersions").fields -def is_jira_open(jira_id: str, admin_client: DynamicClient) -> bool: +def is_jira_open(jira_id: str, admin_client: DynamicClient) -> bool: # skip-unused-code """ Check if Jira issue is open. @@ -65,7 +65,6 @@ def is_jira_open(jira_id: str, admin_client: DynamicClient) -> bool: else: jira_fields = get_jira_issue_fields(jira_id=jira_id) - # Check if the operator version in ClusterServiceVersion is greater than the jira fix version jira_fix_versions: list[Version] = [ Version(_fix_version.group()) for fix_version in jira_fields.fixVersions