mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Fix issue where ignoreFilesMatcher doesn't work correctly
This commit is contained in:
@@ -53,7 +53,7 @@ testfile.yaml
|
||||
assert.FailNow(t, err.Error())
|
||||
}
|
||||
|
||||
ignoreFilesMatcher := IgnoreFilesMatcher{}
|
||||
ignoreFilesMatcher := ignoreFilesMatcher{}
|
||||
err = ignoreFilesMatcher.readIgnoreFile(dir)
|
||||
if !assert.NoError(t, err) {
|
||||
t.FailNow()
|
||||
@@ -165,6 +165,52 @@ a_test.yaml
|
||||
`b: b`,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "handles a combination of packages and directories",
|
||||
directories: []string{
|
||||
filepath.Join("a"),
|
||||
filepath.Join("d", "e"),
|
||||
filepath.Join("f"),
|
||||
},
|
||||
files: map[string][]byte{
|
||||
filepath.Join("pkgFile"): {},
|
||||
filepath.Join("d", "pkgFile"): {},
|
||||
filepath.Join("d", "e", "pkgFile"): {},
|
||||
filepath.Join("f", "pkgFile"): {},
|
||||
filepath.Join("manifest.yaml"): []byte(`root: root`),
|
||||
filepath.Join("a", "manifest.yaml"): []byte(`a: a`),
|
||||
filepath.Join("d", "manifest.yaml"): []byte(`d: d`),
|
||||
filepath.Join("d", "e", "manifest.yaml"): []byte(`e: e`),
|
||||
filepath.Join("f", "manifest.yaml"): []byte(`f: f`),
|
||||
filepath.Join("d", ".krmignore"): []byte(`
|
||||
manifest.yaml
|
||||
`),
|
||||
},
|
||||
expected: []string{
|
||||
`a: a`,
|
||||
`e: e`,
|
||||
`f: f`,
|
||||
`root: root`,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ignore file can exclude subpackages",
|
||||
directories: []string{
|
||||
filepath.Join("a"),
|
||||
},
|
||||
files: map[string][]byte{
|
||||
filepath.Join("pkgFile"): {},
|
||||
filepath.Join("a", "pkgFile"): {},
|
||||
filepath.Join("manifest.yaml"): []byte(`root: root`),
|
||||
filepath.Join("a", "manifest.yaml"): []byte(`a: a`),
|
||||
filepath.Join(".krmignore"): []byte(`
|
||||
a
|
||||
`),
|
||||
},
|
||||
expected: []string{
|
||||
`root: root`,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user