forked from CodisLabs/codis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_mgrt.go
44 lines (38 loc) · 857 Bytes
/
basic_mgrt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 Wandoujia Inc. All Rights Reserved.
// Licensed under the MIT (MIT-LICENSE.txt) license.
package main
import (
"flag"
"fmt"
)
type BasicMgrtTestCase struct {
master1 string
master2 string
round int
}
func init() {
testcase = &BasicMgrtTestCase{}
}
func (tc *BasicMgrtTestCase) init() {
flag.StringVar(&tc.master1, "master1", "", "redis#1 host:port")
flag.StringVar(&tc.master2, "master2", "", "redis#2 host:port")
flag.IntVar(&tc.round, "round", 10000, "# of opts")
}
func (tc *BasicMgrtTestCase) main() {
c1 := NewConn(tc.master1)
defer c1.Close()
c2 := NewConn(tc.master2)
defer c2.Close()
u := NewUnit("basic_mgrt")
u.Del(c1, false)
u.Del(c2, false)
for i := 0; i < tc.round; i++ {
u.Incr(c1)
u.Mgrt(c1, c2, true)
c1, c2 = c2, c1
ops.Incr()
}
u.Del(c1, false)
u.Del(c2, false)
fmt.Println("done")
}