mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-09 08:35:46 +02:00
* test: add integration test for issue #1880 transformers with file:// deps Add an integration test reproducing the exact scenario from issue #1880: a local chart with a relative file:// dependency (file://../library) used together with kustomize transformers. Before the fix (rewriteChartDependencies in PR #2334), chartify copied the chart to a temp directory, breaking the relative file:// path and causing helm dependency up to fail with: Error: directory /tmp/chartify.../monitoring/library not found Also fix test artifact leak in issue923_test.go where OCI chart downloads wrote to CWD because OutputDirTemplate lacked {{ .OutputDir }}. Closes #1880 Signed-off-by: yxxhero <aiopsclub@163.com> * fix(test): guard exit-code captures against set -e in integration tests Under set -e (enabled in run.sh), a failing command exits the shell before 'var=$?' can execute, defeating diagnostic cat+fail blocks and breaking helm diff tests that expect exit code 2. Replaced 'cmd; var=$?' with 'var=0; cmd || var=$?' across 12 test files (29 sites), matching the pattern already used in oci-parallel-pull.sh. Signed-off-by: yxxhero <aiopsclub@163.com> --------- Signed-off-by: yxxhero <aiopsclub@163.com>
55 lines
2.4 KiB
Bash
Executable File
55 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
test_start "kubedog-tracking - resource tracking with kubedog integration"
|
|
|
|
kubedog_case_dir="${cases_dir}/kubedog-tracking"
|
|
config_file="helmfile.yaml.gotmpl"
|
|
|
|
info "Testing kubedog integration with httpbin chart"
|
|
|
|
# Test 1: Basic sync with kubedog tracking
|
|
info "Syncing release with basic kubedog tracking"
|
|
code=0
|
|
${helmfile} -f "${kubedog_case_dir}/${config_file}" -l name=httpbin-basic sync || code=$?
|
|
[ "${code}" -eq 0 ] || fail "unexpected exit code returned by helmfile sync: ${code}"
|
|
|
|
wait_deploy_ready httpbin-basic-httpbin
|
|
info "Verifying httpbin-basic deployment is running"
|
|
${kubectl} get deployment httpbin-basic-httpbin -n "${test_ns}" || fail "httpbin-basic deployment not found"
|
|
|
|
# Test 2: Sync with whitelist filtering
|
|
info "Syncing release with whitelist filtering"
|
|
code=0
|
|
${helmfile} -f "${kubedog_case_dir}/${config_file}" -l name=httpbin-with-whitelist sync || code=$?
|
|
[ "${code}" -eq 0 ] || fail "unexpected exit code returned by helmfile sync with whitelist: ${code}"
|
|
|
|
wait_deploy_ready httpbin-with-whitelist-httpbin
|
|
info "Verifying httpbin-with-whitelist deployment is running"
|
|
${kubectl} get deployment httpbin-with-whitelist-httpbin -n "${test_ns}" || fail "httpbin-with-whitelist deployment not found"
|
|
|
|
# Test 3: Sync with specific resource tracking
|
|
info "Syncing release with specific resource tracking"
|
|
code=0
|
|
${helmfile} -f "${kubedog_case_dir}/${config_file}" -l name=httpbin-with-resources sync || code=$?
|
|
[ "${code}" -eq 0 ] || fail "unexpected exit code returned by helmfile sync with resource tracking: ${code}"
|
|
|
|
wait_deploy_ready httpbin-with-resources-httpbin
|
|
info "Verifying httpbin-with-resources deployment is running"
|
|
${kubectl} get deployment httpbin-with-resources-httpbin -n "${test_ns}" || fail "httpbin-with-resources deployment not found"
|
|
|
|
# Test 4: Apply all releases with kubedog via CLI flag
|
|
info "Testing apply with kubedog CLI flag"
|
|
code=0
|
|
${helmfile} -f "${kubedog_case_dir}/${config_file}" apply --track-mode kubedog --track-timeout 60 || code=$?
|
|
[ "${code}" -eq 0 ] || fail "unexpected exit code returned by helmfile apply: ${code}"
|
|
|
|
# Test 5: Cleanup
|
|
info "Destroying all releases"
|
|
code=0
|
|
${helmfile} -f "${kubedog_case_dir}/${config_file}" destroy || code=$?
|
|
[ "${code}" -eq 0 ] || fail "unexpected exit code returned by helmfile destroy: ${code}"
|
|
|
|
info "kubedog integration test completed successfully"
|
|
|
|
test_pass "kubedog-tracking"
|