Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanxin committed Mar 7, 2024
1 parent bb3ed25 commit 01de87c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/testutils/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var ErrMetricNotFound = errors.New("metric was not found")

func GetKymaStateMetricCount(ctx context.Context, kymaName, state shared.State) (int, error) {
func GetKymaStateMetricCount(ctx context.Context, kymaName string, state shared.State) (int, error) {
bodyString, err := getMetricsBody(ctx)
if err != nil {
return 0, err
Expand All @@ -25,13 +25,13 @@ func GetKymaStateMetricCount(ctx context.Context, kymaName, state shared.State)
return parseCount(re, bodyString)
}

func getKymaStateMetricRegex(kymaName, state shared.State) *regexp.Regexp {
func getKymaStateMetricRegex(kymaName string, state shared.State) *regexp.Regexp {
return regexp.MustCompile(fmt.Sprintf(`%s{instance_id="[^"]+",kyma_name="%s",shoot="[^"]+",state="%s"} (\d+)`,
metrics.MetricKymaState,
kymaName, string(state)))
}

func AssertKymaStateMetricNotFound(ctx context.Context, kymaName, state shared.State) error {
func AssertKymaStateMetricNotFound(ctx context.Context, kymaName string, state shared.State) error {
bodyString, err := getMetricsBody(ctx)
if err != nil {
return err
Expand Down Expand Up @@ -75,7 +75,7 @@ func IsManifestRequeueReasonCountIncreased(ctx context.Context, requeueReason, r
return count >= 1, err
}

func GetModuleStateMetricCount(ctx context.Context, kymaName, moduleName, state shared.State) (int, error) {
func GetModuleStateMetricCount(ctx context.Context, kymaName, moduleName string, state shared.State) (int, error) {
bodyString, err := getMetricsBody(ctx)
if err != nil {
return 0, err
Expand Down
2 changes: 1 addition & 1 deletion unit-test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ packages:
internal/descriptor/provider: 68
internal/manifest/filemutex: 100
internal/istio: 63
internal/pkg/resources: 100
internal/pkg/resources: 90

0 comments on commit 01de87c

Please sign in to comment.