mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Add a test case for issue 4905
```
===== ACTUAL BEGIN ========================================
apiVersion: v1
data:
config.yaml: "null"
kind: ConfigMap
metadata:
name: issue4905
===== ACTUAL END ==========================================
EXPECTED ACTUAL
-------- ------
apiVersion: v1 apiVersion: v1
data: data:
X config.yaml: |- config.yaml: "null"
X item1: 1 kind: ConfigMap
X item2: 2 metadata:
X kind: ConfigMap name: issue4905
X metadata:
X name: issue4905
hasgett.go:22: Expected not equal to actual
--- FAIL: TestHelmChartInflationGeneratorIssue4905 (0.24s)
```
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
This commit is contained in:
@@ -9,7 +9,9 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
"sigs.k8s.io/kustomize/kyaml/copyutil"
|
||||
)
|
||||
|
||||
func TestHelmChartInflationGenerator(t *testing.T) {
|
||||
@@ -579,3 +581,48 @@ valuesInline:
|
||||
`)
|
||||
th.AssertActualEqualsExpected(rm, "")
|
||||
}
|
||||
|
||||
func TestHelmChartInflationGeneratorIssue4905(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: issue4905
|
||||
name: issue4905
|
||||
releaseName: issue4905
|
||||
chartHome: ./charts
|
||||
valuesInline:
|
||||
config:
|
||||
item1: 1
|
||||
item2: 2
|
||||
`)
|
||||
|
||||
th.AssertActualEqualsExpected(rm, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
config.yaml: |-
|
||||
item1: 1
|
||||
item2: 2
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: issue4905
|
||||
`)
|
||||
}
|
||||
|
||||
func copyTestChartsIntoHarness(t *testing.T, th *kusttest_test.HarnessEnhanced) {
|
||||
t.Helper()
|
||||
|
||||
thDir := filepath.Join(th.GetRoot(), "charts")
|
||||
chartDir := "testdata/charts"
|
||||
|
||||
require.NoError(t, copyutil.CopyDir(th.GetFSys(), chartDir, thDir))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user