test(ci): cover Helm Recreate strategy rendering (#2752)

This commit is contained in:
安正超
2026-04-30 20:14:38 +08:00
committed by GitHub
parent ef5ccc232a
commit 0d7e0a814f
2 changed files with 32 additions and 0 deletions

View File

@@ -80,6 +80,9 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v4.3.0
- name: Test Helm Chart Templates
run: ./scripts/test_helm_templates.sh
- name: Package Helm Chart
run: |
set -eux

29
scripts/test_helm_templates.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
CHART_DIR="$ROOT_DIR/helm/rustfs"
render_standalone_deployment() {
helm template rustfs "$CHART_DIR" \
--namespace rustfs \
--set mode.distributed.enabled=false \
--set mode.standalone.enabled=true \
"$@" |
awk '
/^# Source: rustfs\/templates\/deployment.yaml$/ { in_deployment = 1 }
in_deployment && /^---$/ { exit }
in_deployment { print }
'
}
recreate_output=$(render_standalone_deployment --set mode.standalone.strategy.type=Recreate)
grep -q "type: Recreate" <<<"$recreate_output"
if grep -q "rollingUpdate:" <<<"$recreate_output"; then
echo "Recreate strategy must not render rollingUpdate fields" >&2
exit 1
fi
rolling_output=$(render_standalone_deployment)
grep -q "type: RollingUpdate" <<<"$rolling_output"
grep -q "rollingUpdate:" <<<"$rolling_output"