Skip to content

Commit

Permalink
Update use of now deleted namespace urls in operator (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbroyles authored Nov 2, 2020
1 parent d8151fd commit 9db8dc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions pkg/m3admin/namespace/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ import (
)

const (
namespaceLegacyBaseURL = "/api/v1/namespace"
namespaceBaseURL = "/api/v1/services/m3db/namespace"
namespaceDeleteFmt = namespaceLegacyBaseURL + "/%s"
namespaceReadyURL = namespaceBaseURL + "/ready"
namespaceBaseURL = "/api/v1/services/m3db/namespace"
namespaceDeleteFmt = namespaceBaseURL + "/%s"
namespaceReadyURL = namespaceBaseURL + "/ready"
)

type namespaceClient struct {
Expand Down Expand Up @@ -102,7 +101,7 @@ func NewClient(opts ...Option) (Client, error) {

// Create will create a namespace
func (n *namespaceClient) Create(req *admin.NamespaceAddRequest) error {
url := n.url + namespaceLegacyBaseURL
url := n.url + namespaceBaseURL
err := n.client.DoHTTPJSONPBRequest(http.MethodPost, url, req, nil)
if err != nil {
return err
Expand All @@ -114,7 +113,7 @@ func (n *namespaceClient) Create(req *admin.NamespaceAddRequest) error {
// List will retrieve all namespaces
func (n *namespaceClient) List() (*admin.NamespaceGetResponse, error) {
var (
url = n.url + namespaceLegacyBaseURL
url = n.url + namespaceBaseURL
resp = &admin.NamespaceGetResponse{}
)
err := n.client.DoHTTPJSONPBRequest(http.MethodGet, url, nil, resp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/m3admin/namespace/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestGetErr(t *testing.T) {

func TestDelete(t *testing.T) {
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.String() != "/api/v1/namespace/default" || r.Method != "DELETE" {
if r.URL.String() != "/api/v1/services/m3db/namespace/default" || r.Method != "DELETE" {
w.WriteHeader(404)
return
}
Expand Down

0 comments on commit 9db8dc2

Please sign in to comment.