From 129c05853becc2bb3930233e60892ab13a6399b4 Mon Sep 17 00:00:00 2001 From: vickysomtee Date: Fri, 19 Apr 2024 11:29:50 +0100 Subject: [PATCH] test: fixed failing unit test Signed-off-by: vickysomtee --- .../controllers/common/providers/dynatrace/client/client.go | 2 +- .../common/providers/dynatrace/client/client_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metrics-operator/controllers/common/providers/dynatrace/client/client.go b/metrics-operator/controllers/common/providers/dynatrace/client/client.go index 8a2a802a55..909e713258 100644 --- a/metrics-operator/controllers/common/providers/dynatrace/client/client.go +++ b/metrics-operator/controllers/common/providers/dynatrace/client/client.go @@ -128,7 +128,7 @@ func (client *apiClient) auth(ctx context.Context) (int, error) { } if oauthResponse.AccessToken == "" { - return http.StatusInternalServerError, ErrAuthenticationFailed + return http.StatusUnauthorized, ErrAuthenticationFailed } client.config.oAuthCredentials.accessToken = oauthResponse.AccessToken diff --git a/metrics-operator/controllers/common/providers/dynatrace/client/client_test.go b/metrics-operator/controllers/common/providers/dynatrace/client/client_test.go index 85b8bf916d..9e5029a3fd 100644 --- a/metrics-operator/controllers/common/providers/dynatrace/client/client_test.go +++ b/metrics-operator/controllers/common/providers/dynatrace/client/client_test.go @@ -79,7 +79,7 @@ func TestAPIClientAuthError(t *testing.T) { require.ErrorIs(t, err, ErrRequestFailed) require.Empty(t, resp) - require.Equal(t, http.StatusUnauthorized, code) + require.Equal(t, http.StatusInternalServerError, code) } func TestAPIClientAuthNoToken(t *testing.T) {