Skip to content

Commit

Permalink
test collectAndClean()
Browse files Browse the repository at this point in the history
Signed-off-by: LLThomas <zs033@qq.com>
  • Loading branch information
LLThomas committed Jul 20, 2022
1 parent 731a17c commit b840ec2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/cluster/region_stat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@ func TestRegionState(t *testing.T) {
}),
),
}
cluster.GetBasicCluster().PutRegion(regions[0])

rsc.observe(regions)
re.Len(rsc.getRegionStateByType(regionStateDown), 1)
for i := 0; i < clearThreshold; i++ {
rsc.collectAndClean()
}
re.Len(rsc.getRegionStateByType(regionStateDown), 1)
cluster.GetBasicCluster().RemoveRegion(regions[0])
for i := 0; i < clearThreshold; i++ {
rsc.collectAndClean()
}
re.Len(rsc.getRegionStateByType(regionStateDown), 0)
}

// GetRegionStateByType gets the states of the region by types. The regions here need to be cloned, otherwise, it may cause data race problems.
Expand Down

0 comments on commit b840ec2

Please sign in to comment.