MCPcopy
hub / github.com/CodisLabs/codis / TestRequestChan1

Function TestRequestChan1

pkg/proxy/request_test.go:16–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestRequestChan1(t *testing.T) {
17 var ch = NewRequestChanBuffer(0)
18 for i := 0; i < 8192; i++ {
19 n := ch.PushBack(&Request{UnixNano: int64(i)})
20 assert.Must(n == i+1)
21 }
22 for i := 0; i < 8192; i++ {
23 r, ok := ch.PopFront()
24 assert.Must(ok && r.UnixNano == int64(i))
25 }
26 assert.Must(ch.Buffered() == 0)
27
28 ch.Close()
29
30 _, ok := ch.PopFront()
31 assert.Must(!ok)
32}
33
34func TestRequestChan2(t *testing.T) {
35 var ch = NewRequestChanBuffer(512)

Callers

nothing calls this directly

Calls 5

NewRequestChanBufferFunction · 0.85
PopFrontMethod · 0.80
BufferedMethod · 0.80
CloseMethod · 0.65
PushBackMethod · 0.45

Tested by

no test coverage detected