Exemplo n.º 1
0
    def test_macs_for_instance_http_not_found(self):
        with mock.patch.object(FAKE_CLIENT.node, 'get') as mock_get:
            mock_get.side_effect = ironic_exception.HTTPNotFound()

            instance = fake_instance.fake_instance_obj(
                self.ctx, node=uuidutils.generate_uuid())
            result = self.driver.macs_for_instance(instance)
            self.assertEqual([], result)
Exemplo n.º 2
0
 def test_validate_instance_and_node_failed(self):
     icli = cw.IronicClientWrapper()
     with mock.patch.object(FAKE_CLIENT.node, 'get_by_instance_uuid') \
         as mock_gbiui:
         mock_gbiui.side_effect = ironic_exception.HTTPNotFound()
         instance_uuid = uuidutils.generate_uuid(),
         instance = fake_instance.fake_instance_obj(self.ctx,
                                                    uuid=instance_uuid)
         self.assertRaises(exception.InstanceNotFound,
                           ironic_driver.validate_instance_and_node, icli,
                           instance)
Exemplo n.º 3
0
    def test_get_info_http_not_found(self):
        with mock.patch.object(FAKE_CLIENT.node, 'get_by_instance_uuid') \
                as mock_gbiu:
            mock_gbiu.side_effect = ironic_exception.HTTPNotFound()

            expected = {
                'state': nova_states.NOSTATE,
                'max_mem': 0,
                'mem': 0,
                'num_cpu': 0,
                'cpu_time': 0
            }
            instance = fake_instance.fake_instance_obj(
                self.ctx, uuid=uuidutils.generate_uuid())
            result = self.driver.get_info(instance)
            self.assertEqual(expected, result)