From 728cea8cc0f91404e1755a982750bf375d6391d8 Mon Sep 17 00:00:00 2001 From: Rizul Gupta <112455393+rizul2108@users.noreply.github.com> Date: Thu, 18 Jan 2024 12:23:25 +0530 Subject: [PATCH] test: improve metrics integration tests by adding kuttl log collectors (#2765) Signed-off-by: Rizul Gupta Signed-off-by: Rizul Gupta <112455393+rizul2108@users.noreply.github.com> Signed-off-by: odubajDT <93584209+odubajDT@users.noreply.github.com> Co-authored-by: odubajDT <93584209+odubajDT@users.noreply.github.com> --- test/testmetrics/metrics-hpa/01-assert.yaml | 26 ++++++++----------- test/testmetrics/metrics-hpa/deployment.yaml | 15 +++++++++++ .../metrics/02-teststep-assert.yaml | 8 ++++++ 3 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 test/testmetrics/metrics-hpa/deployment.yaml diff --git a/test/testmetrics/metrics-hpa/01-assert.yaml b/test/testmetrics/metrics-hpa/01-assert.yaml index c56170d909..d7695db62e 100644 --- a/test/testmetrics/metrics-hpa/01-assert.yaml +++ b/test/testmetrics/metrics-hpa/01-assert.yaml @@ -1,15 +1,11 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podtato-head-entry - labels: - app: podtato-head -spec: - selector: - matchLabels: - component: podtato-head-entry - replicas: 3 - template: - metadata: - labels: - component: podtato-head-entry +assert: deployment.yaml +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +collectors: + - type: pod + selector: app=podtato-head + - command: | + kubectl logs -l app=metrics-operator -n keptn-system + kubectl describe keptnmetric podtatometric -n $NAMESPACE + kubectl describe keptnmetricsprovider dynatrace -n $NAMESPACE + kubectl describe pods -l app=podtato-head -n $NAMESPACE diff --git a/test/testmetrics/metrics-hpa/deployment.yaml b/test/testmetrics/metrics-hpa/deployment.yaml new file mode 100644 index 0000000000..c56170d909 --- /dev/null +++ b/test/testmetrics/metrics-hpa/deployment.yaml @@ -0,0 +1,15 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-entry + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-entry + replicas: 3 + template: + metadata: + labels: + component: podtato-head-entry diff --git a/test/testmetrics/metrics/02-teststep-assert.yaml b/test/testmetrics/metrics/02-teststep-assert.yaml index e6f95ad931..a7b57ee878 100644 --- a/test/testmetrics/metrics/02-teststep-assert.yaml +++ b/test/testmetrics/metrics/02-teststep-assert.yaml @@ -10,3 +10,11 @@ assert: # this checks that kubectl get resource succeeds - goodmetric3.yaml - goodmetric4.yaml - goodmetric5.yaml +collectors: + - type: pod + selector: app=test + - command: | + kubectl logs -l app=metrics-operator -n keptn-system + kubectl describe keptnmetric podtatometric -n $NAMESPACE + kubectl describe keptnmetricsprovider dynatrace -n $NAMESPACE + kubectl describe pods -l app=podtato-head -n $NAMESPACE