Skip to content

Commit

Permalink
test: fail testing if network port is busy
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ligurio committed May 24, 2022
1 parent d44ffa0 commit 21db8a4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test_helpers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import (
"errors"
"fmt"
"log"
"net"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
"time"

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

netOpts := strings.Split(startOpts.Listen, ":")
ln, err := net.Listen("tcp", ":"+netOpts[1])
if err != nil {
return inst, err
}
ln.Close()

// Options for restarting tarantool instance.
inst.Opts = startOpts

Expand Down

0 comments on commit 21db8a4

Please sign in to comment.