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

mantle/kola/harness.go: add snooze support for tests #2307

Merged
merged 2 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/kola.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Example format of the file:
# If no streams are specified, test will be skipped on all streams
- stream1
- stream2
# The test will only be skipped until this date (will resume on the date)
# Format: YYYY-MM-DD
snooze: 2021-07-20
arches:
# This test will be skipped on these arches
# If no arches are specified, test will be skipped on all arches
Expand Down
29 changes: 23 additions & 6 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ const NeedsInternetTag = "needs-internet"
// Don't e.g. check console for kernel errors, SELinux AVCs, etc.
const SkipBaseChecksTag = "skip-base-checks"

// Date format for snooze date specified in kola-denylist.yaml (YYYY-MM-DD)
const snoozeFormat = "2006-01-02"

var (
plog = capnslog.NewPackageLogger("github.com/coreos/mantle", "kola")

Expand Down Expand Up @@ -274,10 +277,11 @@ func testRequiresInternet(test *register.Test) bool {
}

type DenyListObj struct {
Pattern string `yaml:"pattern"`
Tracker string `yaml:"tracker"`
Streams []string `yaml:"streams"`
Arches []string `yaml:"arches"`
Pattern string `yaml:"pattern"`
Tracker string `yaml:"tracker"`
Streams []string `yaml:"streams"`
Arches []string `yaml:"arches"`
SnoozeDate string `yaml:"snooze"`
}

type ManifestData struct {
Expand Down Expand Up @@ -323,8 +327,9 @@ func parseDenyListYaml() error {

stream := manifest.AddCommitMetadata.FcosStream
arch := system.RpmArch()
today := time.Now()

// Accumulate patterns filtering by stream and arch
// Accumulate patterns filtering by stream, arch and skipping tests until snooze date
plog.Debug("Processing denial patterns from yaml...")
for _, obj := range objs {
if len(obj.Arches) > 0 && !hasString(arch, obj.Arches) {
Expand All @@ -335,7 +340,19 @@ func parseDenyListYaml() error {
continue
}

fmt.Printf("⚠️ Skipping kola test pattern \"%s\":\n", obj.Pattern)
if obj.SnoozeDate != "" {
snoozeDate, err := time.Parse(snoozeFormat, obj.SnoozeDate)
if err != nil {
return err
} else if today.After(snoozeDate) {
continue
}

fmt.Printf("🕒 Snoozing kola test pattern \"%s\" until %s:\n", obj.Pattern, snoozeDate.Format("Jan 02 2006"))
} else {
fmt.Printf("⚠️ Skipping kola test pattern \"%s\":\n", obj.Pattern)
}

fmt.Printf(" 👉 %s\n", obj.Tracker)
DenylistedTests = append(DenylistedTests, obj.Pattern)
}
Expand Down