Skip to content

Commit 04f4f71

Browse files
feat: retry if unable to access the internet (#282)
1 parent 0601b43 commit 04f4f71

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

e2e/cluster/cluster.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,19 @@ func NodeHasInternet(in *Input, node string) {
286286
Stderr: os.Stderr,
287287
Line: []string{"/usr/local/bin/check_internet.sh"},
288288
}
289-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
290-
defer cancel()
291-
if err := Run(ctx, in.T, cmd); err != nil {
292-
in.T.Fatalf("Unable to reach internet from %s: %v", node, err)
289+
var success bool
290+
for i := 0; i < 5; i++ {
291+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
292+
defer cancel()
293+
if err := Run(ctx, in.T, cmd); err != nil {
294+
in.T.Logf("Unable to reach internet from %s: %v", node, err)
295+
continue
296+
}
297+
success = true
298+
break
299+
}
300+
if !success {
301+
in.T.Fatalf("Unable to reach internet from %s", node)
293302
}
294303
}
295304

0 commit comments

Comments
 (0)