Ejemplo n.º 1
0
    def test_get_by_instance_uuid(self, mock_get_ig, get_by_uuid):
        fake_spec = fake_request_spec.fake_db_spec()
        get_by_uuid.return_value = fake_spec
        mock_get_ig.return_value = objects.InstanceGroup(name='fresh')

        req_obj = request_spec.RequestSpec.get_by_instance_uuid(
            self.context, fake_spec['instance_uuid'])

        self.assertEqual(1, req_obj.num_instances)
        self.assertEqual(['host2', 'host4'], req_obj.ignore_hosts)
        self.assertEqual('fake', req_obj.project_id)
        self.assertEqual({'hint': ['over-there']}, req_obj.scheduler_hints)
        self.assertEqual(['host1', 'host3'], req_obj.force_hosts)
        self.assertIsNone(req_obj.availability_zone)
        self.assertEqual(['node1', 'node2'], req_obj.force_nodes)
        self.assertIsInstance(req_obj.image, objects.ImageMeta)
        self.assertIsInstance(req_obj.numa_topology,
                              objects.InstanceNUMATopology)
        self.assertIsInstance(req_obj.pci_requests,
                              objects.InstancePCIRequests)
        self.assertIsInstance(req_obj.flavor, objects.Flavor)
        self.assertIsInstance(req_obj.retry, objects.SchedulerRetries)
        self.assertIsInstance(req_obj.limits, objects.SchedulerLimits)
        self.assertIsInstance(req_obj.instance_group, objects.InstanceGroup)
        self.assertEqual('fresh', req_obj.instance_group.name)
Ejemplo n.º 2
0
 def _create_spec(self):
     args = fake_request_spec.fake_db_spec()
     args.pop('id', None)
     self.instance_uuid = args['instance_uuid']
     request_spec.RequestSpec._from_db_object(self.context, self.spec_obj,
             self.spec_obj._create_in_db(self.context, args))
     return self.spec_obj
Ejemplo n.º 3
0
    def test_get_by_instance_uuid(self, mock_get_ig, get_by_uuid):
        fake_spec = fake_request_spec.fake_db_spec()
        get_by_uuid.return_value = fake_spec
        mock_get_ig.return_value = objects.InstanceGroup(name='fresh')

        req_obj = request_spec.RequestSpec.get_by_instance_uuid(self.context,
                fake_spec['instance_uuid'])

        self.assertEqual(1, req_obj.num_instances)
        self.assertEqual(['host2', 'host4'], req_obj.ignore_hosts)
        self.assertEqual('fake', req_obj.project_id)
        self.assertEqual({'hint': ['over-there']}, req_obj.scheduler_hints)
        self.assertEqual(['host1', 'host3'], req_obj.force_hosts)
        self.assertIsNone(req_obj.availability_zone)
        self.assertEqual(['node1', 'node2'], req_obj.force_nodes)
        self.assertIsInstance(req_obj.image, objects.ImageMeta)
        self.assertIsInstance(req_obj.numa_topology,
                objects.InstanceNUMATopology)
        self.assertIsInstance(req_obj.pci_requests,
                objects.InstancePCIRequests)
        self.assertIsInstance(req_obj.flavor, objects.Flavor)
        self.assertIsInstance(req_obj.retry, objects.SchedulerRetries)
        self.assertIsInstance(req_obj.limits, objects.SchedulerLimits)
        self.assertIsInstance(req_obj.instance_group, objects.InstanceGroup)
        self.assertEqual('fresh', req_obj.instance_group.name)
Ejemplo n.º 4
0
 def _create_spec(self):
     args = fake_request_spec.fake_db_spec()
     args.pop('id', None)
     self.instance_uuid = args['instance_uuid']
     request_spec.RequestSpec._from_db_object(self.context, self.spec_obj,
             self.spec_obj._create_in_db(self.context, args))
     return self.spec_obj
Ejemplo n.º 5
0
    def test_get_by_instance_uuid(self, get_by_uuid):
        fake_spec = fake_request_spec.fake_db_spec()
        get_by_uuid.return_value = fake_spec

        req_obj = request_spec.RequestSpec.get_by_instance_uuid(self.context, fake_spec["instance_uuid"])

        self.assertEqual(1, req_obj.num_instances)
        self.assertEqual(["host2", "host4"], req_obj.ignore_hosts)
        self.assertEqual("fake", req_obj.project_id)
        self.assertEqual({"hint": ["over-there"]}, req_obj.scheduler_hints)
        self.assertEqual(["host1", "host3"], req_obj.force_hosts)
        self.assertIsNone(req_obj.availability_zone)
        self.assertEqual(["node1", "node2"], req_obj.force_nodes)
        self.assertIsInstance(req_obj.image, objects.ImageMeta)
        self.assertIsInstance(req_obj.numa_topology, objects.InstanceNUMATopology)
        self.assertIsInstance(req_obj.pci_requests, objects.InstancePCIRequests)
        self.assertIsInstance(req_obj.flavor, objects.Flavor)
        self.assertIsInstance(req_obj.retry, objects.SchedulerRetries)
        self.assertIsInstance(req_obj.limits, objects.SchedulerLimits)
        self.assertIsInstance(req_obj.instance_group, objects.InstanceGroup)