diff --git a/test/e2e/helm/test_kserve_sklearn.py b/test/e2e/helm/test_kserve_sklearn.py index 5b8d08d992a..140c34b5428 100644 --- a/test/e2e/helm/test_kserve_sklearn.py +++ b/test/e2e/helm/test_kserve_sklearn.py @@ -28,12 +28,13 @@ constants ) -from ..common.utils import KSERVE_TEST_NAMESPACE, predict +from ..common.utils import KSERVE_TEST_NAMESPACE, predict, get_cluster_ip @pytest.mark.helm def test_sklearn_kserve(): service_name = "isvc-sklearn-helm" + protocol_version = "v2" predictor = V1beta1PredictorSpec( min_replicas=1, @@ -43,7 +44,7 @@ def test_sklearn_kserve(): ), runtime="kserve-mlserver", storage_uri="gs://seldon-models/sklearn/mms/lr_model", - protocol_version="v2", + protocol_version=protocol_version, resources=V1ResourceRequirements( requests={"cpu": "50m", "memory": "128Mi"}, limits={"cpu": "100m", "memory": "512Mi"}, @@ -65,6 +66,14 @@ def test_sklearn_kserve(): kserve_client.create(isvc) kserve_client.wait_isvc_ready( service_name, namespace=KSERVE_TEST_NAMESPACE) + kserve_client.wait_model_ready( + service_name, + model_name=service_name, + isvc_namespace=KSERVE_TEST_NAMESPACE, + isvc_version=constants.KSERVE_V1BETA1_VERSION, + protocol_version=protocol_version, + cluster_ip=get_cluster_ip(), + ) res = predict(service_name, "./data/iris_input_v2.json", protocol_version="v2") diff --git a/test/e2e/predictor/test_lightgbm.py b/test/e2e/predictor/test_lightgbm.py index 0396a9827e7..77a2eead173 100644 --- a/test/e2e/predictor/test_lightgbm.py +++ b/test/e2e/predictor/test_lightgbm.py @@ -25,7 +25,7 @@ V1beta1ModelFormat, V1beta1ModelSpec, V1beta1PredictorSpec, constants) -from ..common.utils import KSERVE_TEST_NAMESPACE, predict, predict_grpc +from ..common.utils import KSERVE_TEST_NAMESPACE, predict, predict_grpc, get_cluster_ip @pytest.mark.fast @@ -104,6 +104,7 @@ def test_lightgbm_runtime_kserve(): @pytest.mark.fast def test_lightgbm_v2_runtime_mlserver(): service_name = "isvc-lightgbm-v2-runtime" + protocol_version = "v2" predictor = V1beta1PredictorSpec( min_replicas=1, @@ -113,7 +114,7 @@ def test_lightgbm_v2_runtime_mlserver(): ), runtime="kserve-mlserver", storage_uri="gs://kfserving-examples/models/lightgbm/v2/iris", - protocol_version="v2", + protocol_version=protocol_version, resources=V1ResourceRequirements( requests={"cpu": "50m", "memory": "128Mi"}, limits={"cpu": "1", "memory": "1Gi"}, @@ -135,6 +136,14 @@ def test_lightgbm_v2_runtime_mlserver(): kserve_client.create(isvc) kserve_client.wait_isvc_ready( service_name, namespace=KSERVE_TEST_NAMESPACE) + kserve_client.wait_model_ready( + service_name, + model_name=service_name, + isvc_namespace=KSERVE_TEST_NAMESPACE, + isvc_version=constants.KSERVE_V1BETA1_VERSION, + protocol_version=protocol_version, + cluster_ip=get_cluster_ip(), + ) res = predict(service_name, "./data/iris_input_v2.json", protocol_version="v2") diff --git a/test/e2e/predictor/test_sklearn.py b/test/e2e/predictor/test_sklearn.py index 94dd54ce399..ffd37e32e17 100644 --- a/test/e2e/predictor/test_sklearn.py +++ b/test/e2e/predictor/test_sklearn.py @@ -25,7 +25,7 @@ import kserve.protocol.grpc.grpc_predict_v2_pb2 as inference_pb2 -from ..common.utils import KSERVE_TEST_NAMESPACE, predict, predict_grpc +from ..common.utils import KSERVE_TEST_NAMESPACE, predict, predict_grpc, get_cluster_ip @pytest.mark.slow @@ -62,11 +62,13 @@ def test_sklearn_kserve(): @pytest.mark.slow def test_sklearn_v2_mlserver(): service_name = "sklearn-v2-mlserver" + protocol_version = "v2" + predictor = V1beta1PredictorSpec( min_replicas=1, sklearn=V1beta1SKLearnSpec( storage_uri="gs://seldon-models/sklearn/mms/lr_model", - protocol_version="v2", + protocol_version=protocol_version, resources=V1ResourceRequirements( requests={"cpu": "50m", "memory": "128Mi"}, limits={"cpu": "100m", "memory": "512Mi"}, @@ -86,6 +88,14 @@ def test_sklearn_v2_mlserver(): kserve_client = KServeClient(config_file=os.environ.get("KUBECONFIG", "~/.kube/config")) kserve_client.create(isvc) kserve_client.wait_isvc_ready(service_name, namespace=KSERVE_TEST_NAMESPACE) + kserve_client.wait_model_ready( + service_name, + model_name=service_name, + isvc_namespace=KSERVE_TEST_NAMESPACE, + isvc_version=constants.KSERVE_V1BETA1_VERSION, + protocol_version=protocol_version, + cluster_ip=get_cluster_ip(), + ) res = predict(service_name, "./data/iris_input_v2.json", protocol_version="v2") assert res["outputs"][0]["data"] == [1, 1] @@ -131,6 +141,7 @@ def test_sklearn_runtime_kserve(): @pytest.mark.slow def test_sklearn_v2_runtime_mlserver(): service_name = "isvc-sklearn-v2-runtime" + protocol_version = "v2" predictor = V1beta1PredictorSpec( min_replicas=1, @@ -140,7 +151,7 @@ def test_sklearn_v2_runtime_mlserver(): ), runtime="kserve-mlserver", storage_uri="gs://seldon-models/sklearn/mms/lr_model", - protocol_version="v2", + protocol_version=protocol_version, resources=V1ResourceRequirements( requests={"cpu": "50m", "memory": "128Mi"}, limits={"cpu": "100m", "memory": "512Mi"}, @@ -160,6 +171,14 @@ def test_sklearn_v2_runtime_mlserver(): kserve_client = KServeClient(config_file=os.environ.get("KUBECONFIG", "~/.kube/config")) kserve_client.create(isvc) kserve_client.wait_isvc_ready(service_name, namespace=KSERVE_TEST_NAMESPACE) + kserve_client.wait_model_ready( + service_name, + model_name=service_name, + isvc_namespace=KSERVE_TEST_NAMESPACE, + isvc_version=constants.KSERVE_V1BETA1_VERSION, + protocol_version=protocol_version, + cluster_ip=get_cluster_ip(), + ) res = predict(service_name, "./data/iris_input_v2.json", protocol_version="v2") assert res["outputs"][0]["data"] == [1, 1] diff --git a/test/e2e/predictor/test_xgboost.py b/test/e2e/predictor/test_xgboost.py index 1f92ef85beb..f6f853beae7 100644 --- a/test/e2e/predictor/test_xgboost.py +++ b/test/e2e/predictor/test_xgboost.py @@ -23,7 +23,7 @@ V1beta1ModelSpec, V1beta1PredictorSpec, V1beta1XGBoostSpec, constants) -from ..common.utils import KSERVE_TEST_NAMESPACE, predict, predict_grpc +from ..common.utils import KSERVE_TEST_NAMESPACE, predict, predict_grpc, get_cluster_ip @pytest.mark.fast @@ -62,12 +62,14 @@ def test_xgboost_kserve(): @pytest.mark.fast def test_xgboost_v2_mlserver(): service_name = "isvc-xgboost-v2-mlserver" + protocol_version = "v2" + predictor = V1beta1PredictorSpec( min_replicas=1, xgboost=V1beta1XGBoostSpec( storage_uri="gs://kfserving-examples/models/xgboost/iris", env=[V1EnvVar(name="MLSERVER_MODEL_PARALLEL_WORKERS", value="0")], - protocol_version="v2", + protocol_version=protocol_version, resources=V1ResourceRequirements( requests={"cpu": "50m", "memory": "128Mi"}, limits={"cpu": "100m", "memory": "1024Mi"}, @@ -89,6 +91,14 @@ def test_xgboost_v2_mlserver(): kserve_client.create(isvc) kserve_client.wait_isvc_ready( service_name, namespace=KSERVE_TEST_NAMESPACE) + kserve_client.wait_model_ready( + service_name, + model_name=service_name, + isvc_namespace=KSERVE_TEST_NAMESPACE, + isvc_version=constants.KSERVE_V1BETA1_VERSION, + protocol_version=protocol_version, + cluster_ip=get_cluster_ip(), + ) res = predict(service_name, "./data/iris_input_v2.json", protocol_version="v2") @@ -136,6 +146,7 @@ def test_xgboost_runtime_kserve(): @pytest.mark.fast def test_xgboost_v2_runtime_mlserver(): service_name = "isvc-xgboost-v2-runtime" + protocol_version = "v2" predictor = V1beta1PredictorSpec( min_replicas=1, @@ -145,7 +156,7 @@ def test_xgboost_v2_runtime_mlserver(): ), runtime="kserve-mlserver", storage_uri="gs://kfserving-examples/models/xgboost/iris", - protocol_version="v2", + protocol_version=protocol_version, resources=V1ResourceRequirements( requests={"cpu": "50m", "memory": "128Mi"}, limits={"cpu": "100m", "memory": "1024Mi"}, @@ -167,6 +178,14 @@ def test_xgboost_v2_runtime_mlserver(): kserve_client.create(isvc) kserve_client.wait_isvc_ready( service_name, namespace=KSERVE_TEST_NAMESPACE) + kserve_client.wait_model_ready( + service_name, + model_name=service_name, + isvc_namespace=KSERVE_TEST_NAMESPACE, + isvc_version=constants.KSERVE_V1BETA1_VERSION, + protocol_version=protocol_version, + cluster_ip=get_cluster_ip(), + ) res = predict(service_name, "./data/iris_input_v2.json", protocol_version="v2")