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

Function TestPathStore_Notify_AncestorNotification

agent/agentgit/pathstore_test.go:197–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

195}
196
197func TestPathStore_Notify_AncestorNotification(t *testing.T) {
198 t.Parallel()
199
200 ps := agentgit.NewPathStore()
201 chatID := uuid.New()
202 ancestorID := uuid.New()
203
204 // Subscribe to the ancestor, then notify via the child.
205 ch, unsub := ps.Subscribe(ancestorID)
206 defer unsub()
207
208 ps.Notify([]uuid.UUID{chatID, ancestorID})
209
210 ctx := testutil.Context(t, testutil.WaitShort)
211 select {
212 case <-ch:
213 // Success.
214 case <-ctx.Done():
215 t.Fatal("ancestor subscriber did not receive notification")
216 }
217
218 require.Nil(t, ps.GetPaths(ancestorID))
219}
220
221func TestPathStore_ConcurrentSafety(t *testing.T) {
222 t.Parallel()

Callers

nothing calls this directly

Calls 8

SubscribeMethod · 0.95
NotifyMethod · 0.95
GetPathsMethod · 0.95
NewPathStoreFunction · 0.92
ContextFunction · 0.92
FatalMethod · 0.80
NewMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected