diff --git a/pkg/kyverno/test/test_command.go b/pkg/kyverno/test/test_command.go index 1272b2f44c..865f07f80d 100644 --- a/pkg/kyverno/test/test_command.go +++ b/pkg/kyverno/test/test_command.go @@ -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++