Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Only call Fail() once for all error logs #11184

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/helpers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ func CanRunK8sVersion(ciliumVersion, k8sVersionStr string) (bool, error) {
// given log messages contains an entry from the blacklist (map key) AND
// does not contain ignore messages (map value).
func failIfContainsBadLogMsg(logs string, blacklist map[string][]string) {
nFailures := 0
for _, msg := range strings.Split(logs, "\n") {
for fail, ignoreMessages := range blacklist {
if strings.Contains(msg, fail) {
Expand All @@ -462,11 +463,14 @@ func failIfContainsBadLogMsg(logs string, blacklist map[string][]string) {
}
if !ok {
fmt.Fprintf(CheckLogs, "⚠️ Found a %q in logs\n", fail)
Fail(fmt.Sprintf("Found a %q in Cilium Logs", fail))
nFailures++
}
}
}
}
if nFailures > 0 {
Fail(fmt.Sprintf("Found %d Cilium logs matching list of errors that must be investigated", nFailures))
}
}

// RunsOnNetNextOr419Kernel checks whether a test case is running on the net-next
Expand Down