Skip to content

Commit 89cf2e4

Browse files
laines-itoleg-jukovec
authored andcommitted
tests: fix flaky TestGracefulShutdown
Fork-exec for some reason fails with 'bad file descriptor' error. Retries exec if Tarantool version check fails. Closes #503
1 parent 226e0e8 commit 89cf2e4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test_helpers/main.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"path/filepath"
2323
"regexp"
2424
"strconv"
25+
"strings"
2526
"time"
2627

2728
"github.com/tarantool/go-tarantool/v3"
@@ -235,7 +236,19 @@ func getTarantoolExec() string {
235236
func IsTarantoolVersionLess(majorMin uint64, minorMin uint64, patchMin uint64) (bool, error) {
236237
var major, minor, patch uint64
237238

238-
out, err := exec.Command(getTarantoolExec(), "--version").Output()
239+
var (
240+
out []byte
241+
err error
242+
)
243+
for range 10 {
244+
out, err = exec.Command(getTarantoolExec(), "--version").Output()
245+
if err == nil || !strings.Contains(err.Error(), "bad file descriptor") {
246+
break
247+
}
248+
// Skip "bad file descriptor" error and try again.
249+
// For unknown reason it sometimes happens on CI.
250+
time.Sleep(time.Second)
251+
}
239252

240253
if err != nil {
241254
return true, err

0 commit comments

Comments
 (0)