Skip to content

Fixes gomega.Eventually() in e2e Test #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const (
defaultModelReadyTimeout = 10 * time.Minute
// defaultInterval is the default interval to check if a resource exists or ready conditions.
defaultInterval = time.Millisecond * 250
// defaultCurlInterval is the default interval to run the test curl command.
defaultCurlInterval = time.Second * 5
// nsName is the name of the Namespace used for tests.
// TODO [danehans]: Must be "default" until https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/227 is fixed
nsName = "default"
Expand Down Expand Up @@ -168,6 +170,7 @@ var (
readyTimeout = getTimeout("READY_TIMEOUT", defaultReadyTimeout)
modelReadyTimeout = getTimeout("MODEL_READY_TIMEOUT", defaultModelReadyTimeout)
interval = defaultInterval
curlInterval = defaultCurlInterval
)

// namespaceExists ensures that a specified namespace exists and is ready for use.
Expand Down
13 changes: 9 additions & 4 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,25 @@ var _ = ginkgo.Describe("InferencePool", func() {
actual := []string{}
gomega.Eventually(func() error {
resp, err := testutils.ExecCommandInPod(ctx, cfg, scheme, kubeCli, nsName, "curl", "curl", curlCmd)
if err != nil || !strings.Contains(resp, "200 OK") {
if err != nil {
return err
}
if !strings.Contains(resp, "200 OK") {
return fmt.Errorf("did not get 200 OK: %s", resp)
}
for _, m := range expected {
if strings.Contains(resp, m) {
actual = append(actual, m)
}
}
// Compare expected and actual models in responses, ignoring order.
// Compare ignoring order
if !cmp.Equal(actual, expected, cmpopts.SortSlices(func(a, b string) bool { return a < b })) {
return err
return fmt.Errorf("actual (%v) != expected (%v); resp=%q", actual, expected, resp)
}

return nil
}, existsTimeout, interval).Should(gomega.Succeed())
}, readyTimeout, curlInterval).Should(gomega.Succeed())

})
})
})
Expand Down
1 change: 0 additions & 1 deletion test/testdata/client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
app: curl
name: curl
namespace: inf-ext-e2e
spec:
containers:
- command:
Expand Down
7 changes: 2 additions & 5 deletions test/testdata/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: envoy
namespace: inf-ext-e2e
labels:
app: envoy
data:
Expand Down Expand Up @@ -101,7 +100,7 @@ data:
grpc_service:
envoy_grpc:
cluster_name: ext_proc
authority: inference-gateway-ext-proc.inf-ext-e2e:9002
authority: inference-gateway-ext-proc.default:9002
timeout: 10s
processing_mode:
request_header_mode: SEND
Expand Down Expand Up @@ -186,7 +185,7 @@ data:
- endpoint:
address:
socket_address:
address: inference-gateway-ext-proc.inf-ext-e2e
address: inference-gateway-ext-proc.default
port_value: 9002
health_status: HEALTHY
load_balancing_weight: 1
Expand All @@ -195,7 +194,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: envoy
namespace: inf-ext-e2e
labels:
app: envoy
spec:
Expand Down Expand Up @@ -276,7 +274,6 @@ metadata:
labels:
app: envoy
name: envoy
namespace: inf-ext-e2e
spec:
ports:
- name: http-8081
Expand Down