@@ -90,6 +90,38 @@ func (s *testClusterInfoSuite) TestStoreHeartbeat(c *C) {
90
90
}
91
91
}
92
92
93
+ func (s * testClusterInfoSuite ) TestFilterUnhealthyStore (c * C ) {
94
+ _ , opt , err := newTestScheduleConfig ()
95
+ c .Assert (err , IsNil )
96
+ cluster := newTestRaftCluster (mockid .NewIDAllocator (), opt , core .NewStorage (kv .NewMemoryKV ()), core .NewBasicCluster ())
97
+
98
+ stores := newTestStores (3 )
99
+ for _ , store := range stores {
100
+ storeStats := & pdpb.StoreStats {
101
+ StoreId : store .GetID (),
102
+ Capacity : 100 ,
103
+ Available : 50 ,
104
+ RegionCount : 1 ,
105
+ }
106
+ c .Assert (cluster .putStoreLocked (store ), IsNil )
107
+ c .Assert (cluster .HandleStoreHeartbeat (storeStats ), IsNil )
108
+ c .Assert (cluster .storesStats .GetRollingStoreStats (store .GetID ()), NotNil )
109
+ }
110
+
111
+ for _ , store := range stores {
112
+ storeStats := & pdpb.StoreStats {
113
+ StoreId : store .GetID (),
114
+ Capacity : 100 ,
115
+ Available : 50 ,
116
+ RegionCount : 1 ,
117
+ }
118
+ newStore := store .Clone (core .SetStoreState (metapb .StoreState_Tombstone ))
119
+ c .Assert (cluster .putStoreLocked (newStore ), IsNil )
120
+ c .Assert (cluster .HandleStoreHeartbeat (storeStats ), IsNil )
121
+ c .Assert (cluster .storesStats .GetRollingStoreStats (store .GetID ()), IsNil )
122
+ }
123
+ }
124
+
93
125
func (s * testClusterInfoSuite ) TestRegionHeartbeat (c * C ) {
94
126
_ , opt , err := newTestScheduleConfig ()
95
127
c .Assert (err , IsNil )
0 commit comments