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:
yxxhero 2023-01-24 06:02:57 +08:00 committed by GitHub
parent ec60ac815b
commit b44aaf90f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 181 additions and 202 deletions

View File

@ -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?"

View File

@ -1,4 +1,3 @@
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"
@ -72,4 +71,3 @@ if [[ helm_major_version -eq 3 ]]; then
[ ${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

View File

@ -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

View File

@ -1,4 +1,3 @@
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"
@ -27,4 +26,3 @@ if [[ helm_major_version -eq 3 ]]; then
echo code=$?
done
test_pass "postrender diff"
fi

View File

@ -1,7 +1,6 @@
test_start "regression tests"
if [[ helm_major_version -eq 3 ]]; then
regression_case_input_dir="${cases_dir}/regression/input"
info "https://github.com/roboll/helmfile/issues/1857"
@ -34,8 +33,5 @@ if [[ helm_major_version -eq 3 ]]; then
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
test_pass "regression tests"

View File

@ -1,4 +1,3 @@
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"
@ -67,4 +66,3 @@ if [[ helm_major_version -eq 3 ]]; then
done
test_pass "secretssops.3"
fi

View File

@ -1,4 +1,3 @@
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"
@ -18,4 +17,3 @@ if [[ helm_major_version -eq 3 ]]; then
else
test_pass "[skipped] yaml overwrite feature"
fi
fi