Skip to content

Commit

Permalink
mantle/kola: simplify logic in ParseDenyListYaml
Browse files Browse the repository at this point in the history
With the introduction of warn: true the logic gets complicated.
This is an attempt to simplify the logic and handle all corner cases.
  • Loading branch information
dustymabe authored and nikita-dubrovskii committed Jul 28, 2023
1 parent d4e0a10 commit e35315b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,37 +449,39 @@ func ParseDenyListYaml(pltfrm string) error {
continue
}

// Process "special" patterns which aren't test names, but influence overall behavior
if obj.Pattern == SkipConsoleWarningsTag {
SkipConsoleWarnings = true
continue
}

if obj.SnoozeDate != "" {
snoozeDate, err := time.Parse(snoozeFormat, obj.SnoozeDate)
if err != nil {
return err
}
if today.After(snoozeDate) {
if !obj.Warn {
continue
fmt.Printf("⏰ Snooze for kola test pattern \"%s\" expired on %s\n", obj.Pattern, snoozeDate.Format("Jan 02 2006"))
if obj.Warn {
fmt.Printf("⚠️ Will warn on failure for kola test pattern \"%s\":\n", obj.Pattern)
WarnOnErrorTests = append(WarnOnErrorTests, obj.Pattern)
}
fmt.Printf("⚠️ Warning kola test pattern \"%s\", snoozing expired on %s:\n", obj.Pattern, snoozeDate.Format("Jan 02 2006"))
WarnOnErrorTests = append(WarnOnErrorTests, obj.Pattern)
} else {
fmt.Printf("🕒 Snoozing kola test pattern \"%s\" until %s:\n", obj.Pattern, snoozeDate.Format("Jan 02 2006"))
fmt.Printf("🕒 Snoozing kola test pattern \"%s\" until %s\n", obj.Pattern, snoozeDate.Format("Jan 02 2006"))
DenylistedTests = append(DenylistedTests, obj.Pattern)
}
} else if obj.Warn {
fmt.Printf("⚠️ Will warn on failure for kola test pattern \"%s\":\n", obj.Pattern)
WarnOnErrorTests = append(WarnOnErrorTests, obj.Pattern)
} else {
fmt.Printf("⏭️ Skipping kola test pattern \"%s\":\n", obj.Pattern)
if obj.Warn {
fmt.Printf("⚠️ Will warn on failure for kola test pattern \"%s\":\n", obj.Pattern)
WarnOnErrorTests = append(WarnOnErrorTests, obj.Pattern)
} else {
fmt.Printf("⏭️ Skipping kola test pattern \"%s\":\n", obj.Pattern)
DenylistedTests = append(DenylistedTests, obj.Pattern)
}
}

if obj.Tracker != "" {
fmt.Printf(" 👉 %s\n", obj.Tracker)
}

/// Process "special" patterns which aren't test names, but influence overall behavior
if obj.Pattern == SkipConsoleWarningsTag {
SkipConsoleWarnings = true
} else if !obj.Warn {
DenylistedTests = append(DenylistedTests, obj.Pattern)
}
}

return nil
Expand Down

0 comments on commit e35315b

Please sign in to comment.