Move fake_driver to tests root dir
The fake driver is now being used for both unit and functional tests. It also now has a FakeGate driver to add some things that aren't supported by all drivers (including the reference as well as ceph and others). This patch just moves the fake_driver.py file from tests/unit to tests as it's not specifically a unit test object. This isn't a big deal, but makes things a bit more clear and obvious that there's a useful fake that can be used in a number of places. Some of the other fakes could likely be moved as well, but this one is a start. Change-Id: Ia5e8608832c0753a4ced8690fa285184c5b8c0c1
This commit is contained in:
parent
aaf820f429
commit
9286ab42ab
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from cinder.tests import fake_driver
|
||||||
from cinder.tests.functional.api import client
|
from cinder.tests.functional.api import client
|
||||||
from cinder.tests.functional import functional_helpers
|
from cinder.tests.functional import functional_helpers
|
||||||
from cinder.tests.unit import fake_driver
|
|
||||||
|
|
||||||
|
|
||||||
class VolumesTest(functional_helpers._FunctionalTestBase):
|
class VolumesTest(functional_helpers._FunctionalTestBase):
|
||||||
@ -31,7 +31,7 @@ class VolumesTest(functional_helpers._FunctionalTestBase):
|
|||||||
def _get_flags(self):
|
def _get_flags(self):
|
||||||
f = super(VolumesTest, self)._get_flags()
|
f = super(VolumesTest, self)._get_flags()
|
||||||
f['volume_driver'] = \
|
f['volume_driver'] = \
|
||||||
'cinder.tests.unit.fake_driver.LoggingVolumeDriver'
|
'cinder.tests.fake_driver.LoggingVolumeDriver'
|
||||||
f['default_volume_type'] = self._vol_type_name
|
f['default_volume_type'] = self._vol_type_name
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ from cinder import exception
|
|||||||
from cinder import objects
|
from cinder import objects
|
||||||
from cinder.objects import fields
|
from cinder.objects import fields
|
||||||
from cinder import test
|
from cinder import test
|
||||||
|
from cinder.tests import fake_driver
|
||||||
from cinder.tests.unit.backup import fake_service_with_verify as fake_service
|
from cinder.tests.unit.backup import fake_service_with_verify as fake_service
|
||||||
from cinder.tests.unit import fake_driver
|
|
||||||
from cinder.tests.unit import utils
|
from cinder.tests.unit import utils
|
||||||
from cinder.volume import driver
|
from cinder.volume import driver
|
||||||
|
|
||||||
@ -205,11 +205,11 @@ class BaseBackupTest(test.TestCase):
|
|||||||
class BackupTestCase(BaseBackupTest):
|
class BackupTestCase(BaseBackupTest):
|
||||||
"""Test Case for backups."""
|
"""Test Case for backups."""
|
||||||
|
|
||||||
@mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver,
|
@mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver,
|
||||||
'set_initialized')
|
'set_initialized')
|
||||||
@mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver,
|
@mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver,
|
||||||
'do_setup')
|
'do_setup')
|
||||||
@mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver,
|
@mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver,
|
||||||
'check_for_setup_error')
|
'check_for_setup_error')
|
||||||
@mock.patch('cinder.context.get_admin_context')
|
@mock.patch('cinder.context.get_admin_context')
|
||||||
def test_init_host(self, mock_get_admin_context, mock_check, mock_setup,
|
def test_init_host(self, mock_get_admin_context, mock_check, mock_setup,
|
||||||
|
@ -35,7 +35,7 @@ def_vol_type = 'fake_vol_type'
|
|||||||
def set_defaults(conf):
|
def set_defaults(conf):
|
||||||
conf.set_default('default_volume_type', def_vol_type)
|
conf.set_default('default_volume_type', def_vol_type)
|
||||||
conf.set_default('volume_driver',
|
conf.set_default('volume_driver',
|
||||||
'cinder.tests.unit.fake_driver.FakeISCSIDriver')
|
'cinder.tests.fake_driver.FakeISCSIDriver')
|
||||||
conf.set_default('iscsi_helper', 'fake')
|
conf.set_default('iscsi_helper', 'fake')
|
||||||
conf.set_default('rpc_backend', 'cinder.openstack.common.rpc.impl_fake')
|
conf.set_default('rpc_backend', 'cinder.openstack.common.rpc.impl_fake')
|
||||||
conf.set_default('connection', 'sqlite://', group='database')
|
conf.set_default('connection', 'sqlite://', group='database')
|
||||||
|
@ -55,11 +55,11 @@ from cinder.objects import fields
|
|||||||
import cinder.policy
|
import cinder.policy
|
||||||
from cinder import quota
|
from cinder import quota
|
||||||
from cinder import test
|
from cinder import test
|
||||||
|
from cinder.tests import fake_driver
|
||||||
from cinder.tests.unit.api import fakes
|
from cinder.tests.unit.api import fakes
|
||||||
from cinder.tests.unit.brick import fake_lvm
|
from cinder.tests.unit.brick import fake_lvm
|
||||||
from cinder.tests.unit import conf_fixture
|
from cinder.tests.unit import conf_fixture
|
||||||
from cinder.tests.unit import fake_constants as fake
|
from cinder.tests.unit import fake_constants as fake
|
||||||
from cinder.tests.unit import fake_driver
|
|
||||||
from cinder.tests.unit import fake_service
|
from cinder.tests.unit import fake_service
|
||||||
from cinder.tests.unit import fake_snapshot
|
from cinder.tests.unit import fake_snapshot
|
||||||
from cinder.tests.unit import fake_volume
|
from cinder.tests.unit import fake_volume
|
||||||
@ -2165,7 +2165,7 @@ class VolumeTestCase(BaseVolumeTestCase):
|
|||||||
|
|
||||||
with mock.patch.object(cinder.volume.volume_types,
|
with mock.patch.object(cinder.volume.volume_types,
|
||||||
'get_volume_type_qos_specs') as type_qos, \
|
'get_volume_type_qos_specs') as type_qos, \
|
||||||
mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver,
|
mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver,
|
||||||
'initialize_connection') as driver_init:
|
'initialize_connection') as driver_init:
|
||||||
type_qos.return_value = dict(qos_specs=qos_values)
|
type_qos.return_value = dict(qos_specs=qos_values)
|
||||||
driver_init.return_value = {'data': {}}
|
driver_init.return_value = {'data': {}}
|
||||||
@ -5921,7 +5921,7 @@ class DriverTestCase(test.TestCase):
|
|||||||
|
|
||||||
class GenericVolumeDriverTestCase(DriverTestCase):
|
class GenericVolumeDriverTestCase(DriverTestCase):
|
||||||
"""Test case for VolumeDriver."""
|
"""Test case for VolumeDriver."""
|
||||||
driver_name = "cinder.tests.unit.fake_driver.LoggingVolumeDriver"
|
driver_name = "cinder.tests.fake_driver.LoggingVolumeDriver"
|
||||||
|
|
||||||
@mock.patch.object(utils, 'temporary_chown')
|
@mock.patch.object(utils, 'temporary_chown')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('six.moves.builtins.open')
|
||||||
|
@ -24,9 +24,9 @@ from cinder import db
|
|||||||
from cinder import exception
|
from cinder import exception
|
||||||
from cinder import objects
|
from cinder import objects
|
||||||
from cinder.objects import fields
|
from cinder.objects import fields
|
||||||
|
from cinder.tests import fake_driver
|
||||||
from cinder.tests.unit.brick import fake_lvm
|
from cinder.tests.unit.brick import fake_lvm
|
||||||
from cinder.tests.unit import fake_constants as fake
|
from cinder.tests.unit import fake_constants as fake
|
||||||
from cinder.tests.unit import fake_driver
|
|
||||||
from cinder.tests.unit.test_volume import DriverTestCase
|
from cinder.tests.unit.test_volume import DriverTestCase
|
||||||
from cinder.tests.unit.test_volume import fake_opt
|
from cinder.tests.unit.test_volume import fake_opt
|
||||||
from cinder.tests.unit import utils as tests_utils
|
from cinder.tests.unit import utils as tests_utils
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from cinder import test
|
from cinder import test
|
||||||
from cinder.tests.unit import fake_driver
|
from cinder.tests import fake_driver
|
||||||
from cinder import utils
|
from cinder import utils
|
||||||
from cinder.volume import configuration as conf
|
from cinder.volume import configuration as conf
|
||||||
from cinder.zonemanager.drivers.brocade import brcd_fc_zone_driver
|
from cinder.zonemanager.drivers.brocade import brcd_fc_zone_driver
|
||||||
|
Loading…
x
Reference in New Issue
Block a user