diff --git a/ctl/import_test.go b/ctl/import_test.go index 5500fdadf..522de0eba 100644 --- a/ctl/import_test.go +++ b/ctl/import_test.go @@ -188,7 +188,7 @@ func TestImportCommand_BugOverwriteValue(t *testing.T) { t.Fatal(err) } - cm.Host = cmd.Server.Addr().String() + cm.Host = cmd.Server.URI.HostPort() http.DefaultClient.Do(MustNewHTTPRequest("POST", "http://"+cm.Host+"/index/i", strings.NewReader(""))) http.DefaultClient.Do(MustNewHTTPRequest("POST", "http://"+cm.Host+"/index/i/field/f", strings.NewReader(`{"options":{"type": "int", "min": 0, "max":2147483648 }}`))) diff --git a/http/client_test.go b/http/client_test.go index 5ac29ec2c..3ca4cde50 100644 --- a/http/client_test.go +++ b/http/client_test.go @@ -220,7 +220,7 @@ func TestClient_MultiNode(t *testing.T) { // Ensure client can bulk import data. func TestClient_Import(t *testing.T) { cmd := test.MustRunMainWithCluster(t, 1)[0] - host := cmd.Server.Addr().String() + host := cmd.URL() holder := cmd.Server.Holder() hldr := test.Holder{Holder: holder} @@ -250,7 +250,7 @@ func TestClient_Import(t *testing.T) { // Ensure client can bulk import value data. func TestClient_ImportValue(t *testing.T) { cmd := test.MustRunMainWithCluster(t, 1)[0] - host := cmd.Server.Addr().String() + host := cmd.URL() holder := cmd.Server.Holder() hldr := test.Holder{Holder: holder} @@ -330,7 +330,7 @@ func TestClient_FragmentBlocks(t *testing.T) { // Set a bit on a different slice. hldr.SetBit("i", "f", 0, 1) - c := MustNewClient(cmd.Server.Addr().String(), defaultClient) + c := MustNewClient(cmd.URL(), defaultClient) blocks, err := c.FragmentBlocks(context.Background(), nil, "i", "f", 0) if err != nil { t.Fatal(err) diff --git a/server.go b/server.go index 3cd763986..9305f9e0d 100644 --- a/server.go +++ b/server.go @@ -18,7 +18,6 @@ import ( "context" "fmt" "log" - "net" "os" "os/exec" "path/filepath" @@ -372,23 +371,6 @@ func (s *Server) LoadNodeID() string { return nodeID } -type pilosaAddr URI - -func (p pilosaAddr) String() string { - uri := URI(p) - return uri.HostPort() - -} - -func (pilosaAddr) Network() string { - return "tcp" -} - -// Addr returns the address of the listener. -func (s *Server) Addr() net.Addr { - return pilosaAddr(s.URI) -} - func (s *Server) monitorAntiEntropy() { ticker := time.NewTicker(s.antiEntropyInterval) defer ticker.Stop() diff --git a/test/pilosa.go b/test/pilosa.go index ece7c27d6..e201de283 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -180,7 +180,7 @@ func (m *Main) Reopen() error { } // URL returns the base URL string for accessing the running program. -func (m *Main) URL() string { return "http://" + m.Server.Addr().String() } +func (m *Main) URL() string { return m.Server.URI.String() } // Client returns a client to connect to the program. func (m *Main) Client() *http.InternalClient { diff --git a/test/pilosa_test.go b/test/pilosa_test.go index a8833f548..2ba7504c8 100644 --- a/test/pilosa_test.go +++ b/test/pilosa_test.go @@ -37,7 +37,7 @@ func TestNewCluster(t *testing.T) { } req, err := http.NewRequest( "GET", - "http://"+cluster[0].Server.Addr().String()+"/status", + cluster[0].URL()+"/status", strings.NewReader(""), )