diff --git a/comp/process/apiserver/apiserver_test.go b/comp/process/apiserver/apiserver_test.go index b99520ff431077..a44dfbebd2bcf1 100644 --- a/comp/process/apiserver/apiserver_test.go +++ b/comp/process/apiserver/apiserver_test.go @@ -47,8 +47,8 @@ func TestLifecycle(t *testing.T) { req := httptest.NewRequest("GET", "http://localhost:6162/config", nil) req.Header.Set("Authorization", "Bearer "+util.GetAuthToken()) res, err := http.DefaultClient.Do(req) - defer res.Body.Close() assert.NoError(c, err) + defer res.Body.Close() assert.Equal(c, http.StatusOK, res.StatusCode) }, 5*time.Second, time.Second) } @@ -73,15 +73,15 @@ func TestAuthentication(t *testing.T) { assert.EventuallyWithT(t, func(c *assert.CollectT) { req := httptest.NewRequest("GET", "http://localhost:6162/config", nil) res, err := http.DefaultClient.Do(req) - defer res.Body.Close() assert.NoError(c, err) + defer res.Body.Close() assert.Equal(c, http.StatusUnauthorized, res.StatusCode) req = httptest.NewRequest("GET", "http://localhost:6162/config", nil) req.Header.Set("Authorization", "Bearer "+util.GetAuthToken()) res, err = http.DefaultClient.Do(req) - defer res.Body.Close() assert.NoError(c, err) + defer res.Body.Close() assert.Equal(c, http.StatusOK, res.StatusCode) }, 5*time.Second, time.Second) }