mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-26 13:51:10 +01:00
cmd/testwrapper/flakytest: use t.Attr annotation on flaky tests
Updates #17460 Change-Id: I7381e9a6dd73514c73deb6b863749eef1a87efdc Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
541a4ed5b4
commit
525f9921fe
@ -27,7 +27,7 @@ const FlakyTestLogMessage = "flakytest: this is a known flaky test"
|
||||
// starting at 1.
|
||||
const FlakeAttemptEnv = "TS_TESTWRAPPER_ATTEMPT"
|
||||
|
||||
var issueRegexp = regexp.MustCompile(`\Ahttps://github\.com/tailscale/[a-zA-Z0-9_.-]+/issues/\d+\z`)
|
||||
var issueRegexp = regexp.MustCompile(`\Ahttps://github\.com/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/issues/\d+\z`)
|
||||
|
||||
var (
|
||||
rootFlakesMu sync.Mutex
|
||||
@ -49,6 +49,15 @@ func Mark(t testing.TB, issue string) {
|
||||
// spamming people running tests without the wrapper)
|
||||
fmt.Fprintf(os.Stderr, "%s: %s\n", FlakyTestLogMessage, issue)
|
||||
}
|
||||
t.Attr("flaky-test-issue-url", issue)
|
||||
|
||||
// The Attr method above also emits human-readable output, so this t.Logf
|
||||
// is somewhat redundant, but we keep it for compatibility with
|
||||
// old test runs, so cmd/testwrapper doesn't need to be modified.
|
||||
// TODO(bradfitz): switch testwrapper to look for Action "attr"
|
||||
// instead:
|
||||
// "Action":"attr","Package":"tailscale.com/cmd/testwrapper/flakytest","Test":"TestMarked_Root","Key":"flaky-test-issue-url","Value":"https://github.com/tailscale/tailscale/issues/0"}
|
||||
// And then remove this Logf a month or so after that.
|
||||
t.Logf("flakytest: issue tracking this flaky test: %s", issue)
|
||||
|
||||
// Record the root test name as flakey.
|
||||
|
||||
@ -14,7 +14,8 @@ func TestIssueFormat(t *testing.T) {
|
||||
want bool
|
||||
}{
|
||||
{"https://github.com/tailscale/cOrp/issues/1234", true},
|
||||
{"https://github.com/otherproject/corp/issues/1234", false},
|
||||
{"https://github.com/otherproject/corp/issues/1234", true},
|
||||
{"https://not.huyb/tailscale/corp/issues/1234", false},
|
||||
{"https://github.com/tailscale/corp/issues/", false},
|
||||
}
|
||||
for _, testCase := range testCases {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user