enable run skip-diff-output tests (#1104)

This commit is contained in:
yxxhero 2023-10-28 21:04:02 +08:00 committed by GitHub
parent cbc82f26ef
commit 9c1cf61559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 53 deletions

View File

@ -77,6 +77,7 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes
# TEST CASES----------------------------------------------------------------------------------------------------------
. ${dir}/test-cases/helmfile-double-fetch.sh
. ${dir}/test-cases/skip-diff-output.sh
. ${dir}/test-cases/v1-subhelmfile-multi-bases-with-array-values.sh
. ${dir}/test-cases/kustomized-fetch.sh
. ${dir}/test-cases/happypath.sh

View File

@ -0,0 +1,32 @@
skip_diff_output_input_dir="${cases_dir}/skip-diff-output/input"
skip_diff_output_output_dir="${cases_dir}/skip-diff-output/output"
skip_diff_output_tmp=$(mktemp -d)
skip_diff_output_reverse=${skip_diff_output_tmp}/skip.diff.output.build.yaml
case_title="skip diff output"
diff_out_file=${skip_diff_output_output_dir}/diff-result
template_out_file=${skip_diff_output_output_dir}/template-result
if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then
diff_out_file=${skip_diff_output_output_dir}/diff-result-live
fi
test_start "$case_title"
info "Comparing ${case_title} diff for output ${skip_diff_output_reverse} with ${diff_out_file}"
for i in $(seq 10); do
info "Comparing skip-diff-output diff log #$i"
${helmfile} -f ${skip_diff_output_input_dir}/helmfile.yaml.gotmpl diff > ${skip_diff_output_reverse} || fail "\"helmfile diff\" shouldn't fail"
diff -u ${diff_out_file} ${skip_diff_output_reverse} || fail "\"helmfile diff\" should be consistent"
echo code=$?
done
info "Comparing ${case_title} template for output ${skip_diff_output_reverse} with ${template_out_file}"
for i in $(seq 10); do
info "Comparing skip-diff-output template log #$i"
${helmfile} -f ${skip_diff_output_input_dir}/helmfile.yaml.gotmpl template > ${skip_diff_output_reverse} || fail "\"helmfile template\" shouldn't fail"
diff -u ${template_out_file} ${skip_diff_output_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "$case_title"

View File

@ -11,16 +11,6 @@ releases:
namespace: {{`{{ .Release.Namespace }}`}}
data:
foo: FOO
dep:
templates:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: {{`{{ .Release.Name }}`}}-2
namespace: {{`{{ .Release.Namespace }}`}}
data:
bar: BAR
suppressDiff: true
- name: baz
chart: ../../../charts/raw
@ -30,7 +20,7 @@ releases:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{`{{ .Release.Name }}`}}-3
name: {{`{{ .Release.Name }}`}}-2
namespace: {{`{{ .Release.Namespace }}`}}
data:
baz: BAZ

View File

@ -1,20 +1,18 @@
Building dependency release=foo, chart=../../../charts/raw
Building dependency release=baz, chart=../../../charts/raw
Comparing release=foo, chart=../../../charts/raw
Comparing release=baz, chart=../../../charts/raw
********************
Release was not present in Helm. Diff will show entire contents as new.
********************
helmfile-tests, baz-3, ConfigMap (v1) has been added:
-
helmfile-tests, baz-2, ConfigMap (v1) has been added:
-
+ # Source: raw/templates/resources.yaml
+ apiVersion: v1
+ kind: ConfigMap
+ metadata:
+ name: baz-3
+ name: baz-2
+ namespace: helmfile-tests
+ data:
+ baz: BAZ

View File

@ -1,18 +1,15 @@
Live output is enabled
Building dependency release=foo, chart=../../../charts/raw
Building dependency release=baz, chart=../../../charts/raw
********************
Release was not present in Helm. Diff will show entire contents as new.
********************
helmfile-tests, baz-3, ConfigMap (v1) has been added:
-
helmfile-tests, baz-2, ConfigMap (v1) has been added:
-
+ # Source: raw/templates/resources.yaml
+ apiVersion: v1
+ kind: ConfigMap
+ metadata:
+ name: baz-3
+ name: baz-2
+ namespace: helmfile-tests
+ data:
+ baz: BAZ

View File

@ -1,6 +1,3 @@
Building dependency release=foo, chart=../../../charts/raw
Building dependency release=baz, chart=../../../charts/raw
Templating release=foo, chart=../../../charts/raw
---
# Source: raw/templates/resources.yaml
apiVersion: v1
@ -11,13 +8,13 @@ metadata:
data:
foo: FOO
Templating release=baz, chart=../../../charts/raw
---
# Source: raw/templates/resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: baz-3
name: baz-2
namespace: helmfile-tests
data:
baz: BAZ

View File

@ -1,25 +0,0 @@
Live output is enabled
Building dependency release=foo, chart=../../../charts/raw
Building dependency release=baz, chart=../../../charts/raw
Templating release=foo, chart=../../../charts/raw
---
# Source: raw/templates/resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: foo-1
namespace: helmfile-tests
data:
foo: FOO
Templating release=baz, chart=../../../charts/raw
---
# Source: raw/templates/resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: baz-3
namespace: helmfile-tests
data:
baz: BAZ