(gid int, tg *TestGroup, tags *ZeroTags)
| 53 | } |
| 54 | |
| 55 | func (tc *ExtraIncrTestCase) player(gid int, tg *TestGroup, tags *ZeroTags) { |
| 56 | tg.PlayerWait() |
| 57 | defer tg.PlayerDone() |
| 58 | c := NewConn(tc.proxy) |
| 59 | defer c.Close() |
| 60 | us := UnitSlice(make([]*Unit, tc.nkeys)) |
| 61 | for i := 0; i < len(us); i++ { |
| 62 | key := fmt.Sprintf("extra_incr_%d_%d_tag{%s}", gid, i, tags.Get(i)) |
| 63 | us[i] = NewUnit(key) |
| 64 | } |
| 65 | for _, u := range us { |
| 66 | u.Del(c, false) |
| 67 | ops.Incr() |
| 68 | } |
| 69 | for i := 0; i < tc.round; i++ { |
| 70 | for _, u := range us { |
| 71 | u.Incr(c) |
| 72 | ops.Incr() |
| 73 | } |
| 74 | } |
| 75 | time.Sleep(time.Second * 5) |
| 76 | c1s, c1m := NewConn(tc.slave1), NewConn(tc.master1) |
| 77 | c2s, c2m := NewConn(tc.slave2), NewConn(tc.master2) |
| 78 | defer c1s.Close() |
| 79 | defer c1m.Close() |
| 80 | defer c2s.Close() |
| 81 | defer c2m.Close() |
| 82 | for _, u := range us { |
| 83 | s := tc.groupfetch(c1s, c2s, u.key) |
| 84 | m := tc.groupfetch(c1m, c2m, u.key) |
| 85 | if s != m || s != u.val { |
| 86 | Panic("check failed, key = %s, val = %d, master = %d, slave = %d", u.key, u.val, s, m) |
| 87 | } |
| 88 | } |
| 89 | for _, u := range us { |
| 90 | u.Del(c, true) |
| 91 | ops.Incr() |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | func (tc *ExtraIncrTestCase) groupfetch(c1, c2 redis.Conn, key string) int { |
| 96 | r1, e1 := c1.Do("get", key) |
no test coverage detected