Skip to content

Commit

Permalink
fix(metrics-operator): fixed test
Browse files Browse the repository at this point in the history
Signed-off-by: realanna <anna.reale@dynatrace.com>
  • Loading branch information
RealAnna committed Sep 18, 2023
1 parent d02ff24 commit 5c6ca30
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 21 deletions.
1 change: 0 additions & 1 deletion metrics-operator/controllers/analysis/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ func TestAnalysisReconciler_ExistingAnalysisStatusIsFlushedWhenEvaluationFinishe
},
},
}
require.NotNil(t, analysis.Status.StoredValues)

mockFactory := func(ctx context.Context, analysisMoqParam *metricsapi.Analysis, obj []metricsapi.Objective, numWorkers int, c client.Client, log logr.Logger, namespace string) (context.Context, IAnalysisPool) {
mymock := fake.IAnalysisPoolMock{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: metrics.keptn.sh/v1alpha3
kind: Analysis
metadata:
name: analysis-sample
namespace: testy
spec:
analysisDefinition:
name: ed-my-proj-dev-svc1
status:
storedValues:
ready-testy:
objectiveReference:
name: ready
namespace: testy
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
apiVersion: v1
kind: Namespace
metadata:
name: testy
---
apiVersion: metrics.keptn.sh/v1alpha3
kind: AnalysisValueTemplate
metadata:
name: ready
namespace: $NAMESPACE
namespace: testy
spec:
provider:
name: my-mocked-provider
namespace: $NAMESPACE
namespace: testy
query: 'sum(kube_pod_container_status_ready{namespace="{{.ns}}"})'
---
apiVersion: metrics.keptn.sh/v1alpha3
kind: AnalysisDefinition
metadata:
name: ed-my-proj-dev-svc1
namespace: $NAMESPACE
namespace: testy
spec:
objectives:
- analysisValueTemplateRef:
name: ready
namespace: $NAMESPACE
namespace: testy
target:
failure:
lessThan:
Expand All @@ -36,7 +41,7 @@ apiVersion: metrics.keptn.sh/v1alpha3
kind: Analysis
metadata:
name: analysis-sample
namespace: $NAMESPACE
namespace: testy
spec:
timeframe:
from: 2023-09-14T07:33:19Z
Expand All @@ -45,7 +50,7 @@ spec:
"ns": "keptn-lifecycle-toolkit-system"
analysisDefinition:
name: ed-my-proj-dev-svc1
namespace: $NAMESPACE
namespace: testy
status:
storedValues:
my-provider-query-1:
Expand All @@ -59,7 +64,7 @@ apiVersion: metrics.keptn.sh/v1alpha3
kind: KeptnMetricsProvider
metadata:
name: my-mocked-provider
namespace: $NAMESPACE
namespace: testy
spec:
type: prometheus
targetServer: "http://mockserver.$NAMESPACE.svc.cluster.local:1080"
targetServer: "http://mockserver.testy.svc.cluster.local:1080"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: metrics.keptn.sh/v1alpha3
kind: Analysis
metadata:
name: analysis-sample
namespace: testy
spec:
analysisDefinition:
name: ed-my-proj-dev-svc1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: mockserver
namespace: $NAMESPACE
namespace: testy
spec:
ports:
- name: serviceport
Expand All @@ -20,7 +20,7 @@ metadata:
labels:
app: mockserver
name: mockserver
namespace: $NAMESPACE
namespace: testy
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -83,7 +83,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: mockserver-config
namespace: $NAMESPACE
namespace: testy
data:
initializerJson.json: |-
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: testy

0 comments on commit 5c6ca30

Please sign in to comment.