buildPackageTests groups failedTests by package into the wire format flakeapp expects. If fakeRepo is non-empty, tests with no real issue URL (i.e. not marked via flakytest.Mark) get a fake URL of the form https://github.com/{fakeRepo}/issues/UNKNOWN. If fakeRepo is empty, those tests are simply om
(fts []*failedTest, fakeRepo string)
| 693 | // https://github.com/{fakeRepo}/issues/UNKNOWN. If fakeRepo is empty, those |
| 694 | // tests are simply omitted from the IssueURLs map. |
| 695 | func buildPackageTests(fts []*failedTest, fakeRepo string) []packageTests { |
| 696 | byPkg := map[string][]*failedTest{} |
| 697 | for _, ft := range fts { |
| 698 | byPkg[ft.pkg] = append(byPkg[ft.pkg], ft) |
| 699 | } |
| 700 | pkgs := make([]string, 0, len(byPkg)) |
| 701 | for p := range byPkg { |
| 702 | pkgs = append(pkgs, p) |
| 703 | } |
| 704 | sort.Strings(pkgs) |
| 705 | out := make([]packageTests, 0, len(pkgs)) |
| 706 | for _, p := range pkgs { |
| 707 | group := byPkg[p] |
| 708 | slices.SortFunc(group, func(a, b *failedTest) int { return strings.Compare(a.testName, b.testName) }) |
| 709 | pt := packageTests{Pattern: p, IssueURLs: map[string]string{}} |
| 710 | for _, ft := range group { |
| 711 | pt.Tests = append(pt.Tests, ft.testName) |
| 712 | url := ft.issueURL |
| 713 | if url == "" && fakeRepo != "" { |
| 714 | url = fakeIssueURL(fakeRepo) |
| 715 | } |
| 716 | if url != "" { |
| 717 | pt.IssueURLs[ft.testName] = url |
| 718 | } |
| 719 | } |
| 720 | out = append(out, pt) |
| 721 | } |
| 722 | return out |
| 723 | } |
| 724 | |
| 725 | func main() { |
| 726 | goTestArgs, packages, testArgs, err := splitArgs(os.Args[1:]) |
no test coverage detected
searching dependent graphs…