Skip to content

Commit aca9121

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 makre desired port is not busy. Part of #147
1 parent d44ffa0 commit aca9121

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
@@ -14,10 +14,12 @@ import (
1414
"errors"
1515
"fmt"
1616
"log"
17+
"net"
1718
"os"
1819
"os/exec"
1920
"regexp"
2021
"strconv"
22+
"strings"
2123
"time"
2224

2325
"github.com/tarantool/go-tarantool"
@@ -185,6 +187,13 @@ func StartTarantool(startOpts StartOpts) (TarantoolInstance, error) {
185187
return inst, err
186188
}
187189

190+
netOpts := strings.Split(startOpts.Listen, ":")
191+
ln, err := net.Listen("tcp", ":"+netOpts[1])
192+
if err != nil {
193+
return inst, err
194+
}
195+
ln.Close()
196+
188197
// Options for restarting tarantool instance.
189198
inst.Opts = startOpts
190199

0 commit comments

Comments
 (0)