Atlas › Test

skips_test_suite_methods

Exact test identity: go.temporal.io/server/tools/parallelize/TestProcessFile/skips_test_suite_methods

Package
go.temporal.io/server/tools/parallelize
Suite / test hierarchy
TestProcessFile/skips_test_suite_methods
Test
skips_test_suite_methods
Introduced at
parallelize.go ×1 Frontier kind: Joint frontier
Covered ranges
8
Covered lines
23
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/tools/parallelize/parallelize.go 23 covered LOC · 8 ranges

Open complete file

43 }
44
45 > func processFile(path string) error { parallelize.go
46 > fset := token.NewFileSet()
47 > f, err := parser.ParseFile(fset, path, nil, parser.ParseComments)
48 > if err != nil {
49 return fmt.Errorf("parse %s: %w", path, err)
50 }
52 // Collect line numbers where we need to insert t.Parallel().
53 // Each entry is the line of the opening '{' of the test function body.
54 > type insertion struct { parallelize.go
55 > line int // line number of the '{' opening the function body
56 > paramName string // name of the *testing.T parameter
57 > }
58 > var insertions []insertion
59 >
60 > for _, decl := range f.Decls {
61 > fn, ok := decl.(*ast.FuncDecl)
62 > if !ok {
63 > continue
64 }
65 > if !isTestFunc(fn) { parallelize.go
66 > continue parallelize.go
67 }
68 paramName := testingTParamName(fn)
80 }
81
82 > if len(insertions) == 0 { parallelize.go
83 > return nil parallelize.go
84 > }
85
86 // Sort by line descending so insertions don't shift line numbers of subsequent insertions.
118
119 // isTestFunc returns true for func TestXxx(t *testing.T).
120 > func isTestFunc(fn *ast.FuncDecl) bool { parallelize.go
121 > if fn.Recv != nil {
122 > return false // method, not a function parallelize.go
123 > }
124 if !strings.HasPrefix(fn.Name.Name, "Test") {
125 return false