From f066fcb33ca81e67988df608f2e65aba53c5ae03 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 18 Aug 2022 11:19:01 -0500 Subject: [PATCH] Use socket instead of TCP for etcd config When we make dummy test servers, we should make them using sockets for etcd rather than TCP ports so we don't run into problems like the test always failing if anything else is on that port already, which it can totally legitimately be. For instance, if you ran an existing featurebase server, and then tried "go test" in the server directory, this would fail. --- test/pilosa.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/pilosa.go b/test/pilosa.go index d6663afd8..186568374 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -52,6 +52,11 @@ func newCommand(tb testing.TB, opts ...server.CommandOption) *Command { m := &Command{commandOptions: opts} m.Command = server.NewCommand(bytes.NewReader(nil), ioutil.Discard, ioutil.Discard, opts...) + // pick etcd ports using a socket rather than a real port + err = GetPortsGenConfigs(tb, []*Command{m}) + if err != nil { + tb.Fatalf("generating config: %v", err) + } m.Config.DataDir = path defaultConf := server.NewConfig()