From 9286ab42ab8a5892bd22c45525f0fa2f2113335c Mon Sep 17 00:00:00 2001 From: John Griffith Date: Mon, 25 Jul 2016 18:16:25 -0600 Subject: [PATCH] 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 --- cinder/tests/{unit => }/fake_driver.py | 0 cinder/tests/functional/test_volumes.py | 4 ++-- cinder/tests/unit/backup/test_backup.py | 8 ++++---- cinder/tests/unit/conf_fixture.py | 2 +- cinder/tests/unit/test_volume.py | 6 +++--- cinder/tests/unit/volume/drivers/test_lvm_driver.py | 2 +- cinder/tests/unit/zonemanager/test_volume_driver.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) rename cinder/tests/{unit => }/fake_driver.py (100%) diff --git a/cinder/tests/unit/fake_driver.py b/cinder/tests/fake_driver.py similarity index 100% rename from cinder/tests/unit/fake_driver.py rename to cinder/tests/fake_driver.py diff --git a/cinder/tests/functional/test_volumes.py b/cinder/tests/functional/test_volumes.py index 89031c1b81f..ae98d0582ba 100644 --- a/cinder/tests/functional/test_volumes.py +++ b/cinder/tests/functional/test_volumes.py @@ -15,9 +15,9 @@ import time +from cinder.tests import fake_driver from cinder.tests.functional.api import client from cinder.tests.functional import functional_helpers -from cinder.tests.unit import fake_driver class VolumesTest(functional_helpers._FunctionalTestBase): @@ -31,7 +31,7 @@ class VolumesTest(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(VolumesTest, self)._get_flags() f['volume_driver'] = \ - 'cinder.tests.unit.fake_driver.LoggingVolumeDriver' + 'cinder.tests.fake_driver.LoggingVolumeDriver' f['default_volume_type'] = self._vol_type_name return f diff --git a/cinder/tests/unit/backup/test_backup.py b/cinder/tests/unit/backup/test_backup.py index 7167803f5bc..0bdc3f30b13 100644 --- a/cinder/tests/unit/backup/test_backup.py +++ b/cinder/tests/unit/backup/test_backup.py @@ -35,8 +35,8 @@ from cinder import exception from cinder import objects from cinder.objects import fields 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 import fake_driver from cinder.tests.unit import utils from cinder.volume import driver @@ -205,11 +205,11 @@ class BaseBackupTest(test.TestCase): class BackupTestCase(BaseBackupTest): """Test Case for backups.""" - @mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver, + @mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver, 'set_initialized') - @mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver, + @mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver, 'do_setup') - @mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver, + @mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver, 'check_for_setup_error') @mock.patch('cinder.context.get_admin_context') def test_init_host(self, mock_get_admin_context, mock_check, mock_setup, diff --git a/cinder/tests/unit/conf_fixture.py b/cinder/tests/unit/conf_fixture.py index 7f101c5d65f..1502a58da32 100644 --- a/cinder/tests/unit/conf_fixture.py +++ b/cinder/tests/unit/conf_fixture.py @@ -35,7 +35,7 @@ def_vol_type = 'fake_vol_type' def set_defaults(conf): conf.set_default('default_volume_type', def_vol_type) 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('rpc_backend', 'cinder.openstack.common.rpc.impl_fake') conf.set_default('connection', 'sqlite://', group='database') diff --git a/cinder/tests/unit/test_volume.py b/cinder/tests/unit/test_volume.py index 5da6d6f27d8..2b225e8a6de 100644 --- a/cinder/tests/unit/test_volume.py +++ b/cinder/tests/unit/test_volume.py @@ -55,11 +55,11 @@ from cinder.objects import fields import cinder.policy from cinder import quota from cinder import test +from cinder.tests import fake_driver from cinder.tests.unit.api import fakes from cinder.tests.unit.brick import fake_lvm from cinder.tests.unit import conf_fixture 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_snapshot from cinder.tests.unit import fake_volume @@ -2165,7 +2165,7 @@ class VolumeTestCase(BaseVolumeTestCase): with mock.patch.object(cinder.volume.volume_types, '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: type_qos.return_value = dict(qos_specs=qos_values) driver_init.return_value = {'data': {}} @@ -5921,7 +5921,7 @@ class DriverTestCase(test.TestCase): class GenericVolumeDriverTestCase(DriverTestCase): """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('six.moves.builtins.open') diff --git a/cinder/tests/unit/volume/drivers/test_lvm_driver.py b/cinder/tests/unit/volume/drivers/test_lvm_driver.py index e63acfb9e52..2a57014ecd9 100644 --- a/cinder/tests/unit/volume/drivers/test_lvm_driver.py +++ b/cinder/tests/unit/volume/drivers/test_lvm_driver.py @@ -24,9 +24,9 @@ from cinder import db from cinder import exception from cinder import objects from cinder.objects import fields +from cinder.tests import fake_driver from cinder.tests.unit.brick import fake_lvm 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 fake_opt from cinder.tests.unit import utils as tests_utils diff --git a/cinder/tests/unit/zonemanager/test_volume_driver.py b/cinder/tests/unit/zonemanager/test_volume_driver.py index c8aa6c64c72..34dd1de20ea 100644 --- a/cinder/tests/unit/zonemanager/test_volume_driver.py +++ b/cinder/tests/unit/zonemanager/test_volume_driver.py @@ -22,7 +22,7 @@ import mock from cinder import test -from cinder.tests.unit import fake_driver +from cinder.tests import fake_driver from cinder import utils from cinder.volume import configuration as conf from cinder.zonemanager.drivers.brocade import brcd_fc_zone_driver