def _verify_restart_instance(self, instance): """Restarts the instance, and verifies that the instance is actually able to start.""" self.info('%s instance.restart' % (instance, )) instance.restart() is_alive = False for i in fxrangemax(0.1, 1, 0.4, 30): self.info('%s pingWithTimeout: %s', instance, i) self.respond_to_ping() if self.insured(instance, instance.responds_to_ping, timeout=i): is_alive = True break if is_alive: self.info('%s successfully restarted' % (instance, )) else: self.info("%s instance doesn't respond after restart" % (instance, ))
def _verify_restart_instance(self, instance): """Restarts the instance, and verifies that the instance is actually able to start.""" self.info('%s instance.restart' % (instance, )) instance.restart() is_alive = False for i in fxrangemax(0.1, 1, 0.4, 30): self.info('%s pingWithTimeout: %s', instance, i) self.respond_to_ping() if self.insured(instance, instance.responds_to_ping, timeout=i): is_alive = True break if is_alive: self.info('%s successfully restarted' % (instance, )) else: self.info("%s instance doesn't respond after restart" % ( instance, ))
def test_fxrangemax(self): self.assertEqual( list(utils.fxrangemax(1.0, 3.0, 1.0, 30.0)), [1.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0]) self.assertEqual(list(utils.fxrangemax(1.0, None, 1.0, 30.0)), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
def test_fxrangemax(self): self.assertEqual(list(utils.fxrangemax(1.0, 3.0, 1.0, 30.0)), [1.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0]) self.assertEqual(list(utils.fxrangemax(1.0, None, 1.0, 30.0)), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])