Skip to content

Commit

Permalink
Allow skipping some YAML tests
Browse files Browse the repository at this point in the history
Allow skipping some of the yaml tests if the environment variable
TEST_EXAMPLES_IGNORES is set and match the regexp :

For example :

export TEST_EXAMPLES_IGNORES=".*clustertasks.*"

will skip all the kankiko examples yamls.

Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Aug 7, 2020
1 parent 3a7a693 commit 7b36913
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ func getExamplePaths(t *testing.T, dir string) []string {
return filepath.SkipDir
}
if info.IsDir() == false && filepath.Ext(info.Name()) == ".yaml" {
// Ignore test matching the regexp in the TEST_EXAMPLES_IGNORES
// environement variable.
val, ok := os.LookupEnv("TEST_EXAMPLES_IGNORES")
if ok {
re := regexp.MustCompile(val)
submatch := re.FindSubmatch([]byte(path))
if submatch != nil {
t.Logf("Skipping test %s", path)
return nil
}
}
t.Logf("Adding test %s", path)
examplePaths = append(examplePaths, path)
return nil
}
Expand Down

0 comments on commit 7b36913

Please sign in to comment.