From 1fa22273961848f95cb2a5c38de86bd8582faab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Fri, 20 Oct 2023 12:05:07 +0200 Subject: [PATCH] test: show operator logs on e2e test failure --- .../modified/operator/daemonset-with-annotations/00-assert.yaml | 1 + .../modified/operator/deployment-with-annotations/00-assert.yaml | 1 + .../modified/operator/deployment-with-annotations/01-assert.yaml | 1 + tests/modified/operator/pod-with-annotations/00-assert.yaml | 1 + tests/modified/operator/pod-with-annotations/01-assert.yaml | 1 + tests/modified/operator/pod-with-cr/00-assert.yaml | 1 + tests/modified/operator/pod-with-cr/01-assert.yaml | 1 + .../operator/statefulset-with-annotations/00-assert.yaml | 1 + tests/operator/daemonset-with-annotations/00-assert.yaml | 1 + tests/operator/deployment-with-annotations/00-assert.yaml | 1 + tests/operator/deployment-with-annotations/01-assert.yaml | 1 + tests/operator/pod-with-annotations/00-assert.yaml | 1 + tests/operator/pod-with-annotations/01-assert.yaml | 1 + tests/operator/pod-with-cr/00-assert.yaml | 1 + tests/operator/pod-with-cr/01-assert.yaml | 1 + tests/operator/statefulset-with-annotations/00-assert.yaml | 1 + tests/sidecar/pod-with-sidecar/00-assert.yaml | 1 + 17 files changed, 17 insertions(+) diff --git a/tests/modified/operator/daemonset-with-annotations/00-assert.yaml b/tests/modified/operator/daemonset-with-annotations/00-assert.yaml index 4a8baa77..e0014782 100644 --- a/tests/modified/operator/daemonset-with-annotations/00-assert.yaml +++ b/tests/modified/operator/daemonset-with-annotations/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=daemonset-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -l app=daemonset-with-annotations -c tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" - script: "[ $(kubectl logs -l app=daemonset-with-annotations -c tailing-sidecar-1 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/deployment-with-annotations/00-assert.yaml b/tests/modified/operator/deployment-with-annotations/00-assert.yaml index f9f072d7..3e104a7a 100644 --- a/tests/modified/operator/deployment-with-annotations/00-assert.yaml +++ b/tests/modified/operator/deployment-with-annotations/00-assert.yaml @@ -10,6 +10,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -l app=deployment-with-annotations -c tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" - script: "[ $(kubectl logs -l app=deployment-with-annotations -c tailing-sidecar-1 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/deployment-with-annotations/01-assert.yaml b/tests/modified/operator/deployment-with-annotations/01-assert.yaml index 6169af4f..a1f1b8d6 100644 --- a/tests/modified/operator/deployment-with-annotations/01-assert.yaml +++ b/tests/modified/operator/deployment-with-annotations/01-assert.yaml @@ -18,5 +18,6 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -l app=deployment-with-annotations -c tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/pod-with-annotations/00-assert.yaml b/tests/modified/operator/pod-with-annotations/00-assert.yaml index f3fdf96e..d70994b0 100644 --- a/tests/modified/operator/pod-with-annotations/00-assert.yaml +++ b/tests/modified/operator/pod-with-annotations/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-annotations tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" - script: "[ $(kubectl logs pod-with-annotations named-container -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/pod-with-annotations/01-assert.yaml b/tests/modified/operator/pod-with-annotations/01-assert.yaml index 93390119..e47bc46c 100644 --- a/tests/modified/operator/pod-with-annotations/01-assert.yaml +++ b/tests/modified/operator/pod-with-annotations/01-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations-updated +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-annotations-updated tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" - script: "[ $(kubectl logs pod-with-annotations-updated named-sidecar -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/pod-with-cr/00-assert.yaml b/tests/modified/operator/pod-with-cr/00-assert.yaml index 0dc0fe14..05add425 100644 --- a/tests/modified/operator/pod-with-cr/00-assert.yaml +++ b/tests/modified/operator/pod-with-cr/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-tailing-sidecar-config sidecar-0 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" - script: "[ $(kubectl logs pod-with-tailing-sidecar-config sidecar-1 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/pod-with-cr/01-assert.yaml b/tests/modified/operator/pod-with-cr/01-assert.yaml index 3e6970ec..38af125f 100644 --- a/tests/modified/operator/pod-with-cr/01-assert.yaml +++ b/tests/modified/operator/pod-with-cr/01-assert.yaml @@ -12,5 +12,6 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-tailing-sidecar-config sidecar-2 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/modified/operator/statefulset-with-annotations/00-assert.yaml b/tests/modified/operator/statefulset-with-annotations/00-assert.yaml index 5478a408..5f27e647 100644 --- a/tests/modified/operator/statefulset-with-annotations/00-assert.yaml +++ b/tests/modified/operator/statefulset-with-annotations/00-assert.yaml @@ -10,6 +10,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: statefulset-with-annotations-0 +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs statefulset-with-annotations-0 my-named-sidecar -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" - script: "[ $(kubectl logs statefulset-with-annotations-0 tailing-sidecar-1 -n ${NAMESPACE} --tail 5 | grep modified | wc -l) -eq 5 ]" diff --git a/tests/operator/daemonset-with-annotations/00-assert.yaml b/tests/operator/daemonset-with-annotations/00-assert.yaml index 3758548d..2e7b8c9c 100644 --- a/tests/operator/daemonset-with-annotations/00-assert.yaml +++ b/tests/operator/daemonset-with-annotations/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=daemonset-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -l app=daemonset-with-annotations -c tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" - script: "[ $(kubectl logs -l app=daemonset-with-annotations -c tailing-sidecar-1 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/deployment-with-annotations/00-assert.yaml b/tests/operator/deployment-with-annotations/00-assert.yaml index b333e566..1fe24242 100644 --- a/tests/operator/deployment-with-annotations/00-assert.yaml +++ b/tests/operator/deployment-with-annotations/00-assert.yaml @@ -10,6 +10,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -l app=deployment-with-annotations -c tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" - script: "[ $(kubectl logs -l app=deployment-with-annotations -c tailing-sidecar-1 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/deployment-with-annotations/01-assert.yaml b/tests/operator/deployment-with-annotations/01-assert.yaml index 6ededf9b..a7d4d985 100644 --- a/tests/operator/deployment-with-annotations/01-assert.yaml +++ b/tests/operator/deployment-with-annotations/01-assert.yaml @@ -18,5 +18,6 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -l app=deployment-with-annotations -c tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/pod-with-annotations/00-assert.yaml b/tests/operator/pod-with-annotations/00-assert.yaml index 27a7fb43..5e78e9fe 100644 --- a/tests/operator/pod-with-annotations/00-assert.yaml +++ b/tests/operator/pod-with-annotations/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-annotations tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" - script: "[ $(kubectl logs pod-with-annotations named-container -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/pod-with-annotations/01-assert.yaml b/tests/operator/pod-with-annotations/01-assert.yaml index 97edee12..e6e2f9b3 100644 --- a/tests/operator/pod-with-annotations/01-assert.yaml +++ b/tests/operator/pod-with-annotations/01-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations-updated +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-annotations-updated tailing-sidecar-0 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" - script: "[ $(kubectl logs pod-with-annotations-updated named-sidecar -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/pod-with-cr/00-assert.yaml b/tests/operator/pod-with-cr/00-assert.yaml index a717d3e7..0bf6b622 100644 --- a/tests/operator/pod-with-cr/00-assert.yaml +++ b/tests/operator/pod-with-cr/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-tailing-sidecar-config sidecar-0 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" - script: "[ $(kubectl logs pod-with-tailing-sidecar-config sidecar-1 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/pod-with-cr/01-assert.yaml b/tests/operator/pod-with-cr/01-assert.yaml index eb71ec74..3caedcb2 100644 --- a/tests/operator/pod-with-cr/01-assert.yaml +++ b/tests/operator/pod-with-cr/01-assert.yaml @@ -12,5 +12,6 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs pod-with-tailing-sidecar-config sidecar-2 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/operator/statefulset-with-annotations/00-assert.yaml b/tests/operator/statefulset-with-annotations/00-assert.yaml index c3d7ae0f..c5afb5b0 100644 --- a/tests/operator/statefulset-with-annotations/00-assert.yaml +++ b/tests/operator/statefulset-with-annotations/00-assert.yaml @@ -10,6 +10,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: statefulset-with-annotations-0 +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs statefulset-with-annotations-0 my-named-sidecar -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" - script: "[ $(kubectl logs statefulset-with-annotations-0 tailing-sidecar-1 -n ${NAMESPACE} --tail 5 | grep example | wc -l) -eq 5 ]" diff --git a/tests/sidecar/pod-with-sidecar/00-assert.yaml b/tests/sidecar/pod-with-sidecar/00-assert.yaml index 81283a5a..64f996a9 100644 --- a/tests/sidecar/pod-with-sidecar/00-assert.yaml +++ b/tests/sidecar/pod-with-sidecar/00-assert.yaml @@ -9,6 +9,7 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: example-with-tailling-sidecars +- selector: app.kubernetes.io/name=tailing-sidecar-operator commands: - script: "[ $(kubectl logs -n $NAMESPACE --tail 5 example-with-tailling-sidecars sidecar1 | grep example1 | wc -l) -eq 5 ]" - script: "[ $(kubectl logs -n $NAMESPACE --tail 5 example-with-tailling-sidecars sidecar2 | grep example2 | wc -l) -eq 5 ]"