From 506502d873df4b78aed664dcd07db4a9d00a22cd Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Wed, 22 Apr 2026 13:15:15 +0200 Subject: [PATCH 1/5] test: Fix the restarter test --- .../templates/kuttl/restarter/10-assert.yaml | 27 +++++++++++++------ .../restarter/10-create-test-resources.yaml | 5 ++-- .../templates/kuttl/restarter/20-assert.yaml | 9 ++++++- .../templates/kuttl/restarter/21-assert.yaml | 2 +- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/tests/templates/kuttl/restarter/10-assert.yaml b/tests/templates/kuttl/restarter/10-assert.yaml index dbf238f..daa3039 100644 --- a/tests/templates/kuttl/restarter/10-assert.yaml +++ b/tests/templates/kuttl/restarter/10-assert.yaml @@ -2,11 +2,22 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert timeout: 120 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: test -status: - readyReplicas: 1 - replicas: 1 +commands: + - script: | + . test-script.sh + + # 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 diff --git a/tests/templates/kuttl/restarter/10-create-test-resources.yaml b/tests/templates/kuttl/restarter/10-create-test-resources.yaml index 0bc86fc..ba24fa7 100644 --- a/tests/templates/kuttl/restarter/10-create-test-resources.yaml +++ b/tests/templates/kuttl/restarter/10-create-test-resources.yaml @@ -17,7 +17,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: configmap-self-ignored - annotations: + labels: restarter.stackable.tech/ignore: "true" data: revision: "1" @@ -26,7 +26,7 @@ apiVersion: v1 kind: Secret metadata: name: secret-self-ignored - annotations: + labels: restarter.stackable.tech/ignore: "true" stringData: revision: "1" @@ -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: diff --git a/tests/templates/kuttl/restarter/20-assert.yaml b/tests/templates/kuttl/restarter/20-assert.yaml index 42f197f..ead9422 100644 --- a/tests/templates/kuttl/restarter/20-assert.yaml +++ b/tests/templates/kuttl/restarter/20-assert.yaml @@ -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 diff --git a/tests/templates/kuttl/restarter/21-assert.yaml b/tests/templates/kuttl/restarter/21-assert.yaml index 974de6f..ffbb492 100644 --- a/tests/templates/kuttl/restarter/21-assert.yaml +++ b/tests/templates/kuttl/restarter/21-assert.yaml @@ -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. From 3ef54c70642f7decc2122bdd6d26c6e8027918ef Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Wed, 22 Apr 2026 13:46:53 +0200 Subject: [PATCH 2/5] test: Adapt the scripts to be compatible with dash --- tests/templates/kuttl/restarter/10-assert.yaml | 2 +- tests/templates/kuttl/restarter/20-assert.yaml | 2 +- tests/templates/kuttl/restarter/21-assert.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/templates/kuttl/restarter/10-assert.yaml b/tests/templates/kuttl/restarter/10-assert.yaml index daa3039..95e0aac 100644 --- a/tests/templates/kuttl/restarter/10-assert.yaml +++ b/tests/templates/kuttl/restarter/10-assert.yaml @@ -4,7 +4,7 @@ kind: TestAssert timeout: 120 commands: - script: | - . test-script.sh + . ./test-script.sh # Wait for the StatefulSet to be deployed kubectl rollout status statefulset/test --namespace "$NAMESPACE" diff --git a/tests/templates/kuttl/restarter/20-assert.yaml b/tests/templates/kuttl/restarter/20-assert.yaml index ead9422..6ae76e5 100644 --- a/tests/templates/kuttl/restarter/20-assert.yaml +++ b/tests/templates/kuttl/restarter/20-assert.yaml @@ -4,7 +4,7 @@ kind: TestAssert timeout: 180 commands: - script: | - . 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 diff --git a/tests/templates/kuttl/restarter/21-assert.yaml b/tests/templates/kuttl/restarter/21-assert.yaml index ffbb492..dc66b6a 100644 --- a/tests/templates/kuttl/restarter/21-assert.yaml +++ b/tests/templates/kuttl/restarter/21-assert.yaml @@ -4,7 +4,7 @@ kind: TestAssert timeout: 180 commands: - script: | - . test-script.sh + . ./test-script.sh # After a restart, all resources should have been updated. From 89beee2a10fd59b0eb77ff8abc56c61a21f2ffea Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Wed, 22 Apr 2026 14:04:46 +0200 Subject: [PATCH 3/5] test: Add diagnostic output --- tests/templates/kuttl/restarter/10-assert.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/templates/kuttl/restarter/10-assert.yaml b/tests/templates/kuttl/restarter/10-assert.yaml index 95e0aac..59150da 100644 --- a/tests/templates/kuttl/restarter/10-assert.yaml +++ b/tests/templates/kuttl/restarter/10-assert.yaml @@ -4,6 +4,12 @@ kind: TestAssert timeout: 120 commands: - script: | + pwd + + ls -al + + tree + . ./test-script.sh # Wait for the StatefulSet to be deployed From dacccb020acbec0d78bb12ac7b6711300cec9129 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Wed, 22 Apr 2026 15:04:12 +0200 Subject: [PATCH 4/5] Revert "test: Add diagnostic output" This reverts commit 89beee2a10fd59b0eb77ff8abc56c61a21f2ffea. --- tests/templates/kuttl/restarter/10-assert.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/templates/kuttl/restarter/10-assert.yaml b/tests/templates/kuttl/restarter/10-assert.yaml index 59150da..95e0aac 100644 --- a/tests/templates/kuttl/restarter/10-assert.yaml +++ b/tests/templates/kuttl/restarter/10-assert.yaml @@ -4,12 +4,6 @@ kind: TestAssert timeout: 120 commands: - script: | - pwd - - ls -al - - tree - . ./test-script.sh # Wait for the StatefulSet to be deployed From 3178faaf7de34ef90e3224be313c390144205adc Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Wed, 22 Apr 2026 16:30:12 +0200 Subject: [PATCH 5/5] Update tests/templates/kuttl/restarter/10-assert.yaml Co-authored-by: Andrew Kenworthy <1712947+adwk67@users.noreply.github.com> --- tests/templates/kuttl/restarter/10-assert.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/templates/kuttl/restarter/10-assert.yaml b/tests/templates/kuttl/restarter/10-assert.yaml index 95e0aac..038fa75 100644 --- a/tests/templates/kuttl/restarter/10-assert.yaml +++ b/tests/templates/kuttl/restarter/10-assert.yaml @@ -4,6 +4,10 @@ kind: TestAssert timeout: 120 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 # Wait for the StatefulSet to be deployed