Kustomize file should be ignored when adding resources and components

This commit is contained in:
Alex Rodin
2021-02-11 15:27:33 -05:00
parent c764bc1618
commit 17ecec2f0a
6 changed files with 75 additions and 8 deletions

View File

@@ -117,6 +117,13 @@ func NewKustomizationFile(fSys filesys.FileSystem) (*kustomizationFile, error) {
return mf, nil
}
func (mf *kustomizationFile) GetPath() string {
if mf == nil {
return ""
}
return mf.path
}
func (mf *kustomizationFile) validate() error {
match := 0
var path []string

View File

@@ -80,6 +80,18 @@ func TestWriteAndRead(t *testing.T) {
}
}
func TestGetPath(t *testing.T) {
fSys := filesys.MakeEmptyDirInMemory()
testutils_test.WriteTestKustomization(fSys)
mf, err := NewKustomizationFile(fSys)
if err != nil {
t.Fatalf("Unexpected Error: %v", err)
}
if mf.GetPath() != "kustomization.yaml" {
t.Fatalf("Path expected: kustomization.yaml. Actual path: %v", mf.GetPath())
}
}
func TestNewNotExist(t *testing.T) {
fSys := filesys.MakeFsInMemory()
_, err := NewKustomizationFile(fSys)