Skip to content

Commit 8d2a6e4

Browse files
laines-itoleg-jukovec
authored andcommitted
tests: fix flaky TestGracefulShutdown
Updated list of skippable exec errors. Closes #529
1 parent 48b4481 commit 8d2a6e4

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

test_helpers/main.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"os/exec"
2222
"path/filepath"
2323
"regexp"
24+
"slices"
2425
"strconv"
2526
"strings"
2627
"time"
@@ -237,16 +238,33 @@ func IsTarantoolVersionLess(majorMin uint64, minorMin uint64, patchMin uint64) (
237238
var major, minor, patch uint64
238239

239240
var (
240-
out []byte
241-
err error
241+
out []byte
242+
err error
243+
skipErrors = []string{
244+
"bad file descriptor",
245+
"broken pipe",
246+
}
242247
)
248+
249+
// The loop helps to skip some known errors on the version check and try
250+
// again. For unknown reason the errors sometimes happen on CI.
243251
for range 10 {
244252
out, err = exec.Command(getTarantoolExec(), "--version").Output()
245-
if err == nil || !strings.Contains(err.Error(), "bad file descriptor") {
246-
break
253+
254+
if len(out) > 0 {
255+
if err == nil {
256+
break
257+
}
258+
259+
shouldRetry := slices.ContainsFunc(skipErrors, func(e string) bool {
260+
return strings.Contains(err.Error(), e)
261+
})
262+
263+
if !shouldRetry {
264+
break
265+
}
247266
}
248-
// Skip "bad file descriptor" error and try again.
249-
// For unknown reason it sometimes happens on CI.
267+
250268
time.Sleep(time.Second)
251269
}
252270

0 commit comments

Comments
 (0)