Skip to content

Commit ed8f1e4

Browse files
danehanskfswain
authored andcommitted
Fixes gomega.Eventually() in e2e Test (kubernetes-sigs#241)
* Fixes gomega.Eventually in e2e Test Signed-off-by: Daneyon Hansen <[email protected]> * Adds curl timeout and interval Signed-off-by: Daneyon Hansen <[email protected]> --------- Signed-off-by: Daneyon Hansen <[email protected]>
1 parent 9256fa7 commit ed8f1e4

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

test/e2e/e2e_suite_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ const (
5151
defaultModelReadyTimeout = 10 * time.Minute
5252
// defaultInterval is the default interval to check if a resource exists or ready conditions.
5353
defaultInterval = time.Millisecond * 250
54+
// defaultCurlInterval is the default interval to run the test curl command.
55+
defaultCurlInterval = time.Second * 5
5456
// nsName is the name of the Namespace used for tests.
5557
// TODO [danehans]: Must be "default" until https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/227 is fixed
5658
nsName = "default"
@@ -168,6 +170,7 @@ var (
168170
readyTimeout = getTimeout("READY_TIMEOUT", defaultReadyTimeout)
169171
modelReadyTimeout = getTimeout("MODEL_READY_TIMEOUT", defaultModelReadyTimeout)
170172
interval = defaultInterval
173+
curlInterval = defaultCurlInterval
171174
)
172175

173176
// namespaceExists ensures that a specified namespace exists and is ready for use.

test/e2e/e2e_test.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,25 @@ var _ = ginkgo.Describe("InferencePool", func() {
6767
actual := []string{}
6868
gomega.Eventually(func() error {
6969
resp, err := testutils.ExecCommandInPod(ctx, cfg, scheme, kubeCli, nsName, "curl", "curl", curlCmd)
70-
if err != nil || !strings.Contains(resp, "200 OK") {
70+
if err != nil {
7171
return err
7272
}
73+
if !strings.Contains(resp, "200 OK") {
74+
return fmt.Errorf("did not get 200 OK: %s", resp)
75+
}
7376
for _, m := range expected {
7477
if strings.Contains(resp, m) {
7578
actual = append(actual, m)
7679
}
7780
}
78-
// Compare expected and actual models in responses, ignoring order.
81+
// Compare ignoring order
7982
if !cmp.Equal(actual, expected, cmpopts.SortSlices(func(a, b string) bool { return a < b })) {
80-
return err
83+
return fmt.Errorf("actual (%v) != expected (%v); resp=%q", actual, expected, resp)
8184
}
85+
8286
return nil
83-
}, existsTimeout, interval).Should(gomega.Succeed())
87+
}, readyTimeout, curlInterval).Should(gomega.Succeed())
88+
8489
})
8590
})
8691
})

test/testdata/client.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
labels:
66
app: curl
77
name: curl
8-
namespace: inf-ext-e2e
98
spec:
109
containers:
1110
- command:

test/testdata/envoy.yaml

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: v1
22
kind: ConfigMap
33
metadata:
44
name: envoy
5-
namespace: inf-ext-e2e
65
labels:
76
app: envoy
87
data:
@@ -101,7 +100,7 @@ data:
101100
grpc_service:
102101
envoy_grpc:
103102
cluster_name: ext_proc
104-
authority: inference-gateway-ext-proc.inf-ext-e2e:9002
103+
authority: inference-gateway-ext-proc.default:9002
105104
timeout: 10s
106105
processing_mode:
107106
request_header_mode: SEND
@@ -186,7 +185,7 @@ data:
186185
- endpoint:
187186
address:
188187
socket_address:
189-
address: inference-gateway-ext-proc.inf-ext-e2e
188+
address: inference-gateway-ext-proc.default
190189
port_value: 9002
191190
health_status: HEALTHY
192191
load_balancing_weight: 1
@@ -195,7 +194,6 @@ apiVersion: apps/v1
195194
kind: Deployment
196195
metadata:
197196
name: envoy
198-
namespace: inf-ext-e2e
199197
labels:
200198
app: envoy
201199
spec:
@@ -276,7 +274,6 @@ metadata:
276274
labels:
277275
app: envoy
278276
name: envoy
279-
namespace: inf-ext-e2e
280277
spec:
281278
ports:
282279
- name: http-8081

0 commit comments

Comments
 (0)