Skip to content

Commit 425d1f7

Browse files
committed
Give ingress 5s to be ready
1 parent 4ec66f9 commit 425d1f7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/instances/manager_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,13 @@ func TestBasicEndToEnd(t *testing.T) {
401401

402402
// Make HTTP request through Envoy to nginx with retry
403403
// Envoy watches the xDS files and reloads automatically, but we retry to handle timing
404+
// Envoy may take a few seconds to detect file changes and start the new listener
404405
t.Log("Making HTTP request through Envoy to nginx...")
405406
client := &http.Client{Timeout: 2 * time.Second}
406407
var resp *http.Response
407408
var lastErr error
408-
for attempt := 0; attempt < 10; attempt++ {
409+
deadline := time.Now().Add(5 * time.Second)
410+
for time.Now().Before(deadline) {
409411
req, err := http.NewRequest("GET", fmt.Sprintf("http://127.0.0.1:%d/", ingressPort), nil)
410412
require.NoError(t, err)
411413
req.Host = "test.local" // Set Host header to match ingress rule
@@ -419,7 +421,7 @@ func TestBasicEndToEnd(t *testing.T) {
419421
}
420422
time.Sleep(100 * time.Millisecond)
421423
}
422-
require.NoError(t, lastErr, "HTTP request through Envoy should succeed")
424+
require.NoError(t, lastErr, "HTTP request through Envoy should succeed within 5 seconds")
423425
require.NotNil(t, resp)
424426
defer resp.Body.Close()
425427

0 commit comments

Comments
 (0)