Пример #1
0
 def test_provision_error_handler_no_worker(self, log_mock):
     exc = exception.NoFreeConductorWorker()
     conductor_utils.provisioning_error_handler(exc, self.node, "state-one", "state-two")
     self.node.save.assert_called_once_with()
     self.assertEqual("state-one", self.node.provision_state)
     self.assertEqual("state-two", self.node.target_provision_state)
     self.assertIn("No free conductor workers", self.node.last_error)
     self.assertTrue(log_mock.warning.called)
Пример #2
0
 def test_provision_error_handler_no_worker(self, log_mock):
     exc = exception.NoFreeConductorWorker()
     conductor_utils.provisioning_error_handler(exc, self.node, 'state-one',
                                                'state-two')
     self.node.save.assert_called_once_with()
     self.assertEqual('state-one', self.node.provision_state)
     self.assertEqual('state-two', self.node.target_provision_state)
     self.assertIn('No free conductor workers', self.node.last_error)
     self.assertTrue(log_mock.warning.called)
Пример #3
0
 def test_provision_error_handler_other_error(self, log_mock):
     exc = Exception('foo')
     conductor_utils.provisioning_error_handler(exc, self.node, 'state-one',
                                                'state-two')
     self.assertFalse(self.node.save.called)
     self.assertFalse(log_mock.warning.called)
Пример #4
0
 def test_provision_error_handler_other_error(self, log_mock):
     exc = Exception('foo')
     conductor_utils.provisioning_error_handler(exc, self.node, 'state-one',
                                                'state-two')
     self.assertFalse(self.node.save.called)
     self.assertFalse(log_mock.warning.called)