Skip to content

Commit ead701c

Browse files
AlinsRanCopilot
andcommitted
test: fix e2e upstream health check assertions
Upstream Name is cleared when embedded in a service object (httproute translator sets Name="" for single-backend upstreams). Filtering by name always fails; rely on Checks field instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 84c72fd commit ead701c

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

test/e2e/crds/v1alpha1/backendtrafficpolicy.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package v1alpha1
2020
import (
2121
"context"
2222
"fmt"
23-
"strings"
2423
"time"
2524

2625
. "github.com/onsi/ginkgo/v2"
@@ -241,7 +240,7 @@ spec:
241240

242241
var target *adctypes.Upstream
243242
for _, u := range ups {
244-
if strings.Contains(u.Name, "httpbin-service-e2e-test") && u.Checks != nil {
243+
if u.Checks != nil {
245244
target = u
246245
break
247246
}
@@ -277,7 +276,7 @@ spec:
277276

278277
var target *adctypes.Upstream
279278
for _, u := range ups {
280-
if strings.Contains(u.Name, "httpbin-service-e2e-test") && u.Checks != nil && u.Checks.Passive != nil {
279+
if u.Checks != nil && u.Checks.Passive != nil {
281280
target = u
282281
break
283282
}
@@ -315,7 +314,7 @@ spec:
315314
Expect(err).ToNot(HaveOccurred())
316315
hasHealthCheck := false
317316
for _, u := range ups {
318-
if strings.Contains(u.Name, "httpbin-service-e2e-test") && u.Checks != nil {
317+
if u.Checks != nil {
319318
hasHealthCheck = true
320319
break
321320
}
@@ -331,9 +330,7 @@ spec:
331330
ups, err = s.DefaultDataplaneResource().Upstream().List(context.Background())
332331
Expect(err).ToNot(HaveOccurred())
333332
for _, u := range ups {
334-
if strings.Contains(u.Name, "httpbin-service-e2e-test") {
335-
Expect(u.Checks).To(BeNil(), "upstream should not have health check after policy deletion")
336-
}
333+
Expect(u.Checks).To(BeNil(), "upstream should not have health check after policy deletion")
337334
}
338335
})
339336
})

0 commit comments

Comments
 (0)