diff --git a/test/pilosa.go b/test/pilosa.go index 6369d0e7d..15fa72998 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -30,7 +30,6 @@ import ( "github.com/pilosa/pilosa/v2/encoding/proto" "github.com/pilosa/pilosa/v2/http" "github.com/pilosa/pilosa/v2/server" - "github.com/pilosa/pilosa/v2/test/port" "github.com/pilosa/pilosa/v2/testhook" ) @@ -72,19 +71,29 @@ func newCommand(tb testing.TB, opts ...server.CommandOption) *Command { m.Config.DataDir = path defaultConf := server.NewConfig() - if err := port.GetPorts(func(ports []int) error { - if m.Config.Bind == defaultConf.Bind { - m.Config.Bind = fmt.Sprintf("http://localhost:%d", ports[0]) - } - if m.Config.BindGRPC == defaultConf.BindGRPC { - m.Config.BindGRPC = fmt.Sprintf("http://localhost:%d", ports[1]) - } - - return nil - }, 2, 10); err != nil { - panic(err) + if m.Config.Bind == defaultConf.Bind { + m.Config.Bind = "http://localhost:0" } + if m.Config.BindGRPC == defaultConf.BindGRPC { + m.Config.BindGRPC = "http://localhost:0" + } + + /* + if err := port.GetPorts(func(ports []int) error { + if m.Config.Bind == defaultConf.Bind { + m.Config.Bind = fmt.Sprintf("http://localhost:%d", ports[0]) + } + if m.Config.BindGRPC == defaultConf.BindGRPC { + m.Config.BindGRPC = fmt.Sprintf("http://localhost:%d", ports[1]) + } + + return nil + }, 2, 10); err != nil { + panic(err) + } + */ + m.Config.Translation.MapSize = 140000 m.Config.WorkerPoolSize = 2 diff --git a/test/port/port_mapper.go b/test/port/port_mapper.go index 78ae2d8f2..b07151c55 100644 --- a/test/port/port_mapper.go +++ b/test/port/port_mapper.go @@ -19,7 +19,6 @@ import ( "log" "net" "strings" - "sync" "syscall" ) @@ -32,12 +31,7 @@ func GetPort(wrapper func(int) error, retries int) error { return GetPorts(f, 1, retries) } -var mu = &sync.Mutex{} - func GetPorts(wrapper func([]int) error, requestedPorts, retries int) error { - mu.Lock() - defer mu.Unlock() - for i := 0; i < retries; i++ { // get all requested ports listeners := make([]net.Listener, requestedPorts) @@ -60,7 +54,7 @@ func GetPorts(wrapper func([]int) error, requestedPorts, retries int) error { // send to wrapper and check output error err := wrapper(ports) if (err != nil) && (err == syscall.EADDRINUSE || strings.Contains(err.Error(), "address already in use")) { - log.Println("[port_mapper] address already in use error calling the wrapper", err) + log.Printf("[port_mapper: %+v] address already in use error calling the wrapper: %v\n", ports, err) // only retry on address already in use error continue }