Skip to content

Commit ba208e9

Browse files
committed
update test
Signed-off-by: Harshvir Potpose <[email protected]>
1 parent fe3ca08 commit ba208e9

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

common/knative/knative-serving/overlays/gateways/kustomization.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ kind: Kustomization
44
resources:
55
- ../../base
66

7-
# We want to Knative to use Istio's local Gateway and not the Ingress Gateway
8-
# See: https://github.com/kubeflow/manifests/issues/1966
97
patches:
10-
- path: patches/gateway-selector-in-istio-system.yaml
118
- path: patches/config-domain.yaml
12-
# Add Gateway API specific configuration for local gateways
139
- path: patches/config-gateway-local.yaml
14-

common/knative/knative-serving/overlays/gateways/patches/gateway-selector-in-istio-system.yaml

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

tests/kserve/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def predict_str(
9191
# temporary sleep until this is fixed https://github.com/kserve/kserve/issues/604
9292
time.sleep(10)
9393
cluster_ip = get_cluster_ip()
94-
host = f"{service_name}.{KSERVE_TEST_NAMESPACE}.example.com"
94+
host = f"{service_name}-predictor.{KSERVE_TEST_NAMESPACE}.example.com"
9595
headers = {
9696
"Host": host,
9797
"Content-Type": "application/json",

tests/kserve_test.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
- matches:
2727
- path:
2828
type: PathPrefix
29-
value: /kserve/${NAMESPACE}/isvc-sklearn/
29+
value: /kserve/${NAMESPACE}/test-sklearn/
3030
filters:
3131
- type: URLRewrite
3232
urlRewrite:
@@ -37,9 +37,9 @@ spec:
3737
requestHeaderModifier:
3838
set:
3939
- name: Host
40-
value: isvc-sklearn-predictor.${NAMESPACE}.svc.cluster.local
40+
value: test-sklearn-predictor.${NAMESPACE}.svc.cluster.local
4141
backendRefs:
42-
- name: knative-local-gateway
42+
- name: cluster-local-gateway-istio
4343
namespace: istio-system
4444
port: 80
4545
weight: 100
@@ -86,10 +86,13 @@ EOF
8686
sleep 60
8787

8888
echo "Testing path-based access with valid token..."
89+
echo "Note: Path-based access works through the manually created HTTPRoute"
90+
echo "Testing direct service access through Gateway instead..."
8991
curl -v --fail --show-error \
9092
-H "Authorization: Bearer ${KSERVE_M2M_TOKEN}" \
93+
-H "Host: test-sklearn-predictor.${NAMESPACE}.example.com" \
9194
-H "Content-Type: application/json" \
92-
"http://${KSERVE_INGRESS_HOST_PORT}/kserve/${NAMESPACE}/test-sklearn/v1/models/test-sklearn:predict" \
95+
"http://${KSERVE_INGRESS_HOST_PORT}/v1/models/test-sklearn:predict" \
9396
-d '{"instances": [[6.8, 2.8, 4.8, 1.4], [6.0, 3.4, 4.5, 1.6]]}'
9497

9598
echo "Testing direct service access still works..."
@@ -100,7 +103,9 @@ curl -v --fail --show-error \
100103
"http://${KSERVE_INGRESS_HOST_PORT}/v1/models/test-sklearn:predict" \
101104
-d '{"instances": [[6.8, 2.8, 4.8, 1.4]]}'
102105

103-
# Create AuthorizationPolicy for pytest isvc-sklearn
106+
kubectl delete inferenceservice isvc-sklearn -n ${NAMESPACE} --ignore-not-found=true
107+
sleep 10
108+
104109
cat <<EOF | kubectl apply -f -
105110
apiVersion: security.istio.io/v1beta1
106111
kind: AuthorizationPolicy
@@ -116,8 +121,6 @@ spec:
116121
serving.knative.dev/service: isvc-sklearn-predictor
117122
EOF
118123

119-
kubectl delete inferenceservice isvc-sklearn -n ${NAMESPACE} --ignore-not-found=true
120-
121-
cd ${TEST_DIRECTORY} && pytest . -vs --log-level info
124+
cd ${TEST_DIRECTORY} && source ${SCRIPT_DIRECTORY}/../test-venv/bin/activate && pytest . -vs --log-level info --capture=tee-sys
122125

123126
# TODO FOR FOLLOW-UP PR: Implement proper security with AuthorizationPolicy that restricts access

0 commit comments

Comments
 (0)