mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
Ignore test files that do not end in test.yaml (#3402)
Some editors create backup files when editing. So users will edit kyverno-test.yaml and end up with both kyverno-test.yaml and kyverno-test.yaml~ (or some variant). This change ignores backup files that append a character to the string `test.yaml` Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com> Signed-off-by: Aidan Delaney <adelaney21@bloomberg.net> Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com> Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
This commit is contained in:
parent
4ce5c972ee
commit
def19d2ec0
1 changed files with 3 additions and 3 deletions
|
@ -397,9 +397,9 @@ func testCommandExecute(dirPath []string, fileName string, gitBranch string, tes
|
|||
continue
|
||||
}
|
||||
|
||||
if strings.Contains(file.Name(), fileName) || strings.Contains(file.Name(), "test.yaml") {
|
||||
if file.Name() == fileName || file.Name() == "test.yaml" {
|
||||
testYamlCount++
|
||||
if strings.Contains(file.Name(), "test.yaml") {
|
||||
if file.Name() == "test.yaml" {
|
||||
testYamlNameCount++
|
||||
}
|
||||
policyresoucePath := strings.Trim(yamlFilePath, fileName)
|
||||
|
@ -471,7 +471,7 @@ func getLocalDirTestFiles(fs billy.Filesystem, path, fileName string, rc *result
|
|||
getLocalDirTestFiles(fs, filepath.Join(path, file.Name()), fileName, rc, testFiles, deprecatedFiles, openAPIController, tf)
|
||||
continue
|
||||
}
|
||||
if strings.Contains(file.Name(), fileName) || strings.Contains(file.Name(), "test.yaml") {
|
||||
if file.Name() == fileName || file.Name() == "test.yaml" {
|
||||
*testFiles++
|
||||
if strings.Compare(file.Name(), "test.yaml") == 0 {
|
||||
*deprecatedFiles++
|
||||
|
|
Loading…
Add table
Reference in a new issue