(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func TestManagerCannotStartIfAllServicesArentNew(t *testing.T) { |
| 144 | t.Parallel() |
| 145 | |
| 146 | s1 := serviceThatDoesntDoAnything() |
| 147 | s2 := serviceThatDoesntDoAnything() |
| 148 | s3 := serviceThatDoesntDoAnything() |
| 149 | gl := newGatheringManagerListener(t) |
| 150 | |
| 151 | m, err := NewManager(s1, s2, s3) |
| 152 | require.NoError(t, err) |
| 153 | |
| 154 | m.AddListener(gl) |
| 155 | |
| 156 | // start first service |
| 157 | require.NoError(t, s1.StartAsync(context.Background())) |
| 158 | // will fail while starting s1, and then s2 and s3 won't be started at all (they are started sequentially) |
| 159 | require.Error(t, m.StartAsync(context.Background())) |
| 160 | |
| 161 | m.StopAsync() |
| 162 | require.NoError(t, m.AwaitStopped(context.Background())) |
| 163 | |
| 164 | require.NoError(t, gl.AwaitTerminated(context.Background())) |
| 165 | require.Equal(t, []string{"stopped"}, gl.log) |
| 166 | } |
| 167 | |
| 168 | func TestManagerThatFailsToStart(t *testing.T) { |
| 169 | t.Parallel() |
nothing calls this directly
no test coverage detected