Skip to content
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

Fix e2e test #246

Merged
merged 1 commit into from
Jan 29, 2025
Merged
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
14 changes: 9 additions & 5 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = ginkgo.Describe("InferencePool", func() {
for _, m := range infModel.Spec.TargetModels {
expected = append(expected, m.Name)
}
actual := []string{}
actual := make(map[string]int)
gomega.Eventually(func() error {
resp, err := testutils.ExecCommandInPod(ctx, cfg, scheme, kubeCli, nsName, "curl", "curl", curlCmd)
if err != nil {
Expand All @@ -75,12 +75,16 @@ var _ = ginkgo.Describe("InferencePool", func() {
}
for _, m := range expected {
if strings.Contains(resp, m) {
actual = append(actual, m)
actual[m] = 0
}
}
var got []string
for m := range actual {
got = append(got, m)
}
Comment on lines +81 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L101 is the only required change to fix the e2e test, see: #250. What are these changes fixing? IMHO the existing logic is easier to read and understand.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 it seems we don't use the map here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this because we can't guarantee that the traffic splitting logic will select adapter 1 then adapter 2; it could do [adapter 1, adapter 1, adapter 2, adapter 2], and so you need a map to dedup, otherwise the slice in the old code will look like [adapter1, adapter1, adapter 2] vs the expected [adapter1, adapter2]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the int threw me off. So we are treating this like a set and just verifying that we are hitting each distinct targetModel. Yeah, agreed, this prevents flakes.

// Compare ignoring order
if !cmp.Equal(actual, expected, cmpopts.SortSlices(func(a, b string) bool { return a < b })) {
return fmt.Errorf("actual (%v) != expected (%v); resp=%q", actual, expected, resp)
if !cmp.Equal(got, expected, cmpopts.SortSlices(func(a, b string) bool { return a < b })) {
return fmt.Errorf("actual (%v) != expected (%v); resp=%q", got, expected, resp)
}

return nil
Expand All @@ -94,7 +98,7 @@ var _ = ginkgo.Describe("InferencePool", func() {
func newInferenceModel(ns string) *infextv1a1.InferenceModel {
targets := []infextv1a1.TargetModel{
{
Name: modelName + "%-0",
Name: modelName + "-0",
Weight: ptr.To(int32(50)),
},
{
Expand Down