MCPcopy Create free account
hub / github.com/tinode/chat / TestDispatchGetMetaChannelFull

Function TestDispatchGetMetaChannelFull

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

Source from the content-addressed store, hash-verified

648}
649
650func TestDispatchGetMetaChannelFull(t *testing.T) {
651 uid := types.Uid(1)
652 s := test_makeSession(uid)
653 wg := sync.WaitGroup{}
654 r := responses{}
655 wg.Add(1)
656 go s.testWriteLoop(&r, &wg)
657
658 destUid := types.Uid(2)
659 topicName := uid.P2PName(destUid)
660
661 // Unbuffered chan with no readers - emit will fail.
662 meta := make(chan *ClientComMessage)
663 s.subs = make(map[string]*Subscription)
664 s.subs[topicName] = &Subscription{
665 meta: meta,
666 }
667
668 msg := &ClientComMessage{
669 Get: &MsgClientGet{
670 Id: "123",
671 Topic: destUid.UserId(),
672 MsgGetQuery: MsgGetQuery{
673 What: "desc sub",
674 },
675 },
676 }
677
678 s.dispatch(msg)
679 close(s.send)
680 wg.Wait()
681
682 verifyResponseCodes(&r, []int{http.StatusServiceUnavailable}, t)
683}
684
685func TestDispatchSet(t *testing.T) {
686 uid := types.Uid(1)

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected