Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <admin@liudos.us>
  • Loading branch information
lhy1024 committed Dec 4, 2024
1 parent cbc9ad0 commit 97ad20e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/api/region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ func (suite *regionTestSuite) TestRegion() {
r.UpdateBuckets(buckets, r.GetBuckets())
re := suite.Require()
mustRegionHeartbeat(re, suite.svr, r)
url := fmt.Sprintf("%s/region/id/%d", suite.urlPrefix, r.GetID())
url := fmt.Sprintf("%s/region/id/%d", suite.urlPrefix, 0)
re.NoError(tu.CheckGetJSON(testDialClient, url, nil, tu.Status(re, http.StatusNotFound)))
url = fmt.Sprintf("%s/region/id/%d", suite.urlPrefix, r.GetID())
r1 := &response.RegionInfo{}
r1m := make(map[string]any)
re.NoError(tu.ReadGetJSON(re, testDialClient, url, r1))
Expand All @@ -94,6 +96,8 @@ func (suite *regionTestSuite) TestRegion() {
re.Equal(core.HexRegionKeyStr([]byte("a")), keys[0].(string))
re.Equal(core.HexRegionKeyStr([]byte("b")), keys[1].(string))

url = fmt.Sprintf("%s/region/key/%s", suite.urlPrefix, "c")
re.NoError(tu.CheckGetJSON(testDialClient, url, nil, tu.Status(re, http.StatusNotFound)))
url = fmt.Sprintf("%s/region/key/%s", suite.urlPrefix, "a")
r2 := &response.RegionInfo{}
re.NoError(tu.ReadGetJSON(re, testDialClient, url, r2))
Expand Down

0 comments on commit 97ad20e

Please sign in to comment.