func (s *CommonProvisionerSuite) waitHardwareCharacteristics(c *gc.C, m *state.Machine, check func() bool) { w := m.WatchHardwareCharacteristics() defer stop(c, w) timeout := time.After(coretesting.LongWait) resync := time.After(0) for { select { case <-w.Changes(): if check() { return } case <-resync: resync = time.After(coretesting.ShortWait) s.BackingState.StartSync() case <-timeout: c.Fatalf("hardware characteristics for machine %v wait timed out", m) } } }
func (s *CommonProvisionerSuite) waitHardwareCharacteristics(c *gc.C, m *state.Machine, check func() bool) { w := m.WatchHardwareCharacteristics() name := fmt.Sprintf("hardware characteristics for machine %v", m) s.waitForWatcher(c, w, name, check) }