mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 10:11:54 +02:00
Use logger for helm output (#1585)
* use logger for helm output Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> * update integration test output Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> * make logging output configurable Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> * also compare stderr in integration tests Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> --------- Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
@@ -3,26 +3,35 @@ diff_args_output_dir="${cases_dir}/diff-args/output"
|
||||
|
||||
diff_args_tmp=$(mktemp -d)
|
||||
diff_args_reverse=${diff_args_tmp}/diff.args.build.yaml
|
||||
diff_args_reverse_stderr=${diff_args_tmp}/diff.args.build.stderr.yaml
|
||||
|
||||
case_title="diff args"
|
||||
diff_out_file=${diff_args_output_dir}/diff
|
||||
apply_out_file=${diff_args_output_dir}/apply
|
||||
diff_out_stderr_file=${diff_args_output_dir}/diff-stderr
|
||||
apply_out_stderr_file=${diff_args_output_dir}/apply-stderr
|
||||
if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then
|
||||
apply_out_file=${diff_args_output_dir}/apply-live
|
||||
diff_out_file=${diff_args_output_dir}/diff-live
|
||||
apply_out_file=${diff_args_output_dir}/apply-live
|
||||
diff_out_stderr_file=${diff_args_output_dir}/diff-live-stderr
|
||||
apply_out_stderr_file=${diff_args_output_dir}/apply-live-stderr
|
||||
fi
|
||||
|
||||
test_start "$case_title"
|
||||
info "Comparing ${case_title} diff for output ${diff_args_reverse} with ${diff_out_file}"
|
||||
info "Comparing ${case_title} diff for output ${diff_args_reverse_stderr} with ${diff_out_stderr_file}"
|
||||
for i in $(seq 10); do
|
||||
info "Comparing diff-args diff log #$i"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml diff > ${diff_args_reverse} || fail "\"helmfile diff\" shouldn't fail"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml diff 1> ${diff_args_reverse} 2> ${diff_args_reverse_stderr} || fail "\"helmfile diff\" shouldn't fail"
|
||||
diff -u ${diff_out_file} ${diff_args_reverse} || fail "\"helmfile diff\" should be consistent"
|
||||
diff -u ${diff_out_stderr_file} ${diff_args_reverse_stderr} || fail "\"helmfile diff\" should be consistent (stderr)"
|
||||
echo code=$?
|
||||
done
|
||||
info "Comparing ${case_title} apply for output ${diff_args_reverse} with ${apply_out_file}"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml apply | grep -vE "^(LAST DEPLOYED|installed)" > ${diff_args_reverse} || fail "\"helmfile apply\" shouldn't fail"
|
||||
diff -u ${apply_out_file} ${diff_args_reverse} || fail "\"helmfile apply\" should be consistent"
|
||||
info "Comparing ${case_title} apply for stdout ${diff_args_reverse_stderr} with ${apply_out_stderr_file}"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml apply 1> ${diff_args_reverse} 2> ${diff_args_reverse_stderr} || fail "\"helmfile apply\" shouldn't fail"
|
||||
diff -u ${apply_out_file} <(grep -vE "^(LAST DEPLOYED|installed)" ${diff_args_reverse}) || fail "\"helmfile apply\" should be consistent"
|
||||
diff -u ${apply_out_stderr_file} <(grep -vE "^(LAST DEPLOYED|installed)" ${diff_args_reverse_stderr}) || fail "\"helmfile apply\" should be consistent (stderr)"
|
||||
echo "clean up diff args resources"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml destroy || fail "\"helmfile destroy\" shouldn't fail"
|
||||
test_pass "$case_title"
|
||||
@@ -67,11 +67,3 @@ helmfile-tests, installed-httpbin, Service (v1) has been added:
|
||||
+ release: installed
|
||||
+ type: LoadBalancer
|
||||
|
||||
Release "installed" does not exist. Installing it now.
|
||||
NAME: installed
|
||||
NAMESPACE: helmfile-tests
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
||||
|
||||
|
||||
|
||||
@@ -74,4 +74,3 @@ NAMESPACE: helmfile-tests
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Live output is enabled
|
||||
Building dependency release=installed, chart=../../../charts/httpbin
|
||||
Listing releases matching ^uninstalled$
|
||||
Upgrading release=installed, chart=../../../charts/httpbin
|
||||
Listing releases matching ^installed$
|
||||
|
||||
|
||||
UPDATED RELEASES:
|
||||
NAME NAMESPACE CHART VERSION DURATION
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Building dependency release=installed, chart=../../../charts/httpbin
|
||||
Listing releases matching ^uninstalled$
|
||||
Upgrading release=installed, chart=../../../charts/httpbin
|
||||
Release "installed" does not exist. Installing it now.
|
||||
NAME: installed
|
||||
NAMESPACE: helmfile-tests
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
||||
|
||||
Listing releases matching ^installed$
|
||||
|
||||
|
||||
UPDATED RELEASES:
|
||||
NAME NAMESPACE CHART VERSION DURATION
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Live output is enabled
|
||||
Building dependency release=installed, chart=../../../charts/httpbin
|
||||
Listing releases matching ^uninstalled$
|
||||
@@ -0,0 +1,2 @@
|
||||
Building dependency release=installed, chart=../../../charts/httpbin
|
||||
Listing releases matching ^uninstalled$
|
||||
@@ -1,4 +1,3 @@
|
||||
Comparing release=foo, chart=../../../charts/raw
|
||||
Comparing release=baz, chart=../../../charts/raw
|
||||
********************
|
||||
|
||||
|
||||
@@ -13,5 +13,4 @@ helmfile-tests, baz-2, ConfigMap (v1) has been added:
|
||||
+ namespace: helmfile-tests
|
||||
+ data:
|
||||
+ baz: BAZ
|
||||
Comparing release=foo, chart=../../../charts/raw
|
||||
Comparing release=baz, chart=../../../charts/raw
|
||||
|
||||
Reference in New Issue
Block a user