(t *testing.T)
| 587 | } |
| 588 | |
| 589 | func Test_ServiceContextProviders(t *testing.T) { |
| 590 | t.Run("no-provider", func(t *testing.T) { |
| 591 | app := &App{ |
| 592 | configured: Config{}, |
| 593 | state: newState(), |
| 594 | } |
| 595 | require.Equal(t, context.Background(), app.servicesStartupCtx()) |
| 596 | require.Equal(t, context.Background(), app.servicesShutdownCtx()) |
| 597 | }) |
| 598 | |
| 599 | t.Run("with-provider", func(t *testing.T) { |
| 600 | ctx := context.TODO() |
| 601 | app := &App{ |
| 602 | configured: Config{ |
| 603 | ServicesStartupContextProvider: func() context.Context { |
| 604 | return ctx |
| 605 | }, |
| 606 | ServicesShutdownContextProvider: func() context.Context { |
| 607 | return ctx |
| 608 | }, |
| 609 | }, |
| 610 | state: newState(), |
| 611 | } |
| 612 | |
| 613 | require.Equal(t, ctx, app.servicesStartupCtx()) |
| 614 | require.Equal(t, ctx, app.servicesShutdownCtx()) |
| 615 | }) |
| 616 | } |
| 617 | |
| 618 | func Benchmark_StartServices(b *testing.B) { |
| 619 | benchmarkFn := func(b *testing.B, services []Service) { |
nothing calls this directly
no test coverage detected