MCPcopy Create free account
hub / github.com/tailscale/tailscale / buildPackageTests

Function buildPackageTests

cmd/testwrapper/testwrapper.go:695–723  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

693// https://github.com/{fakeRepo}/issues/UNKNOWN. If fakeRepo is empty, those
694// tests are simply omitted from the IssueURLs map.
695func 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
725func main() {
726 goTestArgs, packages, testArgs, err := splitArgs(os.Args[1:])

Callers 1

mainFunction · 0.85

Calls 3

fakeIssueURLFunction · 0.85
StringsMethod · 0.80
CompareMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…