From be7527a070559015243e21fd293f29a7ea33539f Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Tue, 21 Apr 2026 12:33:39 -0700 Subject: [PATCH] fix: multiple passwords not rendered correctly --- Chart.yaml | 2 +- templates/secrets.yaml | 2 +- test/test.sh | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index 9e024b4..6a7d977 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 name: pgdog -version: v0.53 +version: v0.54 appVersion: "0.1.37" diff --git a/templates/secrets.yaml b/templates/secrets.yaml index fa33671..28c96c0 100644 --- a/templates/secrets.yaml +++ b/templates/secrets.yaml @@ -4,7 +4,7 @@ name = {{ .name | quote }} database = {{ .database | quote }} {{- if .passwords }} -passwords = {{ .passwords | toToml }} +passwords = [{{ range $i, $p := .passwords }}{{ if $i }}, {{ end }}{{ $p | quote }}{{ end }}] {{- else if .password }} password = {{ .password | quote }} {{- end }} diff --git a/test/test.sh b/test/test.sh index 8eb5a49..5b7b938 100755 --- a/test/test.sh +++ b/test/test.sh @@ -14,5 +14,28 @@ for values_file in "$TEST_DIR"/values-*.yaml; do helm template test-release "$CHART_DIR" -f "$values_file" | kubeconform -strict -ignore-missing-schemas -summary done +# Validate multiple passwords renders valid TOML +echo "" +echo "==> Validating multiple passwords TOML output..." +users_toml=$(helm template test-release "$CHART_DIR" -f "$TEST_DIR/values-multiple-passwords.yaml" \ + | yq -r 'select(.kind == "Secret" and .metadata.name == "test-release-pgdog") | .data["users.toml"]' \ + | base64 -d) + +if echo "$users_toml" | grep -q 'passwords = \["one", "two"\]'; then + echo " passwords array rendered correctly" +else + echo " FAIL: passwords array not rendered correctly" + echo " Got: $users_toml" + exit 1 +fi + +if echo "$users_toml" | grep -q 'password = "single_password"'; then + echo " single password rendered correctly" +else + echo " FAIL: single password not rendered correctly" + echo " Got: $users_toml" + exit 1 +fi + echo "" echo "==> All tests passed!"