(x *testing.T)
| 11 | ) |
| 12 | |
| 13 | func 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 | |
| 46 | func TestGroupCache(x *testing.T) { |
| 47 | t := openTopom() |
nothing calls this directly
no test coverage detected