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

Function newConnPair

pkg/proxy/backend_test.go:18–35  ·  view source on GitHub ↗
(config *Config)

Source from the content-addressed store, hash-verified

16)
17
18func newConnPair(config *Config) (*redis.Conn, *BackendConn) {
19 l, err := net.Listen("tcp", "127.0.0.1:0")
20 assert.MustNoError(err)
21 defer l.Close()
22
23 const bufsize = 128 * 1024
24
25 cc := make(chan *redis.Conn, 1)
26 go func() {
27 defer close(cc)
28 c, err := l.Accept()
29 assert.MustNoError(err)
30 cc <- redis.NewConn(c, bufsize, bufsize)
31 }()
32
33 bc := NewBackendConn(l.Addr().String(), 0, config)
34 return <-cc, bc
35}
36
37func TestBackend(t *testing.T) {
38 config := NewDefaultConfig()

Callers 1

TestBackendFunction · 0.70

Calls 4

NewBackendConnFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45
AddrMethod · 0.45

Tested by

no test coverage detected