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

Function TestPathStore_Subscribe_MultipleSubscribers

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

Source from the content-addressed store, hash-verified

81}
82
83func TestPathStore_Subscribe_MultipleSubscribers(t *testing.T) {
84 t.Parallel()
85
86 ps := agentgit.NewPathStore()
87 chatID := uuid.New()
88
89 ch1, unsub1 := ps.Subscribe(chatID)
90 defer unsub1()
91 ch2, unsub2 := ps.Subscribe(chatID)
92 defer unsub2()
93
94 ps.AddPaths([]uuid.UUID{chatID}, []string{"/file"})
95
96 ctx := testutil.Context(t, testutil.WaitShort)
97 for i, ch := range []<-chan struct{}{ch1, ch2} {
98 select {
99 case <-ch:
100 // OK
101 case <-ctx.Done():
102 t.Fatalf("subscriber %d did not receive notification", i)
103 }
104 }
105}
106
107func TestPathStore_Unsubscribe_StopsNotifications(t *testing.T) {
108 t.Parallel()

Callers

nothing calls this directly

Calls 7

SubscribeMethod · 0.95
AddPathsMethod · 0.95
NewPathStoreFunction · 0.92
ContextFunction · 0.92
NewMethod · 0.65
DoneMethod · 0.45
FatalfMethod · 0.45

Tested by

no test coverage detected