From b44aaf90f7c0cf0b20af0fe1099515b6faab159e Mon Sep 17 00:00:00 2001 From: yxxhero <11087727+yxxhero@users.noreply.github.com> Date: Tue, 24 Jan 2023 06:02:57 +0800 Subject: [PATCH] remove helm v2 code in tests (#648) Signed-off-by: yxxhero Signed-off-by: yxxhero --- test/integration/run.sh | 9 -- test/integration/test-cases/chart-needs.sh | 118 +++++++++--------- test/integration/test-cases/happypath.sh | 2 +- .../integration/test-cases/postrender-diff.sh | 50 ++++---- test/integration/test-cases/regression.sh | 64 +++++----- test/integration/test-cases/secretssops.sh | 104 ++++++++------- test/integration/test-cases/yaml-overwrite.sh | 36 +++--- 7 files changed, 181 insertions(+), 202 deletions(-) diff --git a/test/integration/run.sh b/test/integration/run.sh index f2f54cc4..45fc9df4 100755 --- a/test/integration/run.sh +++ b/test/integration/run.sh @@ -68,15 +68,6 @@ function cleanup() { set -e trap cleanup EXIT info "Using namespace: ${test_ns}" -# helm v2 -if helm version --client 2>/dev/null | grep '"v2\.'; then - helm_major_version=2 - info "Using Helm version: $(helm version --short --client | grep -o v.*$)" - ${helm} init --stable-repo-url https://charts.helm.sh/stable --wait --override spec.template.spec.automountServiceAccountToken=true -else # helm v3 - helm_major_version=3 - info "Using Helm version: $(helm version --short | grep -o v.*$)" -fi ${helm} plugin ls | grep diff || ${helm} plugin install https://github.com/databus23/helm-diff --version v${HELM_DIFF_VERSION} info "Using Kustomize version: $(kustomize version --short | grep -o 'v[0-9.]\+')" ${kubectl} get namespace ${test_ns} &> /dev/null && warn "Namespace ${test_ns} exists, from a previous test run?" diff --git a/test/integration/test-cases/chart-needs.sh b/test/integration/test-cases/chart-needs.sh index 9cc3cd8d..76cc3814 100644 --- a/test/integration/test-cases/chart-needs.sh +++ b/test/integration/test-cases/chart-needs.sh @@ -1,75 +1,73 @@ -if [[ helm_major_version -eq 3 ]]; then - chart_need_case_input_dir="${cases_dir}/chart-needs/input" - chart_need_case_output_dir="${cases_dir}/chart-needs/output" +chart_need_case_input_dir="${cases_dir}/chart-needs/input" +chart_need_case_output_dir="${cases_dir}/chart-needs/output" - config_file="helmfile.yaml" - if [[ ${HELMFILE_V1MODE} = true ]]; then - pushd "${chart_need_case_input_dir}" - mv "${config_file}" "${config_file}.gotmpl" - config_file="${config_file}.gotmpl" - popd - fi +config_file="helmfile.yaml" +if [[ ${HELMFILE_V1MODE} = true ]]; then + pushd "${chart_need_case_input_dir}" + mv "${config_file}" "${config_file}.gotmpl" + config_file="${config_file}.gotmpl" + popd +fi - chart_needs_tmp=$(mktemp -d) - chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log - chart_needs_lint_reverse=${chart_needs_tmp}/chart.needs.lint.log - chart_needs_diff_reverse=${chart_needs_tmp}/chart.needs.diff.log +chart_needs_tmp=$(mktemp -d) +chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log +chart_needs_lint_reverse=${chart_needs_tmp}/chart.needs.lint.log +chart_needs_diff_reverse=${chart_needs_tmp}/chart.needs.diff.log - lint_out_file=${chart_need_case_output_dir}/lint - diff_out_file=${chart_need_case_output_dir}/diff - if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then - lint_out_file=${chart_need_case_output_dir}/lint-live - diff_out_file=${chart_need_case_output_dir}/diff-live - fi +lint_out_file=${chart_need_case_output_dir}/lint +diff_out_file=${chart_need_case_output_dir}/diff +if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then + lint_out_file=${chart_need_case_output_dir}/lint-live + diff_out_file=${chart_need_case_output_dir}/diff-live +fi - test_start "chart prepare when helmfile template with needs" +test_start "chart prepare when helmfile template with needs" - info "https://github.com/helmfile/helmfile/issues/455" +info "https://github.com/helmfile/helmfile/issues/455" - for i in $(seq 10); do - info "Comparing template/chart-needs #$i" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} template --include-needs > ${chart_needs_template_reverse} || fail "\"helmfile template\" shouldn't fail" - ./dyff between -bs ${chart_need_case_output_dir}/template ${chart_needs_template_reverse} || fail "\"helmfile template\" should be consistent" - echo code=$? - done +for i in $(seq 10); do + info "Comparing template/chart-needs #$i" + ${helmfile} -f ${chart_need_case_input_dir}/${config_file} template --include-needs > ${chart_needs_template_reverse} || fail "\"helmfile template\" shouldn't fail" + ./dyff between -bs ${chart_need_case_output_dir}/template ${chart_needs_template_reverse} || fail "\"helmfile template\" should be consistent" + echo code=$? +done - for i in $(seq 10); do - info "Comparing lint/chart-needs #$i" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} lint --include-needs | grep -v Linting > ${chart_needs_lint_reverse} || fail "\"helmfile lint\" shouldn't fail" - diff -u ${lint_out_file} ${chart_needs_lint_reverse} || fail "\"helmfile lint\" should be consistent" - echo code=$? - done +for i in $(seq 10); do + info "Comparing lint/chart-needs #$i" + ${helmfile} -f ${chart_need_case_input_dir}/${config_file} lint --include-needs | grep -v Linting > ${chart_needs_lint_reverse} || fail "\"helmfile lint\" shouldn't fail" + diff -u ${lint_out_file} ${chart_needs_lint_reverse} || fail "\"helmfile lint\" should be consistent" + echo code=$? +done - for i in $(seq 10); do - info "Comparing diff/chart-needs #$i" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} diff --include-needs | grep -Ev "Comparing release=azuredisk-csi-storageclass, chart=/tmp/.*/azuredisk-csi-storageclass" > ${chart_needs_diff_reverse} || fail "\"helmfile diff\" shouldn't fail" - diff -u ${diff_out_file} ${chart_needs_diff_reverse} || fail "\"helmfile diff\" should be consistent" - echo code=$? - done +for i in $(seq 10); do + info "Comparing diff/chart-needs #$i" + ${helmfile} -f ${chart_need_case_input_dir}/${config_file} diff --include-needs | grep -Ev "Comparing release=azuredisk-csi-storageclass, chart=/tmp/.*/azuredisk-csi-storageclass" > ${chart_needs_diff_reverse} || fail "\"helmfile diff\" shouldn't fail" + diff -u ${diff_out_file} ${chart_needs_diff_reverse} || fail "\"helmfile diff\" should be consistent" + echo code=$? +done - info "Applying ${chart_need_case_input_dir}/${config_file}" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} apply --include-needs - code=$? - [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}" +info "Applying ${chart_need_case_input_dir}/${config_file}" +${helmfile} -f ${chart_need_case_input_dir}/${config_file} apply --include-needs +code=$? +[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}" - ${kubectl} get storageclass managed-csi -o yaml | grep -q "provisioner: disk.csi.azure.com" || fail "storageclass managed-csi should be created when applying helmfile.yaml" +${kubectl} get storageclass managed-csi -o yaml | grep -q "provisioner: disk.csi.azure.com" || fail "storageclass managed-csi should be created when applying helmfile.yaml" - info "Destroying ${chart_need_case_input_dir}/${config_file}" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy - code=$? - [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: want 0, got ${code}" +info "Destroying ${chart_need_case_input_dir}/${config_file}" +${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy +code=$? +[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: want 0, got ${code}" - info "Syncing ${chart_need_case_input_dir}/${config_file}" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} sync --include-needs - code=$? - [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}" +info "Syncing ${chart_need_case_input_dir}/${config_file}" +${helmfile} -f ${chart_need_case_input_dir}/${config_file} sync --include-needs +code=$? +[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}" - ${kubectl} get storageclass managed-csi -o yaml | grep -q "provisioner: disk.csi.azure.com" || fail "storageclass managed-csi should be created when syncing helmfile.yaml" +${kubectl} get storageclass managed-csi -o yaml | grep -q "provisioner: disk.csi.azure.com" || fail "storageclass managed-csi should be created when syncing helmfile.yaml" - info "Destroying ${chart_need_case_input_dir}/${config_file}" - ${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy - code=$? - [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: want 0, got ${code}" +info "Destroying ${chart_need_case_input_dir}/${config_file}" +${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy +code=$? +[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: want 0, got ${code}" - test_pass "chart prepare when helmfile template with needs" -fi \ No newline at end of file +test_pass "chart prepare when helmfile template with needs" \ No newline at end of file diff --git a/test/integration/test-cases/happypath.sh b/test/integration/test-cases/happypath.sh index 1af9f876..a9778a1d 100644 --- a/test/integration/test-cases/happypath.sh +++ b/test/integration/test-cases/happypath.sh @@ -32,7 +32,7 @@ for output in $(ls -d ${dir}/tmp/*); do # e.g. test/integration/tmp/happypath-877c0dd4-helmx/helmx for release_dir in $(ls -d ${output}/*); do release_name=$(basename ${release_dir}) - golden_dir=${happypath_case_output_dir}/v${helm_major_version}/${release_name} + golden_dir=${happypath_case_output_dir}/v3/${release_name} info "Comparing template output ${release_dir}/templates with ${golden_dir}" ./diff-yamls ${golden_dir} ${release_dir}/templates || fail "unexpected diff in template result for ${release_name}" done diff --git a/test/integration/test-cases/postrender-diff.sh b/test/integration/test-cases/postrender-diff.sh index d1fb8a0b..74b33bc4 100644 --- a/test/integration/test-cases/postrender-diff.sh +++ b/test/integration/test-cases/postrender-diff.sh @@ -1,30 +1,28 @@ -if [[ helm_major_version -eq 3 ]]; then - postrender_diff_case_input_dir="${cases_dir}/postrender-diff/input" - postrender_diff_case_output_dir="${cases_dir}/postrender-diff/output" +postrender_diff_case_input_dir="${cases_dir}/postrender-diff/input" +postrender_diff_case_output_dir="${cases_dir}/postrender-diff/output" - config_file="helmfile.yaml" - if [[ ${HELMFILE_V1MODE} = true ]]; then - pushd "${postrender_diff_case_input_dir}" - mv "${config_file}" "${config_file}.gotmpl" - config_file="${config_file}.gotmpl" - popd - fi +config_file="helmfile.yaml" +if [[ ${HELMFILE_V1MODE} = true ]]; then + pushd "${postrender_diff_case_input_dir}" + mv "${config_file}" "${config_file}.gotmpl" + config_file="${config_file}.gotmpl" + popd +fi - postrender_diff_out_file=${postrender_diff_case_output_dir}/result - if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then - postrender_diff_out_file=${postrender_diff_case_output_dir}/result-live - fi +postrender_diff_out_file=${postrender_diff_case_output_dir}/result +if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then + postrender_diff_out_file=${postrender_diff_case_output_dir}/result-live +fi - postrender_diff_tmp=$(mktemp -d) - postrender_diff_reverse=${postrender_diff_tmp}/postrender.diff.build.yaml +postrender_diff_tmp=$(mktemp -d) +postrender_diff_reverse=${postrender_diff_tmp}/postrender.diff.build.yaml - test_start "postrender diff" - info "Comparing postrender diff output ${postrender_diff_reverse} with ${postrender_diff_case_output_dir}/result.yaml" - for i in $(seq 10); do - info "Comparing build/postrender-diff #$i" - ${helmfile} -f ${postrender_diff_case_input_dir}/${config_file} diff --concurrency 1 &> ${postrender_diff_reverse} || fail "\"helmfile diff\" shouldn't fail" - diff -u ${postrender_diff_out_file} ${postrender_diff_reverse} || fail "\"helmfile diff\" should be consistent" - echo code=$? - done - test_pass "postrender diff" -fi \ No newline at end of file +test_start "postrender diff" +info "Comparing postrender diff output ${postrender_diff_reverse} with ${postrender_diff_case_output_dir}/result.yaml" +for i in $(seq 10); do + info "Comparing build/postrender-diff #$i" + ${helmfile} -f ${postrender_diff_case_input_dir}/${config_file} diff --concurrency 1 &> ${postrender_diff_reverse} || fail "\"helmfile diff\" shouldn't fail" + diff -u ${postrender_diff_out_file} ${postrender_diff_reverse} || fail "\"helmfile diff\" should be consistent" + echo code=$? +done +test_pass "postrender diff" \ No newline at end of file diff --git a/test/integration/test-cases/regression.sh b/test/integration/test-cases/regression.sh index 2831de1f..5028c9c4 100644 --- a/test/integration/test-cases/regression.sh +++ b/test/integration/test-cases/regression.sh @@ -1,41 +1,37 @@ test_start "regression tests" -if [[ helm_major_version -eq 3 ]]; then - regression_case_input_dir="${cases_dir}/regression/input" +regression_case_input_dir="${cases_dir}/regression/input" - info "https://github.com/roboll/helmfile/issues/1857" - config_file="issue.1857.yaml" - if [[ ${HELMFILE_V1MODE} = true ]]; then - pushd "${regression_case_input_dir}" - mv "${config_file}" "${config_file}.gotmpl" - config_file="${config_file}.gotmpl" - popd - fi - (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=true template | grep grafana 1>/dev/null) || fail "\"helmfile template\" shouldn't include grafana" - ! (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=false template | grep grafana) || fail "\"helmfile template\" shouldn't include grafana" - - info "https://github.com/roboll/helmfile/issues/1867" - config_file="issue.1867.yaml" - if [[ ${HELMFILE_V1MODE} = true ]]; then - pushd "${regression_case_input_dir}" - mv "${config_file}" "${config_file}.gotmpl" - config_file="${config_file}.gotmpl" - popd - fi - (${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" - - info "https://github.com/roboll/helmfile/issues/2118" - config_file="issue.2118.yaml" - if [[ ${HELMFILE_V1MODE} = true ]]; then - pushd "${regression_case_input_dir}" - mv "${config_file}" "${config_file}.gotmpl" - config_file="${config_file}.gotmpl" - popd - fi - (${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" -else - info "There are no regression tests for helm 2 because all the target charts have dropped helm 2 support." +info "https://github.com/roboll/helmfile/issues/1857" +config_file="issue.1857.yaml" +if [[ ${HELMFILE_V1MODE} = true ]]; then + pushd "${regression_case_input_dir}" + mv "${config_file}" "${config_file}.gotmpl" + config_file="${config_file}.gotmpl" + popd fi +(${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=true template | grep grafana 1>/dev/null) || fail "\"helmfile template\" shouldn't include grafana" +! (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=false template | grep grafana) || fail "\"helmfile template\" shouldn't include grafana" + +info "https://github.com/roboll/helmfile/issues/1867" +config_file="issue.1867.yaml" +if [[ ${HELMFILE_V1MODE} = true ]]; then + pushd "${regression_case_input_dir}" + mv "${config_file}" "${config_file}.gotmpl" + config_file="${config_file}.gotmpl" + popd +fi +(${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" + +info "https://github.com/roboll/helmfile/issues/2118" +config_file="issue.2118.yaml" +if [[ ${HELMFILE_V1MODE} = true ]]; then + pushd "${regression_case_input_dir}" + mv "${config_file}" "${config_file}.gotmpl" + config_file="${config_file}.gotmpl" + popd +fi +(${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" test_pass "regression tests" \ No newline at end of file diff --git a/test/integration/test-cases/secretssops.sh b/test/integration/test-cases/secretssops.sh index 47171a17..b4c53f79 100644 --- a/test/integration/test-cases/secretssops.sh +++ b/test/integration/test-cases/secretssops.sh @@ -1,70 +1,68 @@ -if [[ helm_major_version -eq 3 ]]; then - export VAULT_ADDR=http://127.0.0.1:8200 - export VAULT_TOKEN=toor - sops="sops --hc-vault-transit $VAULT_ADDR/v1/sops/keys/key" +export VAULT_ADDR=http://127.0.0.1:8200 +export VAULT_TOKEN=toor +sops="sops --hc-vault-transit $VAULT_ADDR/v1/sops/keys/key" - secretssops_case_input_dir="${cases_dir}/secretssops/input" - secretssops_case_output_dir="${cases_dir}/secretssops/output" - config_file="secretssops.yaml" - if [[ ${HELMFILE_V1MODE} = true ]]; then - pushd "${secretssops_case_input_dir}" - mv "${config_file}" "${config_file}.gotmpl" - config_file="${config_file}.gotmpl" - popd - fi +secretssops_case_input_dir="${cases_dir}/secretssops/input" +secretssops_case_output_dir="${cases_dir}/secretssops/output" +config_file="secretssops.yaml" +if [[ ${HELMFILE_V1MODE} = true ]]; then + pushd "${secretssops_case_input_dir}" + mv "${config_file}" "${config_file}.gotmpl" + config_file="${config_file}.gotmpl" + popd +fi - mkdir -p ${secretssops_case_input_dir}/tmp +mkdir -p ${secretssops_case_input_dir}/tmp - info "Encrypt secrets" - ${sops} -e ${secretssops_case_input_dir}/env-1.secrets.yaml > ${secretssops_case_input_dir}/tmp/env-1.secrets.sops.yaml || fail "${sops} failed at ${secretssops_case_input_dir}/env-1.secrets.yaml" - ${sops} -e ${secretssops_case_input_dir}/env-2.secrets.yaml > ${secretssops_case_input_dir}/tmp/env-2.secrets.sops.yaml || fail "${sops} failed at ${secretssops_case_input_dir}/env-2.secrets.yaml" +info "Encrypt secrets" +${sops} -e ${secretssops_case_input_dir}/env-1.secrets.yaml > ${secretssops_case_input_dir}/tmp/env-1.secrets.sops.yaml || fail "${sops} failed at ${secretssops_case_input_dir}/env-1.secrets.yaml" +${sops} -e ${secretssops_case_input_dir}/env-2.secrets.yaml > ${secretssops_case_input_dir}/tmp/env-2.secrets.sops.yaml || fail "${sops} failed at ${secretssops_case_input_dir}/env-2.secrets.yaml" - test_start "secretssops.1 - should fail without secrets plugin" +test_start "secretssops.1 - should fail without secrets plugin" - info "Ensure helm-secrets is not installed" - ${helm} plugin rm secrets || true +info "Ensure helm-secrets is not installed" +${helm} plugin rm secrets || true - info "Ensure helmfile fails when no helm-secrets is installed" - unset code - ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct build || code="$?"; code="${code:-0}" - echo Code: "${code}" - [ "${code}" -ne 0 ] || fail "\"helmfile build\" should fail without secrets plugin" +info "Ensure helmfile fails when no helm-secrets is installed" +unset code +${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct build || code="$?"; code="${code:-0}" +echo Code: "${code}" +[ "${code}" -ne 0 ] || fail "\"helmfile build\" should fail without secrets plugin" - test_pass "secretssops.1" +test_pass "secretssops.1" - test_start "secretssops.2 - should succeed with secrets plugin" +test_start "secretssops.2 - should succeed with secrets plugin" - info "Ensure helm-secrets is installed" - ${helm} plugin install https://github.com/jkroepke/helm-secrets --version v${HELM_SECRETS_VERSION} +info "Ensure helm-secrets is installed" +${helm} plugin install https://github.com/jkroepke/helm-secrets --version v${HELM_SECRETS_VERSION} - info "Ensure helmfile succeed when helm-secrets is installed" - ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct build || fail "\"helmfile build\" shouldn't fail" +info "Ensure helmfile succeed when helm-secrets is installed" +${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct build || fail "\"helmfile build\" shouldn't fail" - test_pass "secretssops.2" +test_pass "secretssops.2" - test_start "secretssops.3 - should order secrets correctly" +test_start "secretssops.3 - should order secrets correctly" - secretssops_tmp=$(mktemp -d) - direct=${secretssops_tmp}/direct.build.yaml - reverse=${secretssops_tmp}/reverse.build.yaml +secretssops_tmp=$(mktemp -d) +direct=${secretssops_tmp}/direct.build.yaml +reverse=${secretssops_tmp}/reverse.build.yaml - info "Building secrets output" +info "Building secrets output" - info "Comparing build/direct output ${direct} with ${secretssops_case_output_dir}" - for i in $(seq 10); do - info "Comparing build/direct #$i" - ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct template --skip-deps > ${direct} || fail "\"helmfile template\" shouldn't fail" - ./dyff between -bs ${secretssops_case_output_dir}/direct.build.yaml ${direct} || fail "\"helmfile template\" should be consistent" - echo code=$? - done +info "Comparing build/direct output ${direct} with ${secretssops_case_output_dir}" +for i in $(seq 10); do + info "Comparing build/direct #$i" + ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct template --skip-deps > ${direct} || fail "\"helmfile template\" shouldn't fail" + ./dyff between -bs ${secretssops_case_output_dir}/direct.build.yaml ${direct} || fail "\"helmfile template\" should be consistent" + echo code=$? +done - info "Comparing build/reverse output ${direct} with ${secretssops_case_output_dir}" - for i in $(seq 10); do - info "Comparing build/reverse #$i" - ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e reverse template --skip-deps > ${reverse} || fail "\"helmfile template\" shouldn't fail" - ./dyff between -bs ${secretssops_case_output_dir}/reverse.build.yaml ${reverse} || fail "\"helmfile template\" should be consistent" - echo code=$? - done +info "Comparing build/reverse output ${direct} with ${secretssops_case_output_dir}" +for i in $(seq 10); do + info "Comparing build/reverse #$i" + ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e reverse template --skip-deps > ${reverse} || fail "\"helmfile template\" shouldn't fail" + ./dyff between -bs ${secretssops_case_output_dir}/reverse.build.yaml ${reverse} || fail "\"helmfile template\" should be consistent" + echo code=$? +done - test_pass "secretssops.3" -fi \ No newline at end of file +test_pass "secretssops.3" \ No newline at end of file diff --git a/test/integration/test-cases/yaml-overwrite.sh b/test/integration/test-cases/yaml-overwrite.sh index aa0a5c14..a4a45825 100644 --- a/test/integration/test-cases/yaml-overwrite.sh +++ b/test/integration/test-cases/yaml-overwrite.sh @@ -1,21 +1,19 @@ -if [[ helm_major_version -eq 3 ]]; then - if [[ ${HELMFILE_V1MODE} = true ]]; then - yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input" - yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output" +if [[ ${HELMFILE_V1MODE} = true ]]; then + yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input" + yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output" - yaml_overwrite_tmp=$(mktemp -d) - yaml_overwrite_reverse=${yaml_overwrite_tmp}/yaml.override.build.yaml + yaml_overwrite_tmp=$(mktemp -d) + yaml_overwrite_reverse=${yaml_overwrite_tmp}/yaml.override.build.yaml - test_start "yaml overwrite feature" - info "Comparing yaml overwrite feature output ${yaml_overwrite_reverse} with ${yaml_overwrite_case_output_dir}/overwritten.yaml" - for i in $(seq 10); do - info "Comparing build/yaml-overwrite #$i" - ${helmfile} -f ${yaml_overwrite_case_input_dir}/issue.657.yaml.gotmpl template --skip-deps > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" - ./dyff between -bs ${yaml_overwrite_case_output_dir}/overwritten.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" - echo code=$? - done - test_pass "yaml overwrite feature" - else - test_pass "[skipped] yaml overwrite feature" - fi -fi + test_start "yaml overwrite feature" + info "Comparing yaml overwrite feature output ${yaml_overwrite_reverse} with ${yaml_overwrite_case_output_dir}/overwritten.yaml" + for i in $(seq 10); do + info "Comparing build/yaml-overwrite #$i" + ${helmfile} -f ${yaml_overwrite_case_input_dir}/issue.657.yaml.gotmpl template --skip-deps > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" + ./dyff between -bs ${yaml_overwrite_case_output_dir}/overwritten.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" + echo code=$? + done + test_pass "yaml overwrite feature" +else + test_pass "[skipped] yaml overwrite feature" +fi \ No newline at end of file