Skip to content

Commit

Permalink
ignore out own tests (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger authored Dec 16, 2024
1 parent f23d7e1 commit bc2f08c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions yaml/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,36 @@ func ReadTestCases() ([]*TestCase, string) {

func collectTestCases(base string, duration time.Duration, evaluateIgnoreFile bool) ([]*TestCase, error) {
var cases []*TestCase
var ignored []string
err := filepath.WalkDir(base, func(p string, d os.DirEntry, err error) error {
if err != nil {
return err
}
if !oatsFileRegex.MatchString(d.Name()) || strings.Contains(d.Name(), "-template.yaml") {
return nil
}

if evaluateIgnoreFile {
if d.IsDir() {
if _, err := os.Stat(filepath.Join(p, ".oatsignore")); errors.Is(err, os.ErrNotExist) {
// ignore file does not exist
} else {
// ignore file exists
println("ignoring", p)
ignored = append(ignored, p)
return nil
}
}
}

if !oatsFileRegex.MatchString(d.Name()) || strings.Contains(d.Name(), "-template.yaml") {
return nil
}

for _, i := range ignored {
if strings.HasPrefix(p, i) {
return nil
}
}

if evaluateIgnoreFile {
println("adding", p)
}

Expand Down

0 comments on commit bc2f08c

Please sign in to comment.