Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: Cabinfever_B <[email protected]>

add test

Signed-off-by: Cabinfever_B <[email protected]>
  • Loading branch information
CabinfeverB committed Nov 28, 2023
1 parent dfc9499 commit 786e6d7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/server/region_syncer/region_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,15 @@ func TestRegionSyncer(t *testing.T) {
re.NoError(leaderServer.BootstrapCluster())
rc := leaderServer.GetServer().GetRaftCluster()
re.NotNil(rc)
followerServer := cluster.GetServer(cluster.GetFollower())

testutil.Eventually(re, func() bool {
follower := cluster.GetServer(cluster.GetFollower())
return !follower.GetServer().DirectlyGetRaftCluster().GetRegionSyncer().IsRunningAsClient()
return !followerServer.GetServer().DirectlyGetRaftCluster().GetRegionSyncer().IsRunningAsClient()
})
re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/syncer/disableClientStreaming"))
re.True(cluster.WaitRegionSyncerClientsReady(2))
testutil.Eventually(re, func() bool {
follower := cluster.GetServer(cluster.GetFollower())
return follower.GetServer().DirectlyGetRaftCluster().GetRegionSyncer().IsRunningAsClient()
return followerServer.GetServer().DirectlyGetRaftCluster().GetRegionSyncer().IsRunningAsClient()
})

regionLen := 110
Expand Down Expand Up @@ -133,7 +132,6 @@ func TestRegionSyncer(t *testing.T) {
time.Sleep(4 * time.Second)

// test All regions have been synchronized to the cache of followerServer
followerServer := cluster.GetServer(cluster.GetFollower())
re.NotNil(followerServer)
cacheRegions := leaderServer.GetServer().GetBasicCluster().GetRegions()
re.Len(cacheRegions, regionLen)
Expand All @@ -155,6 +153,9 @@ func TestRegionSyncer(t *testing.T) {
re.NoError(err)
cluster.WaitLeader()
leaderServer = cluster.GetLeaderServer()
testutil.Eventually(re, func() bool {
return !leaderServer.GetServer().GetRaftCluster().GetRegionSyncer().IsRunningAsClient()
})
re.NotNil(leaderServer)
loadRegions := leaderServer.GetServer().GetRaftCluster().GetRegions()
re.Len(loadRegions, regionLen)
Expand Down

0 comments on commit 786e6d7

Please sign in to comment.