Skip to content

Commit fa5c148

Browse files
committed
test: fail testing if network port is busy
Commit "test: handle everything with go test" (9a6159a) handles everything except a case when tests are not terminated when Tarantool start is failed due to busy network port. Patch adds a dumb check that make sure desired port is not busy. Part of #147
1 parent 1a1fe7b commit fa5c148

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test_helpers/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ import (
1616
"io"
1717
"io/ioutil"
1818
"log"
19+
"net"
1920
"os"
2021
"os/exec"
2122
"path/filepath"
2223
"regexp"
2324
"strconv"
25+
"strings"
2426
"time"
2527

2628
"github.com/tarantool/go-tarantool"
@@ -212,6 +214,13 @@ func StartTarantool(startOpts StartOpts) (TarantoolInstance, error) {
212214
}
213215
}
214216

217+
netOpts := strings.Split(startOpts.Listen, ":")
218+
ln, err := net.Listen("tcp", ":"+netOpts[1])
219+
if err != nil {
220+
return inst, err
221+
}
222+
ln.Close()
223+
215224
// Options for restarting tarantool instance.
216225
inst.Opts = startOpts
217226

0 commit comments

Comments
 (0)