diff --git a/cmd/cli/kubectl-kyverno/test/test_command.go b/cmd/cli/kubectl-kyverno/test/test_command.go index ae20537dc2..27ca9b52ca 100644 --- a/cmd/cli/kubectl-kyverno/test/test_command.go +++ b/cmd/cli/kubectl-kyverno/test/test_command.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "net/url" "os" + "path" "path/filepath" "regexp" "sort" @@ -398,7 +399,7 @@ func testCommandExecute(dirPath []string, fileName string, gitBranch string, tes continue } - if file.Name() == fileName { + if path.Base(file.Name()) == fileName { testYamlCount++ policyresoucePath := strings.Trim(yamlFilePath, fileName) bytes, err := ioutil.ReadAll(file)