Пример #1
0
// waitUntilDead will block until the specified store is marked as dead.
func waitUntilDead(t *testing.T, mc *hlc.ManualClock, sp *StorePool, storeID roachpb.StoreID) {
	lastTime := time.Now()
	util.SucceedsSoon(t, func() error {
		curTime := time.Now()
		mc.Increment(curTime.UnixNano() - lastTime.UnixNano())
		lastTime = curTime

		sp.mu.RLock()
		defer sp.mu.RUnlock()
		store, ok := sp.stores[storeID]
		if !ok {
			t.Fatalf("store %s isn't in the pool's store list", storeID)
		}
		exitcode := store.dead

		if exitcode {
			return nil
		}
		return errors.New("store not marked as dead yet")
	})
}