Skip to content

Commit

Permalink
adjust tests with hardcoded names
Browse files Browse the repository at this point in the history
  • Loading branch information
amritanshusikdar committed Jan 17, 2025
1 parent 191a814 commit a2e3ae1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 92 deletions.
51 changes: 0 additions & 51 deletions internal/pkg/metrics/module.go

This file was deleted.

30 changes: 0 additions & 30 deletions tests/e2e/commontestutils/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,36 +153,6 @@ func GetMandatoryModuleStateMetric(ctx context.Context, kymaName, moduleName, st
return parseCount(re, bodyString)
}

func GetModuleCRWarningConditionMetric(ctx context.Context, kymaName, moduleName string) (int, error) {
bodyString, err := getMetricsBody(ctx)
if err != nil {
return 0, err
}

re := getModuleCRWarningConditionMetric(kymaName, moduleName)
return parseCount(re, bodyString)
}

func getModuleCRWarningConditionMetric(kymaName, moduleName string) *regexp.Regexp {
return regexp.MustCompile(fmt.Sprintf(`%s{condition="ModuleCRWarning",kyma_name="%s",module_name="%s"} (\d+)`,
metrics.MetricModuleCondition, kymaName, moduleName))
}

func ModuleCRWarningConditionMetricNotFound(ctx context.Context, kymaName, moduleName string) error {
bodyString, err := getMetricsBody(ctx)
if err != nil {
return err
}

re := getModuleCRWarningConditionMetric(kymaName, moduleName)
match := re.FindStringSubmatch(bodyString)
if len(match) < 1 {
return ErrMetricNotFound
}

return nil
}

func getMetricsBody(ctx context.Context) (string, error) {
clnt := &http.Client{}
request, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost:9081/metrics", nil)
Expand Down
11 changes: 0 additions & 11 deletions tests/e2e/module_status_decoupling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ func RunModuleStatusDecouplingTest(resourceKind ResourceKind) {
WithContext(ctx).
WithArguments(skrClient, moduleCR, shared.StateWarning).
Should(BeTrue())
By("And count of metrics lifecycle_mgr_module_condition is 1")
Eventually(GetModuleCRWarningConditionMetric).
WithContext(ctx).
WithArguments(kyma.GetName(), TestModuleName).
Should(Equal(1))
})

It("When blocking finalizers from Module CR get removed", func() {
Expand Down Expand Up @@ -139,12 +134,6 @@ func RunModuleStatusDecouplingTest(resourceKind ResourceKind) {
WithContext(ctx).
WithArguments(kyma.GetName(), kyma.GetNamespace(), kcpClient, shared.StateReady).
Should(Succeed())

By("And count of metrics lifecycle_mgr_module_condition is removed")
Eventually(ModuleCRWarningConditionMetricNotFound).
WithContext(ctx).
WithArguments(kyma.GetName(), TestModuleName).
Should(Equal(ErrMetricNotFound))
})
})

Expand Down

0 comments on commit a2e3ae1

Please sign in to comment.