add support .yml extension for kusotmization file

This commit is contained in:
Jingfang Liu
2018-10-24 10:22:39 -07:00
parent 18a2321ddd
commit ecbf3c5f51
4 changed files with 54 additions and 17 deletions

View File

@@ -21,6 +21,7 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/pkg/constants"
"sigs.k8s.io/kustomize/pkg/fs"
"sigs.k8s.io/kustomize/pkg/types"
)
@@ -141,6 +142,25 @@ func TestNewNotExist(t *testing.T) {
}
}
func TestSecondarySuffix(t *testing.T) {
kcontent := `
configMapGenerator:
- literals:
- foo=bar
- baz=qux
name: my-configmap
`
fakeFS := fs.MakeFakeFS()
fakeFS.WriteFile(constants.SecondaryKustomizationFileName, []byte(kcontent))
k, err := NewKustomizationFile(fakeFS)
if err != nil {
t.Fatalf("Unexpected Error: %v", err)
}
if k.path != constants.SecondaryKustomizationFileName {
t.Fatalf("Load incorrect file path %s", k.path)
}
}
func TestPreserveComments(t *testing.T) {
kustomizationContentWithComments := []byte(
`# shem qing some comments