(ctx context.Context)
| 26 | } |
| 27 | |
| 28 | func (s *sampleService) Start(ctx context.Context) error { |
| 29 | ctx, shouldStart, started, stopped := s.StartInit(ctx) |
| 30 | if !shouldStart { |
| 31 | return nil |
| 32 | } |
| 33 | |
| 34 | if s.startErr != nil { |
| 35 | stopped() |
| 36 | return s.startErr |
| 37 | } |
| 38 | |
| 39 | go func() { |
| 40 | // Set this before confirming started. |
| 41 | s.state = true |
| 42 | |
| 43 | started() |
| 44 | defer stopped() |
| 45 | |
| 46 | <-ctx.Done() |
| 47 | }() |
| 48 | |
| 49 | return nil |
| 50 | } |
| 51 | |
| 52 | func testService(t *testing.T, newService func(t *testing.T) serviceWithStopped) { |
| 53 | t.Helper() |
no test coverage detected