From 9cebef2bf3481e02c97151b2a525787611b5244a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Mon, 16 Sep 2024 09:51:58 -0300 Subject: [PATCH] Fix tests --- pkg/rpaas/client/metadata.go | 6 +++--- pkg/rpaas/client/metadata_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/rpaas/client/metadata.go b/pkg/rpaas/client/metadata.go index 87624101..9cf15c57 100644 --- a/pkg/rpaas/client/metadata.go +++ b/pkg/rpaas/client/metadata.go @@ -20,7 +20,7 @@ func (c *client) GetMetadata(ctx context.Context, instance string) (*types.Metad } pathName := fmt.Sprintf("/resources/%s/metadata", instance) - req, err := c.newRequest("GET", pathName, nil, instance) + req, err := c.newRequest("GET", pathName, nil) if err != nil { return nil, err } @@ -55,7 +55,7 @@ func (c *client) SetMetadata(ctx context.Context, instance string, metadata *typ body := bytes.NewReader(b) pathName := fmt.Sprintf("/resources/%s/metadata", instance) - req, err := c.newRequest("POST", pathName, body, instance) + req, err := c.newRequest("POST", pathName, body) if err != nil { return err } @@ -86,7 +86,7 @@ func (c *client) UnsetMetadata(ctx context.Context, instance string, metadata *t body := bytes.NewReader(b) pathName := fmt.Sprintf("/resources/%s/metadata", instance) - req, err := c.newRequest("DELETE", pathName, body, instance) + req, err := c.newRequest("DELETE", pathName, body) if err != nil { return err } diff --git a/pkg/rpaas/client/metadata_test.go b/pkg/rpaas/client/metadata_test.go index 03899d56..65c04417 100644 --- a/pkg/rpaas/client/metadata_test.go +++ b/pkg/rpaas/client/metadata_test.go @@ -43,7 +43,7 @@ func TestClientThroughTsuru_GetMetadata(t *testing.T) { instance: "my-instance", handler: func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Method, "GET") - assert.Equal(t, fmt.Sprintf("/services/%s/proxy/%s?callback=%s", FakeTsuruService, "my-instance", "/resources/my-instance/metadata"), r.URL.RequestURI()) + assert.Equal(t, fmt.Sprintf("/1.20/services/%s/resources/%s/metadata", FakeTsuruService, "my-instance"), r.URL.RequestURI()) assert.Equal(t, "Bearer f4k3t0k3n", r.Header.Get("Authorization")) metadata := types.Metadata{ @@ -102,7 +102,7 @@ func TestClientThroughTsuru_SetMetadata(t *testing.T) { instance: "my-instance", handler: func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Method, "POST") - assert.Equal(t, fmt.Sprintf("/services/%s/proxy/%s?callback=%s", FakeTsuruService, "my-instance", "/resources/my-instance/metadata"), r.URL.RequestURI()) + assert.Equal(t, fmt.Sprintf("/1.20/services/%s/resources/%s/metadata", FakeTsuruService, "my-instance"), r.URL.RequestURI()) assert.Equal(t, "Bearer f4k3t0k3n", r.Header.Get("Authorization")) assert.Equal(t, "application/json", r.Header.Get("Content-Type")) assert.NotNil(t, r.Body) @@ -154,7 +154,7 @@ func TestClientThroughTsuru_UnsetMetadata(t *testing.T) { instance: "my-instance", handler: func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Method, "DELETE") - assert.Equal(t, fmt.Sprintf("/services/%s/proxy/%s?callback=%s", FakeTsuruService, "my-instance", "/resources/my-instance/metadata"), r.URL.RequestURI()) + assert.Equal(t, fmt.Sprintf("/1.20/services/%s/resources/%s/metadata", FakeTsuruService, "my-instance"), r.URL.RequestURI()) assert.Equal(t, "Bearer f4k3t0k3n", r.Header.Get("Authorization")) assert.Equal(t, "application/json", r.Header.Get("Content-Type")) assert.NotNil(t, r.Body)