MCPcopy
hub / github.com/tinode/chat / TestDispatchSubscribeJoinChannelFull

Function TestDispatchSubscribeJoinChannelFull

server/session_test.go:299–332  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

297}
298
299func TestDispatchSubscribeJoinChannelFull(t *testing.T) {
300 uid := types.Uid(1)
301 s := test_makeSession(uid)
302 wg := sync.WaitGroup{}
303 r := responses{}
304 wg.Add(1)
305 go s.testWriteLoop(&r, &wg)
306
307 hub := &Hub{
308 // Make it unbuffered with no readers - so emit operation fails immediately.
309 join: make(chan *ClientComMessage),
310 }
311 globals.hub = hub
312
313 defer func() {
314 globals.hub = nil
315 }()
316
317 msg := &ClientComMessage{
318 Sub: &MsgClientSub{
319 Id: "123",
320 Topic: "me",
321 Get: &MsgGetQuery{
322 What: "sub desc tags cred",
323 },
324 },
325 }
326
327 s.dispatch(msg)
328 close(s.send)
329 wg.Wait()
330
331 verifyResponseCodes(&r, []int{http.StatusServiceUnavailable}, t)
332}
333
334func TestDispatchLeave(t *testing.T) {
335 uid := types.Uid(1)

Callers

nothing calls this directly

Calls 7

UidTypeAlias · 0.92
test_makeSessionFunction · 0.85
verifyResponseCodesFunction · 0.85
testWriteLoopMethod · 0.80
dispatchMethod · 0.80
WaitMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…