MCPcopy Index your code
hub / github.com/coder/coder / TestSubscribeProviderReloadIgnoresEventError

Function TestSubscribeProviderReloadIgnoresEventError

coderd/aibridged/reload_test.go:62–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestSubscribeProviderReloadIgnoresEventError(t *testing.T) {
63 t.Parallel()
64
65 ctx := testutil.Context(t, testutil.WaitMedium)
66
67 logger := slogtest.Make(t, nil)
68 ps := &errInjectingPubsub{}
69
70 calls := &recordingReloader{}
71 unsub, err := aibridged.SubscribeProviderReload(ctx, ps, calls, logger)
72 require.NoError(t, err)
73 t.Cleanup(unsub)
74
75 require.Equal(t, 1, calls.count())
76
77 ps.listener(ctx, nil, errPubsubDelivery)
78 require.Equal(t, 1, calls.count())
79
80 ps.listener(ctx, nil, nil)
81 require.Equal(t, 2, calls.count())
82}
83
84// recordingReloader is a minimal [aibridged.ProviderReloader] that
85// counts calls.

Callers

nothing calls this directly

Calls 6

countMethod · 0.95
ContextFunction · 0.92
SubscribeProviderReloadFunction · 0.92
listenerMethod · 0.80
CleanupMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected