mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 17:52:12 +00:00
Kustomize file should be ignored when adding resources and components
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user