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

Function TestSlotsCache

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

Source from the content-addressed store, hash-verified

11)
12
13func TestSlotsCache(x *testing.T) {
14 t := openTopom()
15 defer t.Close()
16
17 const sid = 100
18
19 check := func(gid int) {
20 m := getSlotMapping(t, sid)
21 assert.Must(m.GroupId == gid)
22 }
23
24 m := &models.SlotMapping{Id: sid}
25 check(0)
26
27 t.dirtySlotsCache(sid)
28 m.GroupId = 100
29 assert.MustNoError(t.storeUpdateSlotMapping(m))
30 check(100)
31
32 t.dirtySlotsCache(sid)
33 m.GroupId = 200
34 check(100)
35
36 t.dirtyCacheAll()
37 m.GroupId = 200
38 check(100)
39
40 t.dirtyCacheAll()
41 m.GroupId = 300
42 assert.MustNoError(t.storeUpdateSlotMapping(m))
43 check(300)
44}
45
46func TestGroupCache(x *testing.T) {
47 t := openTopom()

Callers

nothing calls this directly

Calls 6

openTopomFunction · 0.85
getSlotMappingFunction · 0.85
dirtySlotsCacheMethod · 0.80
dirtyCacheAllMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected