Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Oct 30, 2023
1 parent 24de00a commit 8d4c72d
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/integrations/mcs/scheduling/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,18 @@ func TestAdminRegionCache(t *testing.T) {
r3 := core.NewTestRegionInfo(30, 1, []byte("c"), []byte(""), core.SetRegionConfVer(100), core.SetRegionVersion(100))
tests.MustPutRegionInfo(re, cluster, r3)

s := cluster.GetSchedulingPrimaryServer()
re.Equal(3, s.GetCluster().GetRegionCount([]byte{}, []byte{}))
schedulingServer := cluster.GetSchedulingPrimaryServer()
re.Equal(3, schedulingServer.GetCluster().GetRegionCount([]byte{}, []byte{}))

addr := s.GetAddr()
addr := schedulingServer.GetAddr()
urlPrefix := fmt.Sprintf("%s/scheduling/api/v1/admin/cache/regions", addr)
err := testutil.CheckDelete(testDialClient, fmt.Sprintf("%s/%s", urlPrefix, "30"), testutil.StatusOK(re))
re.NoError(err)
re.Equal(2, s.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(2, schedulingServer.GetCluster().GetRegionCount([]byte{}, []byte{}))

err = testutil.CheckDelete(testDialClient, urlPrefix, testutil.StatusOK(re))
re.NoError(err)
re.Equal(0, s.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(0, schedulingServer.GetCluster().GetRegionCount([]byte{}, []byte{}))
}
env := tests.NewSchedulingTestEnvironment(t)
env.RunTestInAPIMode(checkAdminRegionCache)
Expand All @@ -258,18 +258,22 @@ func TestAdminRegionCacheForward(t *testing.T) {
r3 := core.NewTestRegionInfo(30, 1, []byte("c"), []byte(""), core.SetRegionConfVer(100), core.SetRegionVersion(100))
tests.MustPutRegionInfo(re, cluster, r3)

s := cluster.GetSchedulingPrimaryServer()
re.Equal(3, s.GetCluster().GetRegionCount([]byte{}, []byte{}))
apiServer := cluster.GetLeaderServer().GetServer()
schedulingServer := cluster.GetSchedulingPrimaryServer()
re.Equal(3, schedulingServer.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(3, apiServer.GetRaftCluster().GetRegionCount([]byte{}, []byte{}).Count)

addr := cluster.GetLeaderServer().GetAddr()
urlPrefix := fmt.Sprintf("%s/pd/api/v1/admin/cache/region", addr)
err := testutil.CheckDelete(testDialClient, fmt.Sprintf("%s/%s", urlPrefix, "30"), testutil.StatusOK(re))
re.NoError(err)
re.Equal(2, s.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(2, schedulingServer.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(2, apiServer.GetRaftCluster().GetRegionCount([]byte{}, []byte{}).Count)

err = testutil.CheckDelete(testDialClient, urlPrefix+"s", testutil.StatusOK(re))
re.NoError(err)
re.Equal(0, s.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(0, schedulingServer.GetCluster().GetRegionCount([]byte{}, []byte{}))
re.Equal(0, apiServer.GetRaftCluster().GetRegionCount([]byte{}, []byte{}).Count)
}
env := tests.NewSchedulingTestEnvironment(t)
env.RunTestInAPIMode(checkAdminRegionCache)
Expand Down

0 comments on commit 8d4c72d

Please sign in to comment.