Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions tests/templates/kuttl/restarter/10-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test
status:
readyReplicas: 1
replicas: 1
commands:
- script: |
# N.B. due to breaking change https://github.com/kudobuilder/kuttl/pull/519
# version >=0.17 of Kuttl is required for paths to be resolved consistently.
# For local testing, either use nix-shell before running the test script
# or upgrade kuttl as needed (with e.g. kubectl krew upgrade kuttl)
. ./test-script.sh
Comment thread
siegfriedweber marked this conversation as resolved.

# Wait for the StatefulSet to be deployed
kubectl rollout status statefulset/test --namespace "$NAMESPACE"

# Check the initial status to detect some typos in the test setup

assert_revision 1 configmap-not-ignored-subpath
assert_revision 1 secret-not-ignored-subpath
assert_revision 1 configmap-self-ignored-subpath
assert_revision 1 secret-self-ignored-subpath
assert_revision 1 configmap-self-ignored
assert_revision 1 secret-self-ignored
assert_revision 1 configmap-ignored-in-statefulset-subpath
assert_revision 1 secret-ignored-in-statefulset-subpath
assert_revision 1 configmap-ignored-in-statefulset
assert_revision 1 secret-ignored-in-statefulset
5 changes: 3 additions & 2 deletions tests/templates/kuttl/restarter/10-create-test-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: configmap-self-ignored
annotations:
labels:
restarter.stackable.tech/ignore: "true"
data:
revision: "1"
Expand All @@ -26,7 +26,7 @@ apiVersion: v1
kind: Secret
metadata:
name: secret-self-ignored
annotations:
labels:
restarter.stackable.tech/ignore: "true"
stringData:
revision: "1"
Expand All @@ -51,6 +51,7 @@ metadata:
name: test
labels:
restarter.stackable.tech/enabled: "true"
annotations:
restarter.stackable.tech/ignore-configmap.0: configmap-ignored-in-statefulset
restarter.stackable.tech/ignore-secret.0: secret-ignored-in-statefulset
spec:
Expand Down
9 changes: 8 additions & 1 deletion tests/templates/kuttl/restarter/20-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ kind: TestAssert
timeout: 180
commands:
- script: |
. ../../../../templates/kuttl/restarter/test-script.sh
. ./test-script.sh

# Wait for a possible restart of the test pod.
# The restarter controller is expected to ignore the changes in this step, so no restart
# should occur. However, if a restart does happen (due to a controller bug or test issue),
# wait here so we can verify assertions after the restart and ensure this test step fails
# reliably.
sleep 10

# Resources mounted via subPath are not hot-reloaded by Kubernetes.
# It is expected, that the restart controller ignored the annotated resources and that only
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/restarter/21-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: TestAssert
timeout: 180
commands:
- script: |
. ../../../../templates/kuttl/restarter/test-script.sh
. ./test-script.sh

# After a restart, all resources should have been updated.

Expand Down
Loading