From 310c239bd1a1047360d1390141a61022aa6d14d4 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 --- .../operator/daemonset-with-annotations/00-assert.yaml | 5 +++++ .../operator/deployment-with-annotations/00-assert.yaml | 3 +++ .../operator/deployment-with-annotations/01-assert.yaml | 3 +++ tests/modified/operator/pod-with-annotations/00-assert.yaml | 3 +++ tests/modified/operator/pod-with-annotations/01-assert.yaml | 3 +++ tests/modified/operator/pod-with-cr/00-assert.yaml | 3 +++ tests/modified/operator/pod-with-cr/01-assert.yaml | 3 +++ .../operator/statefulset-with-annotations/00-assert.yaml | 3 +++ tests/operator/daemonset-with-annotations/00-assert.yaml | 3 +++ tests/operator/deployment-with-annotations/00-assert.yaml | 3 +++ tests/operator/deployment-with-annotations/01-assert.yaml | 3 +++ tests/operator/pod-with-annotations/00-assert.yaml | 3 +++ tests/operator/pod-with-annotations/01-assert.yaml | 3 +++ tests/operator/pod-with-cr/00-assert.yaml | 3 +++ tests/operator/pod-with-cr/01-assert.yaml | 3 +++ tests/operator/statefulset-with-annotations/00-assert.yaml | 3 +++ tests/sidecar/pod-with-sidecar/00-assert.yaml | 3 +++ 17 files changed, 53 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..36349e41 100644 --- a/tests/modified/operator/daemonset-with-annotations/00-assert.yaml +++ b/tests/modified/operator/daemonset-with-annotations/00-assert.yaml @@ -9,6 +9,11 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=daemonset-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all + tail: all + tail: all 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..1416d5cc 100644 --- a/tests/modified/operator/deployment-with-annotations/00-assert.yaml +++ b/tests/modified/operator/deployment-with-annotations/00-assert.yaml @@ -10,6 +10,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..e4749656 100644 --- a/tests/modified/operator/deployment-with-annotations/01-assert.yaml +++ b/tests/modified/operator/deployment-with-annotations/01-assert.yaml @@ -18,5 +18,8 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..0e1864a5 100644 --- a/tests/modified/operator/pod-with-annotations/00-assert.yaml +++ b/tests/modified/operator/pod-with-annotations/00-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..c102b0c2 100644 --- a/tests/modified/operator/pod-with-annotations/01-assert.yaml +++ b/tests/modified/operator/pod-with-annotations/01-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations-updated +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..25975ce7 100644 --- a/tests/modified/operator/pod-with-cr/00-assert.yaml +++ b/tests/modified/operator/pod-with-cr/00-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..e0dbe04c 100644 --- a/tests/modified/operator/pod-with-cr/01-assert.yaml +++ b/tests/modified/operator/pod-with-cr/01-assert.yaml @@ -12,5 +12,8 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..369b279d 100644 --- a/tests/modified/operator/statefulset-with-annotations/00-assert.yaml +++ b/tests/modified/operator/statefulset-with-annotations/00-assert.yaml @@ -10,6 +10,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: statefulset-with-annotations-0 +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..c8004b80 100644 --- a/tests/operator/daemonset-with-annotations/00-assert.yaml +++ b/tests/operator/daemonset-with-annotations/00-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=daemonset-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..43f7b580 100644 --- a/tests/operator/deployment-with-annotations/00-assert.yaml +++ b/tests/operator/deployment-with-annotations/00-assert.yaml @@ -10,6 +10,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..080b3851 100644 --- a/tests/operator/deployment-with-annotations/01-assert.yaml +++ b/tests/operator/deployment-with-annotations/01-assert.yaml @@ -18,5 +18,8 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - selector: app=deployment-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..68e703a6 100644 --- a/tests/operator/pod-with-annotations/00-assert.yaml +++ b/tests/operator/pod-with-annotations/00-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..b7753e1f 100644 --- a/tests/operator/pod-with-annotations/01-assert.yaml +++ b/tests/operator/pod-with-annotations/01-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-annotations-updated +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..a3e4fc30 100644 --- a/tests/operator/pod-with-cr/00-assert.yaml +++ b/tests/operator/pod-with-cr/00-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..847825a1 100644 --- a/tests/operator/pod-with-cr/01-assert.yaml +++ b/tests/operator/pod-with-cr/01-assert.yaml @@ -12,5 +12,8 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: pod-with-tailing-sidecar-config +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..ca4fb3f8 100644 --- a/tests/operator/statefulset-with-annotations/00-assert.yaml +++ b/tests/operator/statefulset-with-annotations/00-assert.yaml @@ -10,6 +10,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: statefulset-with-annotations-0 +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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..0add9ba6 100644 --- a/tests/sidecar/pod-with-sidecar/00-assert.yaml +++ b/tests/sidecar/pod-with-sidecar/00-assert.yaml @@ -9,6 +9,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert collectors: - pod: example-with-tailling-sidecars +- selector: app.kubernetes.io/name=tailing-sidecar-operator + namespace: tailing-sidecar-system + tail: all 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 ]"