Skip to content

Commit fcd3a8d

Browse files
author
Mattia Moretti
authored
handled exception for error 401 in multitenancy test (#280)
1 parent 6322598 commit fcd3a8d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/plugin/metrics_functions.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ func (o *OCIDatasource) TestConnectivity(ctx context.Context) error {
5656

5757
var status int
5858
res, err := o.tenancyAccess[key].monitoringClient.ListMetrics(ctx, listMetrics)
59+
status = res.RawResponse.StatusCode
5960
if err != nil {
60-
backend.Logger.Error("TestConnectivity", "Config Key", key, "SKIPPED", err)
61-
} else {
62-
status = res.RawResponse.StatusCode
61+
if status == 401 {
62+
backend.Logger.Error("TestConnectivity", "Config Key", key, "error", err)
63+
return fmt.Errorf("TestConnectivity failed: error in profile %v: %v", key, err)
64+
} else {
65+
backend.Logger.Error("TestConnectivity", "Config Key", key, "SKIPPED", err)
66+
}
6367
}
6468
if status >= 200 && status < 300 {
6569
backend.Logger.Error("TestConnectivity", "Config Key", key, "OK", status)

0 commit comments

Comments
 (0)