(t *testing.T)
| 67 | } |
| 68 | |
| 69 | func TestC_ServeDisable(t *testing.T) { |
| 70 | var called int32 |
| 71 | c := New( |
| 72 | WithInline("http.disable", "true"), |
| 73 | WithInline("grpc.disable", "true"), |
| 74 | WithInline("cron.disable", "true"), |
| 75 | ) |
| 76 | c.ProvideEssentials() |
| 77 | c.AddModule(srvhttp.HealthCheckModule{}) |
| 78 | c.AddModule(srvgrpc.HealthCheckModule{}) |
| 79 | |
| 80 | c.Invoke(func(dispatcher contract.Dispatcher) { |
| 81 | dispatcher.Subscribe(events.Listen(OnHTTPServerStart, func(ctx context.Context, start interface{}) error { |
| 82 | atomic.AddInt32(&called, 1) |
| 83 | return nil |
| 84 | })) |
| 85 | }) |
| 86 | c.Invoke(func(dispatcher contract.Dispatcher) { |
| 87 | dispatcher.Subscribe(events.Listen(OnHTTPServerShutdown, func(ctx context.Context, shutdown interface{}) error { |
| 88 | atomic.AddInt32(&called, 1) |
| 89 | return nil |
| 90 | })) |
| 91 | }) |
| 92 | c.Invoke(func(dispatcher contract.Dispatcher) { |
| 93 | dispatcher.Subscribe(events.Listen(OnGRPCServerStart, func(ctx context.Context, start interface{}) error { |
| 94 | atomic.AddInt32(&called, 1) |
| 95 | return nil |
| 96 | })) |
| 97 | }) |
| 98 | c.Invoke(func(dispatcher contract.Dispatcher) { |
| 99 | dispatcher.Subscribe(events.Listen(OnGRPCServerShutdown, func(ctx context.Context, shutdown interface{}) error { |
| 100 | atomic.AddInt32(&called, 1) |
| 101 | return nil |
| 102 | })) |
| 103 | }) |
| 104 | ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) |
| 105 | defer cancel() |
| 106 | e := c.Serve(ctx) |
| 107 | assert.NoError(t, e) |
| 108 | assert.Equal(t, int32(0), atomic.LoadInt32(&called)) |
| 109 | } |
| 110 | |
| 111 | func TestC_Default(t *testing.T) { |
| 112 | c := New() |
nothing calls this directly
no test coverage detected