remove helm v2 code in tests (#648)
Signed-off-by: yxxhero <aiopsclub@163.com> Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
		
							parent
							
								
									ec60ac815b
								
							
						
					
					
						commit
						b44aaf90f7
					
				|  | @ -68,15 +68,6 @@ function cleanup() { | ||||||
| set -e | set -e | ||||||
| trap cleanup EXIT | trap cleanup EXIT | ||||||
| info "Using namespace: ${test_ns}" | 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} | ${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.]\+')" | 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?" | ${kubectl} get namespace ${test_ns} &> /dev/null && warn "Namespace ${test_ns} exists, from a previous test run?" | ||||||
|  |  | ||||||
|  | @ -1,75 +1,73 @@ | ||||||
| if [[ helm_major_version -eq 3 ]]; then | chart_need_case_input_dir="${cases_dir}/chart-needs/input" | ||||||
|   chart_need_case_input_dir="${cases_dir}/chart-needs/input" | chart_need_case_output_dir="${cases_dir}/chart-needs/output" | ||||||
|   chart_need_case_output_dir="${cases_dir}/chart-needs/output" |  | ||||||
| 
 | 
 | ||||||
|   config_file="helmfile.yaml" | config_file="helmfile.yaml" | ||||||
|   if [[ ${HELMFILE_V1MODE} = true ]]; then | if [[ ${HELMFILE_V1MODE} = true ]]; then | ||||||
|   pushd "${chart_need_case_input_dir}" |   pushd "${chart_need_case_input_dir}" | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |   mv "${config_file}" "${config_file}.gotmpl" | ||||||
|   config_file="${config_file}.gotmpl" |   config_file="${config_file}.gotmpl" | ||||||
|   popd |   popd | ||||||
|   fi | fi | ||||||
| 
 | 
 | ||||||
|   chart_needs_tmp=$(mktemp -d) | chart_needs_tmp=$(mktemp -d) | ||||||
|   chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log | chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log | ||||||
|   chart_needs_lint_reverse=${chart_needs_tmp}/chart.needs.lint.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_diff_reverse=${chart_needs_tmp}/chart.needs.diff.log | ||||||
| 
 | 
 | ||||||
|   lint_out_file=${chart_need_case_output_dir}/lint | lint_out_file=${chart_need_case_output_dir}/lint | ||||||
|   diff_out_file=${chart_need_case_output_dir}/diff | diff_out_file=${chart_need_case_output_dir}/diff | ||||||
|   if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then | if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then | ||||||
|     lint_out_file=${chart_need_case_output_dir}/lint-live |     lint_out_file=${chart_need_case_output_dir}/lint-live | ||||||
|     diff_out_file=${chart_need_case_output_dir}/diff-live |     diff_out_file=${chart_need_case_output_dir}/diff-live | ||||||
|   fi | 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 | for i in $(seq 10); do | ||||||
|     info "Comparing template/chart-needs #$i" |     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" |     ${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" |     ./dyff between -bs ${chart_need_case_output_dir}/template ${chart_needs_template_reverse} || fail "\"helmfile template\" should be consistent" | ||||||
|     echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
| 
 | 
 | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|     info "Comparing lint/chart-needs #$i" |     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" |     ${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" |     diff -u ${lint_out_file} ${chart_needs_lint_reverse} || fail "\"helmfile lint\" should be consistent" | ||||||
|     echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
| 
 | 
 | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|     info "Comparing diff/chart-needs #$i" |     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" |     ${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" |     diff -u ${diff_out_file} ${chart_needs_diff_reverse} || fail "\"helmfile diff\" should be consistent" | ||||||
|     echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
| 
 | 
 | ||||||
|   info "Applying ${chart_need_case_input_dir}/${config_file}" | info "Applying ${chart_need_case_input_dir}/${config_file}" | ||||||
|   ${helmfile} -f ${chart_need_case_input_dir}/${config_file}  apply --include-needs | ${helmfile} -f ${chart_need_case_input_dir}/${config_file}  apply --include-needs | ||||||
|   code=$? | code=$? | ||||||
|   [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${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}" | info "Destroying ${chart_need_case_input_dir}/${config_file}" | ||||||
|   ${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy | ${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy | ||||||
|   code=$? | code=$? | ||||||
|   [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: want 0, got ${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}" | info "Syncing ${chart_need_case_input_dir}/${config_file}" | ||||||
|   ${helmfile} -f ${chart_need_case_input_dir}/${config_file}  sync --include-needs | ${helmfile} -f ${chart_need_case_input_dir}/${config_file}  sync --include-needs | ||||||
|   code=$? | code=$? | ||||||
|   [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${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}" | info "Destroying ${chart_need_case_input_dir}/${config_file}" | ||||||
|   ${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy | ${helmfile} -f ${chart_need_case_input_dir}/${config_file} destroy | ||||||
|   code=$? | code=$? | ||||||
|   [ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: want 0, got ${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" | test_pass "chart prepare when helmfile template with needs" | ||||||
| fi |  | ||||||
|  | @ -32,7 +32,7 @@ for output in $(ls -d ${dir}/tmp/*); do | ||||||
|     # e.g. test/integration/tmp/happypath-877c0dd4-helmx/helmx |     # e.g. test/integration/tmp/happypath-877c0dd4-helmx/helmx | ||||||
|     for release_dir in $(ls -d ${output}/*); do |     for release_dir in $(ls -d ${output}/*); do | ||||||
|         release_name=$(basename ${release_dir}) |         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}" |         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}" |         ./diff-yamls ${golden_dir} ${release_dir}/templates || fail "unexpected diff in template result for ${release_name}" | ||||||
|     done |     done | ||||||
|  |  | ||||||
|  | @ -1,30 +1,28 @@ | ||||||
| if [[ helm_major_version -eq 3 ]]; then | postrender_diff_case_input_dir="${cases_dir}/postrender-diff/input" | ||||||
|   postrender_diff_case_input_dir="${cases_dir}/postrender-diff/input" | postrender_diff_case_output_dir="${cases_dir}/postrender-diff/output" | ||||||
|   postrender_diff_case_output_dir="${cases_dir}/postrender-diff/output" |  | ||||||
| 
 | 
 | ||||||
|   config_file="helmfile.yaml" | config_file="helmfile.yaml" | ||||||
|   if [[ ${HELMFILE_V1MODE} = true ]]; then | if [[ ${HELMFILE_V1MODE} = true ]]; then | ||||||
|   pushd "${postrender_diff_case_input_dir}" |   pushd "${postrender_diff_case_input_dir}" | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |   mv "${config_file}" "${config_file}.gotmpl" | ||||||
|   config_file="${config_file}.gotmpl" |   config_file="${config_file}.gotmpl" | ||||||
|   popd |   popd | ||||||
|   fi | fi | ||||||
| 
 | 
 | ||||||
|   postrender_diff_out_file=${postrender_diff_case_output_dir}/result | postrender_diff_out_file=${postrender_diff_case_output_dir}/result | ||||||
|   if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then | if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then | ||||||
|     postrender_diff_out_file=${postrender_diff_case_output_dir}/result-live |     postrender_diff_out_file=${postrender_diff_case_output_dir}/result-live | ||||||
|   fi | fi | ||||||
| 
 | 
 | ||||||
|   postrender_diff_tmp=$(mktemp -d) | postrender_diff_tmp=$(mktemp -d) | ||||||
|   postrender_diff_reverse=${postrender_diff_tmp}/postrender.diff.build.yaml | postrender_diff_reverse=${postrender_diff_tmp}/postrender.diff.build.yaml | ||||||
| 
 | 
 | ||||||
|   test_start "postrender diff" | test_start "postrender diff" | ||||||
|   info "Comparing postrender diff output ${postrender_diff_reverse} with ${postrender_diff_case_output_dir}/result.yaml" | info "Comparing postrender diff output ${postrender_diff_reverse} with ${postrender_diff_case_output_dir}/result.yaml" | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|     info "Comparing build/postrender-diff #$i" |     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" |     ${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" |     diff -u  ${postrender_diff_out_file} ${postrender_diff_reverse} || fail "\"helmfile diff\" should be consistent" | ||||||
|     echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
|   test_pass "postrender diff" | test_pass "postrender diff" | ||||||
| fi |  | ||||||
|  | @ -1,41 +1,37 @@ | ||||||
| 
 | 
 | ||||||
| test_start "regression tests" | 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" | info "https://github.com/roboll/helmfile/issues/1857" | ||||||
|   config_file="issue.1857.yaml" | config_file="issue.1857.yaml" | ||||||
|   if [[ ${HELMFILE_V1MODE} = true ]]; then | if [[ ${HELMFILE_V1MODE} = true ]]; then | ||||||
|   pushd "${regression_case_input_dir}" |   pushd "${regression_case_input_dir}" | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |   mv "${config_file}" "${config_file}.gotmpl" | ||||||
|   config_file="${config_file}.gotmpl" |   config_file="${config_file}.gotmpl" | ||||||
|   popd |   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." |  | ||||||
| fi | 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" | test_pass "regression tests" | ||||||
|  | @ -1,70 +1,68 @@ | ||||||
| if [[ helm_major_version -eq 3 ]]; then | export VAULT_ADDR=http://127.0.0.1:8200 | ||||||
|   export VAULT_ADDR=http://127.0.0.1:8200 | export VAULT_TOKEN=toor | ||||||
|   export VAULT_TOKEN=toor | sops="sops --hc-vault-transit $VAULT_ADDR/v1/sops/keys/key" | ||||||
|   sops="sops --hc-vault-transit $VAULT_ADDR/v1/sops/keys/key" |  | ||||||
| 
 | 
 | ||||||
|   secretssops_case_input_dir="${cases_dir}/secretssops/input" | secretssops_case_input_dir="${cases_dir}/secretssops/input" | ||||||
|   secretssops_case_output_dir="${cases_dir}/secretssops/output" | secretssops_case_output_dir="${cases_dir}/secretssops/output" | ||||||
|   config_file="secretssops.yaml" | config_file="secretssops.yaml" | ||||||
|   if [[ ${HELMFILE_V1MODE} = true ]]; then | if [[ ${HELMFILE_V1MODE} = true ]]; then | ||||||
|   pushd "${secretssops_case_input_dir}" |   pushd "${secretssops_case_input_dir}" | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |   mv "${config_file}" "${config_file}.gotmpl" | ||||||
|   config_file="${config_file}.gotmpl" |   config_file="${config_file}.gotmpl" | ||||||
|   popd |   popd | ||||||
|   fi | fi | ||||||
| 
 | 
 | ||||||
|   mkdir -p ${secretssops_case_input_dir}/tmp | mkdir -p ${secretssops_case_input_dir}/tmp | ||||||
| 
 | 
 | ||||||
|   info "Encrypt secrets" | 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-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" | ${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" | info "Ensure helm-secrets is not installed" | ||||||
|   ${helm} plugin rm secrets || true | ${helm} plugin rm secrets || true | ||||||
| 
 | 
 | ||||||
|   info "Ensure helmfile fails when no helm-secrets is installed" | info "Ensure helmfile fails when no helm-secrets is installed" | ||||||
|   unset code | unset code | ||||||
|   ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct build || code="$?"; code="${code:-0}" | ${helmfile} -f ${secretssops_case_input_dir}/${config_file} -e direct build || code="$?"; code="${code:-0}" | ||||||
|   echo Code: "${code}" | echo Code: "${code}" | ||||||
|   [ "${code}" -ne 0 ] || fail "\"helmfile build\" should fail without secrets plugin" | [ "${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" | info "Ensure helm-secrets is installed" | ||||||
|   ${helm} plugin install https://github.com/jkroepke/helm-secrets --version v${HELM_SECRETS_VERSION} | ${helm} plugin install https://github.com/jkroepke/helm-secrets --version v${HELM_SECRETS_VERSION} | ||||||
| 
 | 
 | ||||||
|   info "Ensure helmfile succeed when helm-secrets is installed" | 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" | ${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) | secretssops_tmp=$(mktemp -d) | ||||||
|   direct=${secretssops_tmp}/direct.build.yaml | direct=${secretssops_tmp}/direct.build.yaml | ||||||
|   reverse=${secretssops_tmp}/reverse.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}" | info "Comparing build/direct output ${direct} with ${secretssops_case_output_dir}" | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|     info "Comparing build/direct #$i" |     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" |     ${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" |     ./dyff between -bs ${secretssops_case_output_dir}/direct.build.yaml ${direct} || fail "\"helmfile template\" should be consistent" | ||||||
|     echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
| 
 | 
 | ||||||
|   info "Comparing build/reverse output ${direct} with ${secretssops_case_output_dir}" | info "Comparing build/reverse output ${direct} with ${secretssops_case_output_dir}" | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|     info "Comparing build/reverse #$i" |     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" |     ${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" |     ./dyff between -bs ${secretssops_case_output_dir}/reverse.build.yaml ${reverse} || fail "\"helmfile template\" should be consistent" | ||||||
|     echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
| 
 | 
 | ||||||
|   test_pass "secretssops.3" | test_pass "secretssops.3" | ||||||
| fi |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| if [[ helm_major_version -eq 3 ]]; then | if [[ ${HELMFILE_V1MODE} = true ]]; then | ||||||
|   if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input" |   yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input" | ||||||
|   yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output" |   yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output" | ||||||
| 
 | 
 | ||||||
|  | @ -15,7 +14,6 @@ if [[ helm_major_version -eq 3 ]]; then | ||||||
|       echo code=$? |       echo code=$? | ||||||
|   done |   done | ||||||
|   test_pass "yaml overwrite feature" |   test_pass "yaml overwrite feature" | ||||||
|   else | else | ||||||
|   test_pass "[skipped] yaml overwrite feature" |   test_pass "[skipped] yaml overwrite feature" | ||||||
|   fi |  | ||||||
| fi | fi | ||||||
		Loading…
	
		Reference in New Issue