@@ -33,6 +33,9 @@ import (
3333 "time"
3434)
3535
36+ // failedStr is for comment matching during auto prioritization
37+ const failedStr = "Failed: "
38+
3639// issueFinder finds an issue for a given key.
3740type issueFinder interface {
3841 AllIssuesForKey (key string ) []int
@@ -194,7 +197,7 @@ func (p *individualFlakeSource) ID() string {
194197
195198// Body implements IssueSource
196199func (p * individualFlakeSource ) Body (newIssue bool ) string {
197- extraInfo := fmt .Sprintf ("Failed: %v\n \n ```\n %v\n ```\n \n " , p .Title (), p .flake .Reason )
200+ extraInfo := fmt .Sprintf (failedStr + " %v\n \n ```\n %v\n ```\n \n " , p .Title (), p .flake .Reason )
198201 body := makeGubernatorLink (p .ID ()) + "\n " + extraInfo
199202
200203 if ! newIssue {
@@ -249,13 +252,13 @@ func (p *brokenJobSource) ID() string {
249252func (p * brokenJobSource ) Body (newIssue bool ) string {
250253 url := makeGubernatorLink (p .ID ())
251254 if p .result .Status == cache .ResultFailed {
252- return fmt .Sprintf ("%v\n Run so broken it didn't make JUnit output!" , url )
255+ return fmt .Sprintf (failedStr + "%v\n Run so broken it didn't make JUnit output!" , url )
253256 }
254257 body := fmt .Sprintf ("%v\n Multiple broken tests:\n \n " , url )
255258
256259 sections := []string {}
257260 for testName , reason := range p .result .Flakes {
258- text := fmt .Sprintf ("Failed: %v\n \n ```\n %v\n ```\n " , testName , reason )
261+ text := fmt .Sprintf (failedStr + " %v\n \n ```\n %v\n ```\n " , testName , reason )
259262 // Reference previous issues if we know of any.
260263 // (key must batch individualFlakeSource.Title()!)
261264 if previousIssues := p .fm .finder .AllIssuesForKey (string (testName )); len (previousIssues ) > 0 {
@@ -308,9 +311,9 @@ func autoPrioritize(comments []libgithub.IssueComment, issueCreatedAt *time.Time
308311
309312 for _ , c := range comments {
310313 // TODO: think of a better way to identify flake comments
311- // "Failed:" is a special string contained in flake issue filed by flake-manager
314+ // "Failed: " is a special string contained in flake issue filed by flake-manager
312315 // Please make sure it matches the body generated by IssueSource.Body()
313- if ! sync .RobotUser .Has (* c .User .Login ) || ! strings .Contains (* c .Body , "Failed:" ) {
316+ if ! sync .RobotUser .Has (* c .User .Login ) || ! strings .Contains (* c .Body , failedStr ) {
314317 continue
315318 }
316319 occurence = append (occurence , c .CreatedAt )
0 commit comments