Skip to content

Commit

Permalink
mantle/kola/harness: allow success if all tests are denylisted
Browse files Browse the repository at this point in the history
This will allow us to denylist certain categories of tests and not
have the pipeline fail. See [1] for a real world example of why this
is useful.

[1] coreos/fedora-coreos-config@e983073
  • Loading branch information
Adam0Brien committed Jun 1, 2023
1 parent 11e41a7 commit 7869990
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,16 @@ func runProvidedTests(testsBank map[string]*register.Test, patterns []string, mu
}
}

if len(tests) > 0 && suiteErr == harness.SuiteEmpty && allTestsDenyListed(tests) {
fmt.Printf("There are no tests to run because all tests are denylisted. Output in %v\n", outputDir)
return nil
}
if caughtTestError {
fmt.Printf("FAIL, output in %v\n", outputDir)
} else {
fmt.Printf("PASS, output in %v\n", outputDir)
}

return suiteErr
}

Expand All @@ -810,6 +815,20 @@ func runProvidedTests(testsBank map[string]*register.Test, patterns []string, mu
return firstRunErr
}

func allTestsDenyListed(tests map[string]*register.Test) bool {
for name := range tests {
isDenylisted, err := testIsDenyListed(name)
if err != nil {
plog.Warningf("Error while checking denylist for test:", err)
continue
}
if !isDenylisted {
return false
}
}
return true
}

func allTestsAllowRerunSuccess(testsBank map[string]*register.Test, testsToRerun, rerunSuccessTags []string) bool {
// No tags, we can return early
if len(rerunSuccessTags) == 0 {
Expand Down

0 comments on commit 7869990

Please sign in to comment.