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

Function TestRequestChan2

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

Source from the content-addressed store, hash-verified

32}
33
34func TestRequestChan2(t *testing.T) {
35 var ch = NewRequestChanBuffer(512)
36 for i := 0; i < 8192; i++ {
37 n := ch.PushBack(&Request{UnixNano: int64(i)})
38 assert.Must(n == i+1)
39 }
40 ch.Close()
41
42 assert.Must(ch.Buffered() == 8192)
43
44 for i := 0; i < 8192; i++ {
45 r, ok := ch.PopFront()
46 assert.Must(ok && r.UnixNano == int64(i))
47 }
48 assert.Must(ch.Buffered() == 0)
49
50 _, ok := ch.PopFront()
51 assert.Must(!ok)
52}
53
54func TestRequestChan3(t *testing.T) {
55 var wg sync.WaitGroup

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected