Skip to content

Commit

Permalink
remove testing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrennz committed Nov 25, 2024
1 parent 2edd13e commit 1a511fb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pkg/diagnostic/kms/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"strings"
"time"

"github.com/cloudzero-cloudzero-agent-validator/pkg/diagnostic"

Check failure on line 11 in pkg/diagnostic/kms/check.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/cloudzero-cloudzero-agent-validator/pkg/diagnostic; to add it:
"github.com/cloudzero-cloudzero-agent-validator/pkg/logging"

Check failure on line 12 in pkg/diagnostic/kms/check.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/cloudzero-cloudzero-agent-validator/pkg/logging; to add it:
"github.com/cloudzero-cloudzero-agent-validator/pkg/status"

Check failure on line 13 in pkg/diagnostic/kms/check.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/cloudzero-cloudzero-agent-validator/pkg/status; to add it:
"github.com/cloudzero/cloudzero-agent-validator/pkg/config"
"github.com/cloudzero/cloudzero-agent-validator/pkg/diagnostic"
"github.com/cloudzero/cloudzero-agent-validator/pkg/logging"
"github.com/cloudzero/cloudzero-agent-validator/pkg/status"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand All @@ -20,7 +20,6 @@ import (
)

const DiagnosticKMS = config.DiagnosticKMS
const DiagnosticKMSMetrics = "DiagnosticKMSMetrics"

var (
// Exported so that it can be overridden in tests
Expand Down Expand Up @@ -125,7 +124,7 @@ func (c *checker) Check(ctx context.Context, client *net.Client, accessor status
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
c.logger.Errorf("Failed to read metrics: %v", err)
accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMSMetrics, Passing: false, Error: fmt.Sprintf("Failed to read metrics: %s", err.Error())})
accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMS, Passing: false, Error: fmt.Sprintf("Failed to read metrics: %s", err.Error())})
return nil
}

Expand All @@ -134,13 +133,12 @@ func (c *checker) Check(ctx context.Context, client *net.Client, accessor status
for _, metric := range requiredMetrics {
if !strings.Contains(metrics, metric) {
c.logger.Errorf("Required metric %s not found", metric)
accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMSMetrics, Passing: false, Error: fmt.Sprintf("Required metric %s not found", metric)})
accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMS, Passing: false, Error: fmt.Sprintf("Required metric %s not found", metric)})
return nil
}
}

accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMS, Passing: true})
accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMSMetrics, Passing: true})
return nil
}

Expand All @@ -149,6 +147,6 @@ func (c *checker) Check(ctx context.Context, client *net.Client, accessor status
time.Sleep(RetryInterval)
}

accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMSMetrics, Passing: false, Error: fmt.Sprintf("Failed to fetch metrics after %d retries", MaxRetry)})
accessor.AddCheck(&status.StatusCheck{Name: DiagnosticKMS, Passing: false, Error: fmt.Sprintf("Failed to fetch metrics after %d retries", MaxRetry)})
return nil
}

0 comments on commit 1a511fb

Please sign in to comment.