Пример #1
0
    def setUp(self):
        def fake_get_nw_info(cls, ctxt, instance):
            self.assertTrue(ctxt.is_admin)
            return fake_network.fake_get_instance_nw_info(self, 1, 1)

        super(UsageInfoTestCase, self).setUp()
        self.stub_out('nova.network.api.get_instance_nw_info',
                      fake_get_nw_info)

        fake_notifier.stub_notifier(self)
        self.addCleanup(fake_notifier.reset)

        self.flags(compute_driver='fake.FakeDriver',
                   network_manager='nova.network.manager.FlatManager')
        self.compute = manager.ComputeManager()
        self.user_id = 'fake'
        self.project_id = 'fake'
        self.context = context.RequestContext(self.user_id, self.project_id)

        def fake_show(meh, context, id, **kwargs):
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.flags(group='glance', api_servers=['http://localhost:9292'])
        self.stub_out('nova.tests.unit.image.fake._FakeImageService.show',
                      fake_show)
        fake_network.set_stub_network_methods(self)
        fake_server_actions.stub_out_action_events(self)
Пример #2
0
    def setUp(self):
        def fake_get_nw_info(cls, ctxt, instance):
            self.assertTrue(ctxt.is_admin)
            return fake_network.fake_get_instance_nw_info(self.stubs, 1, 1)

        super(UsageInfoTestCase, self).setUp()
        self.stubs.Set(network_api.API, 'get_instance_nw_info',
                       fake_get_nw_info)

        fake_notifier.stub_notifier(self.stubs)
        self.addCleanup(fake_notifier.reset)

        self.flags(use_local=True, group='conductor')
        self.flags(compute_driver='nova.virt.fake.FakeDriver',
                   network_manager='nova.network.manager.FlatManager')
        self.compute = importutils.import_object(CONF.compute_manager)
        self.user_id = 'fake'
        self.project_id = 'fake'
        self.context = context.RequestContext(self.user_id, self.project_id)

        def fake_show(meh, context, id, **kwargs):
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.stubs.Set(nova.tests.unit.image.fake._FakeImageService, 'show',
                       fake_show)
        fake_network.set_stub_network_methods(self.stubs)
        fake_server_actions.stub_out_action_events(self.stubs)
Пример #3
0
    def setUp(self):
        def fake_get_nw_info(cls, ctxt, instance):
            self.assertTrue(ctxt.is_admin)
            return fake_network.fake_get_instance_nw_info(self, 1, 1)

        super(UsageInfoTestCase, self).setUp()
        self.stubs.Set(network_api.API, 'get_instance_nw_info',
                       fake_get_nw_info)

        fake_notifier.stub_notifier(self)
        self.addCleanup(fake_notifier.reset)

        self.flags(use_local=True, group='conductor')
        self.flags(compute_driver='fake.FakeDriver',
                   network_manager='nova.network.manager.FlatManager')
        self.compute = importutils.import_object(CONF.compute_manager)
        self.user_id = 'fake'
        self.project_id = 'fake'
        self.context = context.RequestContext(self.user_id, self.project_id)

        def fake_show(meh, context, id, **kwargs):
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.flags(group='glance', api_servers=['http://localhost:9292'])
        self.stubs.Set(nova.tests.unit.image.fake._FakeImageService,
                       'show', fake_show)
        fake_network.set_stub_network_methods(self)
        fake_server_actions.stub_out_action_events(self.stubs)
Пример #4
0
 def setUp(self, mock_init_agg, mock_init_inst):
     super(SchedulerManagerTestCase, self).setUp()
     self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self)
Пример #5
0
 def setUp(self):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(scheduler_driver=self.driver_cls_name)
     self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self.stubs)
Пример #6
0
 def setUp(self, mock_init_agg, mock_init_inst):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(scheduler_driver=self.driver_plugin_name)
     with mock.patch.object(host_manager.HostManager, '_init_aggregates'):
         self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self.stubs)
Пример #7
0
 def setUp(self, mock_init_agg, mock_init_inst):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(driver=self.driver_plugin_name, group='scheduler')
     with mock.patch.object(host_manager.HostManager, '_init_aggregates'):
         self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self)
Пример #8
0
 def setUp(self):
     super(ComputeManagerTestCase, self).setUp()
     self.useFixture(fixtures.SpawnIsSynchronousFixture())
     self.useFixture(cast_as_call.CastAsCall(self))
     self.conductor = self.start_service('conductor')
     self.start_service('scheduler')
     self.compute = self.start_service('compute')
     self.context = context.RequestContext('fake', 'fake')
     fake_server_actions.stub_out_action_events(self)
     fake_network.set_stub_network_methods(self)
 def setUp(self):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(scheduler_driver=self.driver_cls_name)
     self.stubs.Set(compute_api, 'API', fakes.FakeComputeAPI)
     self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self.stubs)
 def setUp(self):
     super(ComputeManagerTestCase, self).setUp()
     self.useFixture(nova_fixtures.SpawnIsSynchronousFixture())
     self.useFixture(cast_as_call.CastAsCall(self))
     self.conductor = self.start_service('conductor')
     self.start_service('scheduler')
     self.compute = self.start_service('compute')
     self.context = context.RequestContext('fake', 'fake')
     fake_server_actions.stub_out_action_events(self)
     fake_network.set_stub_network_methods(self)
     self.useFixture(fixtures.MockPatch(
         'nova.network.neutron.API.get_instance_nw_info',
         return_value=network_model.NetworkInfo(),
     ))
Пример #11
0
    def setUp(self):
        def fake_get_nw_info(cls, ctxt, instance):
            self.assertTrue(ctxt.is_admin)
            return fake_network.fake_get_instance_nw_info(self.stubs, 1, 1)

        super(UsageInfoTestCase, self).setUp()
        self.stubs.Set(network_api.API, "get_instance_nw_info", fake_get_nw_info)

        fake_notifier.stub_notifier(self.stubs)
        self.addCleanup(fake_notifier.reset)

        self.flags(use_local=True, group="conductor")
        self.flags(compute_driver="nova.virt.fake.FakeDriver", network_manager="nova.network.manager.FlatManager")
        self.compute = importutils.import_object(CONF.compute_manager)
        self.user_id = "fake"
        self.project_id = "fake"
        self.context = context.RequestContext(self.user_id, self.project_id)

        def fake_show(meh, context, id, **kwargs):
            return {"id": 1, "properties": {"kernel_id": 1, "ramdisk_id": 1}}

        self.stubs.Set(nova.tests.unit.image.fake._FakeImageService, "show", fake_show)
        fake_network.set_stub_network_methods(self.stubs)
        fake_server_actions.stub_out_action_events(self.stubs)