(t *testing.T)
| 207 | } |
| 208 | |
| 209 | func TestManagerEntersStopStateEventually(t *testing.T) { |
| 210 | t.Parallel() |
| 211 | |
| 212 | s1 := serviceThatStopsOnItsOwnAfterTimeout(200 * time.Millisecond) |
| 213 | s2 := serviceThatStopsOnItsOwnAfterTimeout(300 * time.Millisecond) |
| 214 | gl := newGatheringManagerListener(t) |
| 215 | |
| 216 | m, err := NewManager(s1, s2) |
| 217 | require.NoError(t, err) |
| 218 | m.AddListener(gl) |
| 219 | |
| 220 | // start all services |
| 221 | require.NoError(t, m.StartAsync(context.Background())) |
| 222 | |
| 223 | require.NoError(t, m.AwaitHealthy(context.Background())) |
| 224 | |
| 225 | // both services stop after short time, so this manager will become stopped |
| 226 | require.NoError(t, m.AwaitStopped(context.Background())) |
| 227 | |
| 228 | require.NoError(t, gl.AwaitTerminated(context.Background())) |
| 229 | require.Equal(t, []string{"healthy", "stopped"}, gl.log) |
| 230 | } |
| 231 | |
| 232 | func TestManagerAwaitWithContextCancellation(t *testing.T) { |
| 233 | t.Parallel() |
nothing calls this directly
no test coverage detected