From c60057c05329026e95c861899ddfdf31de501ff1 Mon Sep 17 00:00:00 2001 From: scbizu Date: Sat, 21 Sep 2024 21:20:38 +0800 Subject: [PATCH] server: fixup tests Signed-off-by: scbizu --- pkg/chartmuseum/server/multitenant/server_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/chartmuseum/server/multitenant/server_test.go b/pkg/chartmuseum/server/multitenant/server_test.go index a572023d..ea86e10e 100644 --- a/pkg/chartmuseum/server/multitenant/server_test.go +++ b/pkg/chartmuseum/server/multitenant/server_test.go @@ -971,13 +971,16 @@ func (suite *MultiTenantServerTestSuite) TestMaxUploadSizeServer() { } func (suite *MultiTenantServerTestSuite) TestMetrics() { + res := suite.doRequest("depth1", "GET", "bad-url", nil, "") + suite.Equal(404, res.Status(), "404 GET bad-url") + apiPrefix := pathutil.Join("/api", "a") content, err := os.ReadFile(testTarballPath) suite.Nil(err, "error opening test tarball") body := bytes.NewBuffer(content) - res := suite.doRequest("depth1", "POST", fmt.Sprintf("%s/charts", apiPrefix), body, "") + res = suite.doRequest("depth1", "POST", fmt.Sprintf("%s/charts", apiPrefix), body, "") suite.Equal(201, res.Status(), fmt.Sprintf("201 post %s/charts", apiPrefix)) otherChart, err := os.ReadFile(testTarballPathV2) @@ -995,9 +998,6 @@ func (suite *MultiTenantServerTestSuite) TestMetrics() { res = suite.doRequest("depth1", "GET", "/b/index.yaml", nil, "") suite.Equal(200, res.Status(), "200 GET /b/index.yaml") - res = suite.doRequest("depth1", "GET", "/bad-url", nil, "") - suite.Equal(404, res.Status(), "404 GET /bad-url") - var buffer *bytes.Buffer var metrics string