Skip to content

Commit

Permalink
fix(metrics-operator): flaky test in SLI converter (#1954)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
  • Loading branch information
odubajDT committed Aug 25, 2023
1 parent a8d6902 commit cadb170
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions metrics-operator/converter/sli_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ indicators:
throughput: "builtin:service.requestCount.total:merge(0):count?scope=tag(keptn_project:$PROJECT),tag(keptn_stage:$STAGE),tag(keptn_service:$SERVICE),tag(keptn_deployment:$DEPLOYMENT)"
response_time_p95: "builtin:service.response.time:merge(0):percentile(95)?scope=tag(keptn_project:$PROJECT),tag(keptn_stage:$STAGE),tag(keptn_service:$SERVICE),tag(keptn_deployment:$DEPLOYMENT)"`

const expectedOutput = `---
const expectedOutput1 = `---
apiVersion: metrics.keptn.sh/v1alpha3
kind: AnalysisValueTemplate
metadata:
Expand All @@ -25,7 +25,9 @@ spec:
name: dynatrace
namespace: keptn
query: builtin:service.response.time:merge(0):percentile(95)?scope=tag(keptn_project:{{.project}}),tag(keptn_stage:{{.stage}}),tag(keptn_service:{{.service}}),tag(keptn_deployment:{{.deployment}})
---
`

const expectedOutput2 = `---
apiVersion: metrics.keptn.sh/v1alpha3
kind: AnalysisValueTemplate
metadata:
Expand Down Expand Up @@ -108,7 +110,10 @@ func TestConvertSLI(t *testing.T) {
// happy path
res, err = c.Convert([]byte(sliContent), "dynatrace", "keptn")
require.Nil(t, err)
require.Equal(t, expectedOutput, res)
// need to check the result with contains, as there is no guarantee
// of order of the AnalysisValueTemplates in resulting manifest
require.Contains(t, res, expectedOutput1)
require.Contains(t, res, expectedOutput2)
}

func TestConvertQuary(t *testing.T) {
Expand Down

0 comments on commit cadb170

Please sign in to comment.