Atlas › Test

TestCancelBeforeGo

Exact test identity: go.temporal.io/server/common/goro/TestCancelBeforeGo

Package
go.temporal.io/server/common/goro
Suite / test hierarchy
TestCancelBeforeGo
Test
TestCancelBeforeGo
Introduced at
ExampleGroup, TestCancelBeforeGo, +1 Frontier kind: Test frontier
Covered ranges
5
Covered lines
22
Covered files
2

Co-introduced tests

2 other tests enter at the same concept.

Covered source

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

go.temporal.io/server/common/goro/group.go 15 covered LOC · 4 ranges

Open complete file

27 // exit on their own (possibly never).
28 // NOTE: Errors returned by the supplied function are ignored.
29 > func (g *Group) Go(f func(ctx context.Context) error) { group.go
30 > g.initOnce.Do(g.init)
31 > g.wg.Go(func() {
32 > _ = f(g.ctx)
33 > })
34 }
35
36 // Cancel cancels the `context.Context` that was passed to all goroutines
37 // spawned via `Go` on this `Group`.
38 > func (g *Group) Cancel() { group.go
39 > g.initOnce.Do(g.init)
40 > g.cancel()
41 > }
42
43 // Wait blocks waiting for all goroutines spawned via `Go` on this `Group`
44 // instance to complete. If `Go` has not been called then this function returns
45 // immediately.
46 > func (g *Group) Wait() { group.go
47 > g.wg.Wait()
48 > }
49
50 > func (g *Group) init() { group.go
51 > g.ctx, g.cancel = context.WithCancel(context.Background())
52 > }
go.temporal.io/server/common/testing/parallelsuite/suite.go 7 covered LOC · 1 range

Open complete file

228 var inheritedMethods map[string]bool
229
230 > func init() { suite.go
231 > type ds struct{ Suite[*ds] }
232 > ptrType := reflect.TypeFor[*ds]()
233 > inheritedMethods = make(map[string]bool, ptrType.NumMethod())
234 > for method := range ptrType.Methods() {
235 > inheritedMethods[method.Name] = true
236 > }
237 }
238