def setUp(self): super(BaseVolumeTestCase, self).setUp() self.extension_manager = extension.ExtensionManager( "BaseVolumeTestCase") vol_tmpdir = tempfile.mkdtemp() self.flags(volumes_dir=vol_tmpdir, notification_driver=["test"]) self.addCleanup(self._cleanup) self.volume = importutils.import_object(CONF.volume_manager) self.configuration = mock.Mock(conf.Configuration) self.context = context.get_admin_context() self.context.user_id = 'fake' # NOTE(mriedem): The id is hard-coded here for tracking race fail # assertions with the notification code, it's part of an # elastic-recheck query so don't remove it or change it. self.project_id = '7f265bd4-3a85-465e-a899-5dc4854a86d3' self.context.project_id = self.project_id self.volume_params = { 'status': 'creating', 'host': CONF.host, 'size': 1 } self.stubs.Set(brick_lvm.LVM, 'get_all_volume_groups', self.fake_get_all_volume_groups) fake_image.stub_out_image_service(self.stubs) self.stubs.Set(brick_lvm.LVM, '_vg_exists', lambda x: True) self.stubs.Set(os.path, 'exists', lambda x: True) self.volume.driver.set_initialized() self.volume.stats = {'allocated_capacity_gb': 0, 'pools': {}} # keep ordered record of what we execute self.called = []
def setUp(self): super(ManagedRBDTestCase, self).setUp() # TODO(dosaboy): need to remove dependency on mox stubs here once # image.fake has been converted to mock. fake_image.stub_out_image_service(self.stubs) self.volume.driver.set_initialized() self.volume.stats = {'allocated_capacity_gb': 0, 'pools': {}} self.called = []
def setUp(self): super(VolumeApiTest, self).setUp() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} fake_image.stub_out_image_service(self.stubs) self.controller = volumes.VolumeController(self.ext_mgr) self.stubs.Set(db, 'volume_get_all', stubs.stub_volume_get_all) self.stubs.Set(db, 'service_get_all_by_topic', stubs.stub_service_get_all_by_topic) self.stubs.Set(volume_api.API, 'delete', stubs.stub_volume_delete)
def setUp(self): super(VolumeApiTest, self).setUp() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} fake_image.stub_out_image_service(self.stubs) self.controller = volumes.VolumeController(self.ext_mgr) self.stubs.Set(db, 'volume_get_all', stubs.stub_volume_get_all) self.patch( 'cinder.db.service_get_all', autospec=True, return_value=stubs.stub_service_get_all(None)) self.stubs.Set(volume_api.API, 'delete', stubs.stub_volume_delete)
def setUp(self): super(VolumeApiTest, self).setUp() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} fake_image.stub_out_image_service(self.stubs) self.controller = volumes.VolumeController(self.ext_mgr) self.flags(host='fake', notification_driver=[fake_notifier.__name__]) self.stubs.Set(db, 'volume_get_all', stubs.stub_volume_get_all) self.stubs.Set(db, 'service_get_all_by_topic', stubs.stub_service_get_all_by_topic) self.stubs.Set(volume_api.API, 'delete', stubs.stub_volume_delete)
def setUp(self): super(VolumeApiTest, self).setUp() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} fake_image.stub_out_image_service(self.stubs) self.controller = volumes.VolumeController(self.ext_mgr) self.stubs.Set(db, 'volume_get_all', stubs.stub_volume_get_all) self.patch('cinder.db.service_get_all', autospec=True, return_value=stubs.stub_service_get_all(None)) self.stubs.Set(volume_api.API, 'delete', stubs.stub_volume_delete)