fix(test): replace empty secrets key instead of appending duplicate
Some checks failed
Lint Checks / Run linter (pull_request) Successful in 3m19s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m57s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Failing after 6m32s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 7m31s
Webapp Test / Run webapp test suite (pull_request) Successful in 8m1s
Smoke Test / Run basic test suite (pull_request) Successful in 7m38s

deploy init already writes 'secrets: {}' into the spec file. The test
was appending a second secrets block via heredoc, which ruamel.yaml
rejects as a duplicate key. Use sed to replace the empty value instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Prathamesh Musale 2026-03-10 05:34:37 +00:00
parent 108f13a09b
commit 464215c72a

View File

@ -117,13 +117,11 @@ fi
# Add a config file to be picked up by the ConfigMap before starting.
echo "dbfc7a4d-44a7-416d-b5f3-29842cc47650" > $test_deployment_dir/configmaps/test-config/test_config
# Add secrets to the deployment spec (references a pre-existing k8s Secret by name)
# Add secrets to the deployment spec (references a pre-existing k8s Secret by name).
# deploy init already writes an empty 'secrets: {}' key, so we replace it
# rather than appending (ruamel.yaml rejects duplicate keys).
deployment_spec_file=${test_deployment_dir}/spec.yml
cat << EOF >> ${deployment_spec_file}
secrets:
test-secret:
- TEST_SECRET_KEY
EOF
sed -i 's/^secrets: {}$/secrets:\n test-secret:\n - TEST_SECRET_KEY/' ${deployment_spec_file}
# Get the deployment ID for kubectl queries
deployment_id=$(cat ${test_deployment_dir}/deployment.yml | cut -d ' ' -f 2)