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

Function TestFillSlot

pkg/proxy/proxy_test.go:78–111  ·  view source on GitHub ↗
(x *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestFillSlot(x *testing.T) {
79 s, addr := openProxy()
80 defer s.Close()
81
82 var c = NewApiClient(addr)
83 c.SetXAuth(config.ProductName, config.ProductAuth, s.Model().Token)
84
85 expect := make(map[int]*models.Slot)
86
87 for i := 0; i < 16; i++ {
88 slot := &models.Slot{
89 Id: i,
90 Locked: i%2 == 0,
91 BackendAddr: "x.x.x.x:xxxx",
92 }
93 assert.MustNoError(c.FillSlots(slot))
94 expect[i] = slot
95 }
96 verifySlots(c, expect)
97
98 slots := []*models.Slot{}
99 for i := 0; i < 16; i++ {
100 slot := &models.Slot{
101 Id: i,
102 Locked: i%2 != 0,
103 BackendAddr: "y.y.y.y:yyyy",
104 MigrateFrom: "x.x.x.x:xxxx",
105 }
106 slots = append(slots, slot)
107 expect[i] = slot
108 }
109 assert.MustNoError(c.FillSlots(slots...))
110 verifySlots(c, expect)
111}
112
113func TestStartAndShutdown(x *testing.T) {
114 s, addr := openProxy()

Callers

nothing calls this directly

Calls 7

verifySlotsFunction · 0.85
openProxyFunction · 0.70
NewApiClientFunction · 0.70
CloseMethod · 0.65
SetXAuthMethod · 0.45
ModelMethod · 0.45
FillSlotsMethod · 0.45

Tested by

no test coverage detected