(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestNilServiceFailureWatcher(t *testing.T) { |
| 15 | var w *FailureWatcher |
| 16 | |
| 17 | // prove it doesn't fail, but returns nil channel. |
| 18 | require.Nil(t, w.Chan()) |
| 19 | |
| 20 | // Ensure WatchService() panics. |
| 21 | require.Panics(t, func() { |
| 22 | w.WatchService(NewIdleService(nil, nil)) |
| 23 | }) |
| 24 | |
| 25 | // Ensure WatchManager() panics. |
| 26 | m, err := NewManager(NewIdleService(nil, nil)) |
| 27 | require.NoError(t, err) |
| 28 | t.Cleanup(func() { |
| 29 | require.NoError(t, StopManagerAndAwaitStopped(context.Background(), m)) |
| 30 | }) |
| 31 | |
| 32 | require.Panics(t, func() { |
| 33 | w.WatchManager(m) |
| 34 | }) |
| 35 | |
| 36 | // Closing nil watcher doesn't panic. |
| 37 | w.Close() |
| 38 | } |
| 39 | |
| 40 | func TestServiceFailureWatcher(t *testing.T) { |
| 41 | w := NewFailureWatcher() |
nothing calls this directly
no test coverage detected