-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27086 from tkashem/sa-test-fix
[rebase 1.24] disable tests with time limit to facilitate rebase
- Loading branch information
Showing
4 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestSkippedUntil(t *testing.T) { | ||
future := func() string { return time.Now().AddDate(0, 0, 5).Format("01022006") } | ||
past := func() string { return time.Now().AddDate(0, 0, -5).Format("01022006") } | ||
today := func() string { return time.Now().Format("01022006") } | ||
unrecognized := func() string { return time.Now().Format("01-02-2006") } | ||
|
||
tests := []struct { | ||
name string | ||
testName string | ||
skipped bool | ||
}{ | ||
{ | ||
name: "no skipped until tag", | ||
testName: "[sig-api-machinery][Feature:APIServer] testing foo [Suite:openshift/...]", | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until tag does not specify date or bz", | ||
testName: "[sig-api-machinery] testing foo [SkippedUntil:] [Suite:openshift/conformance/parallel/minimal]", | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until tag has invalid date", | ||
testName: "[sig-api-machinery] testing foo [SkippedUntil:abcdefgh:blocker-bz/123456] [Suite:openshift/conformance/parallel/minimal]", | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until tag has unrecognized date format", | ||
testName: fmt.Sprintf("[sig-api-machinery] testing foo [SkippedUntil:%s:blocker-bz/123456] [Suite:openshift/...", unrecognized()), | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until with valid date in the past", | ||
testName: fmt.Sprintf("[sig-api-machinery] testing foo [SkippedUntil:%s:blocker-bz/123456] [Suite:openshift/...]", past()), | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until with today's date", | ||
testName: fmt.Sprintf("[sig-api-machinery] testing foo [SkippedUntil:%s:blocker-bz/123456] [Suite:openshift/...]", today()), | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until with a valid date in the future, but no blocker bz specified", | ||
testName: fmt.Sprintf("[sig-api-machinery] testing foo [SkippedUntil:%s:blocker-bz/] [Suite:openshift]", future()), | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until with a valid date in the future, blocker bz is malformed", | ||
testName: fmt.Sprintf("[sig-api-machinery] testing foo [SkippedUntil:%s:blocker-bz/123*] [Suite:openshift]", future()), | ||
skipped: false, | ||
}, | ||
{ | ||
name: "skipped until with a valid date in the future", | ||
testName: fmt.Sprintf("[sig-api-machinery] testing foo [SkippedUntil:%s:blocker-bz/123456] [Suite:openshift]", future()), | ||
skipped: true, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
t.Logf("test name: %s", test.testName) | ||
got := shouldSkipUntil(test.testName) | ||
if test.skipped != got { | ||
t.Errorf("Expected: %v, but got: %v", test.skipped, got) | ||
} | ||
}) | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
test/extended/util/annotate/generated/zz_generated.annotations.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters