Skip to content

Commit f9617a6

Browse files
committed
Allow skipping some YAML tests
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 <chmouel@redhat.com>
1 parent 3a7a693 commit f9617a6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/examples_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ func getExamplePaths(t *testing.T, dir string) []string {
181181
return filepath.SkipDir
182182
}
183183
if info.IsDir() == false && filepath.Ext(info.Name()) == ".yaml" {
184+
// Ignore test matching the regexp in the TEST_EXAMPLES_IGNORES
185+
// environement variable.
186+
val, ok := os.LookupEnv("TEST_EXAMPLES_IGNORES")
187+
if ok {
188+
re := regexp.MustCompile(val)
189+
submatch := re.FindSubmatch([]byte(path))
190+
if submatch != nil {
191+
t.Logf("Skipping test %s", path)
192+
return nil
193+
}
194+
}
195+
t.Logf("Adding test %s", path)
184196
examplePaths = append(examplePaths, path)
185197
return nil
186198
}

0 commit comments

Comments
 (0)