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

Function TestRemoveProxy

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

Source from the content-addressed store, hash-verified

44}
45
46func TestRemoveProxy(x *testing.T) {
47 t := openTopom()
48 defer t.Close()
49
50 check := func(tokens []string) {
51 ctx, err := t.newContext()
52 assert.MustNoError(err)
53 assert.Must(len(ctx.proxy) == len(tokens))
54 for _, t := range tokens {
55 assert.Must(ctx.proxy[t] != nil)
56 }
57 }
58
59 p1, c1 := openProxy()
60 defer c1.Shutdown()
61
62 check([]string{})
63 assert.MustNoError(t.CreateProxy(p1.AdminAddr))
64 check([]string{p1.Token})
65 assert.MustNoError(t.RemoveProxy(p1.Token, false))
66 check([]string{})
67
68 p2, c2 := openProxy()
69 defer c2.Shutdown()
70
71 assert.MustNoError(t.CreateProxy(p2.AdminAddr))
72 check([]string{p2.Token})
73
74 assert.MustNoError(c2.Shutdown())
75 assert.Must(t.RemoveProxy(p2.Token, false) != nil)
76 check([]string{p2.Token})
77
78 assert.MustNoError(t.RemoveProxy(p2.Token, true))
79 check([]string{})
80}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected