Add --helm-debug Flag to Kustomize for Enhanced Helm Debugging (#5751)

* feat: add helm-debug flag

* revert: go.work.sum

* test: add helm chart args helm-debug test

* test: helm debug flag

* refactor: helm debug output

* style: linting

* revert: go.work.sum
This commit is contained in:
Isar_NS
2024-09-13 01:43:12 +03:00
committed by GitHub
parent c3872ce3d9
commit 4034e36ee1
8 changed files with 83 additions and 2 deletions

View File

@@ -959,3 +959,37 @@ chartHome: ./charts
assert.Contains(t, string(chartYamlContent), "name: test-chart")
assert.Contains(t, string(chartYamlContent), "version: 1.0.0")
}
func TestHelmChartInflationGeneratorWithDebug(t *testing.T) {
th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t).
PrepBuiltin("HelmChartInflationGenerator")
defer th.Reset()
if err := th.ErrIfNoHelm(); err != nil {
t.Skip("skipping: " + err.Error())
}
copyTestChartsIntoHarness(t, th)
rm := th.LoadAndRunGenerator(`
apiVersion: builtin
kind: HelmChartInflationGenerator
metadata:
name: test-chart
name: test-chart
version: 1.0.0
releaseName: test
chartHome: ./charts
debug: true
`)
cm, err := rm.Resources()[0].GetFieldValue("metadata.name")
require.NoError(t, err)
assert.Equal(t, "bar", cm)
chartDir := filepath.Join(th.GetRoot(), "charts/test-chart")
assert.True(t, th.GetFSys().Exists(chartDir))
chartYamlContent, err := th.GetFSys().ReadFile(filepath.Join(chartDir, "Chart.yaml"))
require.NoError(t, err)
assert.Contains(t, string(chartYamlContent), "name: test-chart")
assert.Contains(t, string(chartYamlContent), "version: 1.0.0")
}