Skip to content

Commit

Permalink
add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing committed Jan 15, 2018
1 parent 4c02c62 commit 6c64cc2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/cluster_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,17 @@ func (s *testClusterWorkerSuite) checkSearchRegions(cluster *RaftCluster, keys .
}
}

func (s *testClusterWorkerSuite) TestEmptyRegionKey(c *C) {
cluster := s.svr.GetRaftCluster()
c.Assert(cluster, NotNil)
r1, _ := cluster.GetRegionByKey([]byte("a"))
c.Assert(r1.StartKey, HasLen, 0)
c.Assert(r1.EndKey, HasLen, 0)
// For the region key, nil is the same as "".
r1.StartKey, r1.EndKey = nil, nil
s.askSplit(c, r1)
}

func (s *testClusterWorkerSuite) TestHeartbeatSplit(c *C) {
cluster := s.svr.GetRaftCluster()
c.Assert(cluster, NotNil)
Expand Down

0 comments on commit 6c64cc2

Please sign in to comment.