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

Function TestCreateProxy

pkg/topom/topom_proxy_test.go:12–44  ·  view source on GitHub ↗
(x *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestCreateProxy(x *testing.T) {
13 t := openTopom()
14 defer t.Close()
15
16 check := func(tokens []string) {
17 ctx, err := t.newContext()
18 assert.MustNoError(err)
19 assert.Must(len(ctx.proxy) == len(tokens))
20 for _, t := range tokens {
21 assert.Must(ctx.proxy[t] != nil)
22 }
23 }
24
25 p1, c1 := openProxy()
26 defer c1.Shutdown()
27
28 check([]string{})
29 assert.MustNoError(t.CreateProxy(p1.AdminAddr))
30 check([]string{p1.Token})
31 assert.Must(t.CreateProxy(p1.AdminAddr) != nil)
32 check([]string{p1.Token})
33
34 p2, c2 := openProxy()
35 defer c2.Shutdown()
36
37 assert.MustNoError(c2.Shutdown())
38 check([]string{p1.Token})
39 assert.Must(t.CreateProxy(p2.AdminAddr) != nil)
40 check([]string{p1.Token})
41
42 assert.MustNoError(c1.Shutdown())
43 check([]string{p1.Token})
44}
45
46func TestRemoveProxy(x *testing.T) {
47 t := openTopom()

Callers

nothing calls this directly

Calls 6

openTopomFunction · 0.85
openProxyFunction · 0.70
CloseMethod · 0.65
newContextMethod · 0.45
ShutdownMethod · 0.45
CreateProxyMethod · 0.45

Tested by

no test coverage detected