forked from pingcap/go-hbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
34 lines (25 loc) · 843 Bytes
/
client_test.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
package hbase
import . "github.com/pingcap/check"
type ClientTestSuit struct {
cli HBaseClient
}
var _ = Suite(&ClientTestSuit{})
func (s *ClientTestSuit) SetUpSuite(c *C) {
}
func (s *ClientTestSuit) TearDownSuite(c *C) {
}
func (s *ClientTestSuit) TestCreateRegionName(c *C) {
table := "t"
startKey := "key"
id := "1234"
newFormat := false
mockClient := &client{}
name := mockClient.createRegionName([]byte(table), []byte(startKey), id, newFormat)
c.Assert(string(name), Equals, "t,key,1234")
startKey = ""
name = mockClient.createRegionName([]byte(table), []byte(startKey), id, newFormat)
c.Assert(string(name), Equals, "t,\x00,1234")
newFormat = true
name = mockClient.createRegionName([]byte(table), []byte(startKey), id, newFormat)
c.Assert(string(name), Equals, "t,\x00,1234.0b33d053d09ba72744f058890ed449b2.")
}