From 464215c72a34775a40169e81243ce667b23501c2 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 10 Mar 2026 05:34:37 +0000 Subject: [PATCH] fix(test): replace empty secrets key instead of appending duplicate 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 --- tests/k8s-deploy/run-deploy-test.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index fdc5a1db..c6836ee1 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -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)