Skip to content

Commit

Permalink
test: show operator logs on e2e test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
swiatekm committed Oct 20, 2023
1 parent 7526c78 commit 1fa2227
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Expand Down
1 change: 1 addition & 0 deletions tests/modified/operator/pod-with-cr/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Expand Down
1 change: 1 addition & 0 deletions tests/modified/operator/pod-with-cr/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/operator/daemonset-with-annotations/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/operator/deployment-with-annotations/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/operator/deployment-with-annotations/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/operator/pod-with-annotations/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/operator/pod-with-annotations/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Expand Down
1 change: 1 addition & 0 deletions tests/operator/pod-with-cr/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
Expand Down
1 change: 1 addition & 0 deletions tests/operator/pod-with-cr/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/operator/statefulset-with-annotations/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
1 change: 1 addition & 0 deletions tests/sidecar/pod-with-sidecar/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"

0 comments on commit 1fa2227

Please sign in to comment.