MCPcopy
hub / github.com/grafana/dskit / TestServiceFailureWatcher

Function TestServiceFailureWatcher

services/failure_watch_test.go:40–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestServiceFailureWatcher(t *testing.T) {
41 w := NewFailureWatcher()
42
43 err := errors.New("this error doesn't end with dot")
44
45 failing := NewBasicService(nil, nil, func(_ error) error {
46 return err
47 })
48
49 w.WatchService(failing)
50
51 require.NoError(t, failing.StartAsync(context.Background()))
52
53 e := <-w.Chan()
54 require.NotNil(t, e)
55 require.Equal(t, err, e2.Cause(e))
56}
57
58func TestServiceFailureWatcherClose(t *testing.T) {
59 s1 := serviceThatDoesntDoAnything()

Callers

nothing calls this directly

Calls 6

WatchServiceMethod · 0.95
StartAsyncMethod · 0.95
ChanMethod · 0.95
NewFailureWatcherFunction · 0.85
NewBasicServiceFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected