Convert TestCases to NoDBTestCase
NoDBTestCase is faster because it skips initializing a database for tests which don't actually talk to the database. Its also nicer because its more explicit about the dependancies of a given test. This is a first pass at moving test cases over to the database lacking version, but further work is required here. Change-Id: Ia28de4ebea4f354cba06bcdc66bb01d4b332943a Partial-Bug: 1227473
This commit is contained in:
parent
ded3bd149d
commit
e1f04d8ef1
|
@ -25,7 +25,7 @@ from nova import test
|
|||
from nova.tests import matchers
|
||||
|
||||
|
||||
class BlockDeviceMappingEc2CloudTestCase(test.TestCase):
|
||||
class BlockDeviceMappingEc2CloudTestCase(test.NoDBTestCase):
|
||||
"""Test Case for Block Device Mapping."""
|
||||
|
||||
def fake_ec2_vol_id_to_uuid(obj, ec2_id):
|
||||
|
|
|
@ -25,7 +25,7 @@ from nova import test
|
|||
from nova.tests import matchers
|
||||
|
||||
|
||||
class BlockDeviceTestCase(test.TestCase):
|
||||
class BlockDeviceTestCase(test.NoDBTestCase):
|
||||
def test_properties(self):
|
||||
root_device0 = '/dev/sda'
|
||||
root_device1 = '/dev/sdb'
|
||||
|
@ -130,7 +130,7 @@ class BlockDeviceTestCase(test.TestCase):
|
|||
_assert_volume_in_mapping('sdh1', False)
|
||||
|
||||
|
||||
class TestBlockDeviceDict(test.TestCase):
|
||||
class TestBlockDeviceDict(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(TestBlockDeviceDict, self).setUp()
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class FakeClientFactory(object):
|
|||
assert self.client.callstack[pos][2] == body
|
||||
|
||||
|
||||
class CinderTestCase(test.TestCase):
|
||||
class CinderTestCase(test.NoDBTestCase):
|
||||
"""Test case for cinder volume api."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -27,7 +27,7 @@ from nova import utils
|
|||
from nova.virt import configdrive
|
||||
|
||||
|
||||
class ConfigDriveTestCase(test.TestCase):
|
||||
class ConfigDriveTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_create_configdrive_iso(self):
|
||||
imagefile = None
|
||||
|
|
|
@ -18,7 +18,7 @@ from nova import context
|
|||
from nova import test
|
||||
|
||||
|
||||
class ContextTestCase(test.TestCase):
|
||||
class ContextTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_request_context_sets_is_admin(self):
|
||||
ctxt = context.RequestContext('111',
|
||||
|
|
|
@ -43,7 +43,7 @@ def bad_function_exception(self, context, extra, blah="a", boo="b", zoo=None):
|
|||
raise test.TestingException()
|
||||
|
||||
|
||||
class WrapExceptionTestCase(test.TestCase):
|
||||
class WrapExceptionTestCase(test.NoDBTestCase):
|
||||
def test_wrap_exception_good_return(self):
|
||||
wrapped = exception.wrap_exception('foo')
|
||||
self.assertEquals(99, wrapped(good_function)(1, 2))
|
||||
|
@ -60,7 +60,7 @@ class WrapExceptionTestCase(test.TestCase):
|
|||
self.assertTrue(key in notifier.provided_payload.keys())
|
||||
|
||||
|
||||
class NovaExceptionTestCase(test.TestCase):
|
||||
class NovaExceptionTestCase(test.NoDBTestCase):
|
||||
def test_default_error_msg(self):
|
||||
class FakeNovaException(exception.NovaException):
|
||||
msg_fmt = "default message"
|
||||
|
@ -139,7 +139,7 @@ class NovaExceptionTestCase(test.TestCase):
|
|||
self.assertEquals(exc.format_message(), "some message %(somearg)s")
|
||||
|
||||
|
||||
class ExceptionTestCase(test.TestCase):
|
||||
class ExceptionTestCase(test.NoDBTestCase):
|
||||
@staticmethod
|
||||
def _raise_exc(exc):
|
||||
raise exc()
|
||||
|
|
|
@ -61,7 +61,7 @@ class MockEntryPoint(object):
|
|||
return self.cls
|
||||
|
||||
|
||||
class HookTestCase(test.TestCase):
|
||||
class HookTestCase(test.NoDBTestCase):
|
||||
|
||||
def _mock_load_plugins(self, iload, iargs, ikwargs):
|
||||
return [
|
||||
|
|
|
@ -21,7 +21,7 @@ from nova.network import linux_net
|
|||
from nova import test
|
||||
|
||||
|
||||
class IptablesManagerTestCase(test.TestCase):
|
||||
class IptablesManagerTestCase(test.NoDBTestCase):
|
||||
|
||||
binary_name = linux_net.get_binary_name()
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from nova import ipv6
|
|||
from nova import test
|
||||
|
||||
|
||||
class IPv6RFC2462TestCase(test.TestCase):
|
||||
class IPv6RFC2462TestCase(test.NoDBTestCase):
|
||||
"""Unit tests for IPv6 rfc2462 backend operations."""
|
||||
def setUp(self):
|
||||
super(IPv6RFC2462TestCase, self).setUp()
|
||||
|
@ -55,7 +55,7 @@ class IPv6RFC2462TestCase(test.TestCase):
|
|||
bad_project)
|
||||
|
||||
|
||||
class IPv6AccountIdentiferTestCase(test.TestCase):
|
||||
class IPv6AccountIdentiferTestCase(test.NoDBTestCase):
|
||||
"""Unit tests for IPv6 account_identifier backend operations."""
|
||||
def setUp(self):
|
||||
super(IPv6AccountIdentiferTestCase, self).setUp()
|
||||
|
|
|
@ -27,7 +27,7 @@ LOG = logging.getLogger(__name__)
|
|||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class StorageLinuxSCSITestCase(test.TestCase):
|
||||
class StorageLinuxSCSITestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(StorageLinuxSCSITestCase, self).setUp()
|
||||
self.executes = []
|
||||
|
|
|
@ -20,7 +20,7 @@ from nova import test
|
|||
from nova.tests import fake_loadables
|
||||
|
||||
|
||||
class LoadablesTestCase(test.TestCase):
|
||||
class LoadablesTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(LoadablesTestCase, self).setUp()
|
||||
self.fake_loader = fake_loadables.FakeLoader()
|
||||
|
|
|
@ -22,7 +22,7 @@ from nova import manager
|
|||
from nova import test
|
||||
|
||||
|
||||
class ManagerTestCase(test.TestCase):
|
||||
class ManagerTestCase(test.NoDBTestCase):
|
||||
def test_additional_apis_for_dispatcher(self):
|
||||
class MyAPI(object):
|
||||
pass
|
||||
|
|
|
@ -46,7 +46,7 @@ os.makedirs(os.path.join(OSS_TEMPDIR, 'images'))
|
|||
os.makedirs(os.path.join(OSS_TEMPDIR, 'buckets'))
|
||||
|
||||
|
||||
class S3APITestCase(test.TestCase):
|
||||
class S3APITestCase(test.NoDBTestCase):
|
||||
"""Test objectstore through S3 API."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -29,7 +29,7 @@ from nova import test
|
|||
from nova import utils
|
||||
|
||||
|
||||
class PolicyFileTestCase(test.TestCase):
|
||||
class PolicyFileTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(PolicyFileTestCase, self).setUp()
|
||||
self.context = context.RequestContext('fake', 'fake')
|
||||
|
@ -59,7 +59,7 @@ class PolicyFileTestCase(test.TestCase):
|
|||
self.context, action, self.target)
|
||||
|
||||
|
||||
class PolicyTestCase(test.TestCase):
|
||||
class PolicyTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(PolicyTestCase, self).setUp()
|
||||
rules = {
|
||||
|
@ -147,7 +147,7 @@ class PolicyTestCase(test.TestCase):
|
|||
policy.enforce(admin_context, uppercase_action, self.target)
|
||||
|
||||
|
||||
class DefaultPolicyTestCase(test.TestCase):
|
||||
class DefaultPolicyTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(DefaultPolicyTestCase, self).setUp()
|
||||
|
@ -180,7 +180,7 @@ class DefaultPolicyTestCase(test.TestCase):
|
|||
self.context, "example:noexist", {})
|
||||
|
||||
|
||||
class IsAdminCheckTestCase(test.TestCase):
|
||||
class IsAdminCheckTestCase(test.NoDBTestCase):
|
||||
def test_init_true(self):
|
||||
check = policy.IsAdminCheck('is_admin', 'True')
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from nova import safe_utils
|
|||
from nova import test
|
||||
|
||||
|
||||
class GetCallArgsTestCase(test.TestCase):
|
||||
class GetCallArgsTestCase(test.NoDBTestCase):
|
||||
def _test_func(self, instance, red=None, blue=None):
|
||||
pass
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ from nova import utils
|
|||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class GetFromPathTestCase(test.TestCase):
|
||||
class GetFromPathTestCase(test.NoDBTestCase):
|
||||
def test_tolerates_nones(self):
|
||||
f = utils.get_from_path
|
||||
|
||||
|
@ -193,7 +193,7 @@ class GetFromPathTestCase(test.TestCase):
|
|||
self.assertEquals(['b_1'], f(input, "a/b"))
|
||||
|
||||
|
||||
class GetMyIP4AddressTestCase(test.TestCase):
|
||||
class GetMyIP4AddressTestCase(test.NoDBTestCase):
|
||||
def test_get_my_ipv4_address_with_no_ipv4(self):
|
||||
response = """172.16.0.0/16 via 172.16.251.13 dev tun1
|
||||
172.16.251.1 via 172.16.251.13 dev tun1
|
||||
|
@ -279,7 +279,7 @@ default via 172.17.248.1 dev eth0 proto static
|
|||
self.assertEqual(address, '172.17.255.9')
|
||||
|
||||
|
||||
class GenericUtilsTestCase(test.TestCase):
|
||||
class GenericUtilsTestCase(test.NoDBTestCase):
|
||||
def test_parse_server_string(self):
|
||||
result = utils.parse_server_string('::1')
|
||||
self.assertEqual(('::1', ''), result)
|
||||
|
@ -467,7 +467,7 @@ class GenericUtilsTestCase(test.TestCase):
|
|||
"failure")
|
||||
|
||||
|
||||
class MonkeyPatchTestCase(test.TestCase):
|
||||
class MonkeyPatchTestCase(test.NoDBTestCase):
|
||||
"""Unit test for utils.monkey_patch()."""
|
||||
def setUp(self):
|
||||
super(MonkeyPatchTestCase, self).setUp()
|
||||
|
@ -512,7 +512,7 @@ class MonkeyPatchTestCase(test.TestCase):
|
|||
in nova.tests.monkey_patch_example.CALLED_FUNCTION)
|
||||
|
||||
|
||||
class MonkeyPatchDefaultTestCase(test.TestCase):
|
||||
class MonkeyPatchDefaultTestCase(test.NoDBTestCase):
|
||||
"""Unit test for default monkey_patch_modules value."""
|
||||
|
||||
def setUp(self):
|
||||
|
@ -535,7 +535,7 @@ class MonkeyPatchDefaultTestCase(test.TestCase):
|
|||
getattr(decorator_module, decorator_name[1])
|
||||
|
||||
|
||||
class AuditPeriodTest(test.TestCase):
|
||||
class AuditPeriodTest(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(AuditPeriodTest, self).setUp()
|
||||
|
@ -699,7 +699,7 @@ class AuditPeriodTest(test.TestCase):
|
|||
year=2011))
|
||||
|
||||
|
||||
class DiffDict(test.TestCase):
|
||||
class DiffDict(test.NoDBTestCase):
|
||||
"""Unit tests for diff_dict()."""
|
||||
|
||||
def test_no_change(self):
|
||||
|
@ -731,7 +731,7 @@ class DiffDict(test.TestCase):
|
|||
self.assertEqual(diff, dict(b=['-']))
|
||||
|
||||
|
||||
class MkfsTestCase(test.TestCase):
|
||||
class MkfsTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_mkfs(self):
|
||||
self.mox.StubOutWithMock(utils, 'execute')
|
||||
|
@ -758,7 +758,7 @@ class MkfsTestCase(test.TestCase):
|
|||
utils.mkfs('swap', '/my/swap/block/dev', 'swap-vol')
|
||||
|
||||
|
||||
class LastBytesTestCase(test.TestCase):
|
||||
class LastBytesTestCase(test.NoDBTestCase):
|
||||
"""Test the last_bytes() utility method."""
|
||||
|
||||
def setUp(self):
|
||||
|
@ -785,7 +785,7 @@ class LastBytesTestCase(test.TestCase):
|
|||
self.assertEqual((content, 0), utils.last_bytes(flo, 1000))
|
||||
|
||||
|
||||
class IntLikeTestCase(test.TestCase):
|
||||
class IntLikeTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_is_int_like(self):
|
||||
self.assertTrue(utils.is_int_like(1))
|
||||
|
@ -806,7 +806,7 @@ class IntLikeTestCase(test.TestCase):
|
|||
self.assertFalse(utils.is_int_like("a1"))
|
||||
|
||||
|
||||
class MetadataToDictTestCase(test.TestCase):
|
||||
class MetadataToDictTestCase(test.NoDBTestCase):
|
||||
def test_metadata_to_dict(self):
|
||||
self.assertEqual(utils.metadata_to_dict(
|
||||
[{'key': 'foo1', 'value': 'bar'},
|
||||
|
@ -827,7 +827,7 @@ class MetadataToDictTestCase(test.TestCase):
|
|||
self.assertEqual(utils.dict_to_metadata({}), [])
|
||||
|
||||
|
||||
class WrappedCodeTestCase(test.TestCase):
|
||||
class WrappedCodeTestCase(test.NoDBTestCase):
|
||||
"""Test the get_wrapped_function utility method."""
|
||||
|
||||
def _wrapper(self, function):
|
||||
|
@ -879,7 +879,7 @@ class WrappedCodeTestCase(test.TestCase):
|
|||
self.assertTrue('blue' in func_code.co_varnames)
|
||||
|
||||
|
||||
class StringLengthTestCase(test.TestCase):
|
||||
class StringLengthTestCase(test.NoDBTestCase):
|
||||
def test_check_string_length(self):
|
||||
self.assertIsNone(utils.check_string_length(
|
||||
'test', 'name', max_length=255))
|
||||
|
@ -894,7 +894,7 @@ class StringLengthTestCase(test.TestCase):
|
|||
'a' * 256, 'name', max_length=255)
|
||||
|
||||
|
||||
class ValidateIntegerTestCase(test.TestCase):
|
||||
class ValidateIntegerTestCase(test.NoDBTestCase):
|
||||
def test_valid_inputs(self):
|
||||
self.assertEquals(
|
||||
utils.validate_integer(42, "answer"), 42)
|
||||
|
@ -930,7 +930,7 @@ class ValidateIntegerTestCase(test.TestCase):
|
|||
max_value=54)
|
||||
|
||||
|
||||
class ValidateNeutronConfiguration(test.TestCase):
|
||||
class ValidateNeutronConfiguration(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(ValidateNeutronConfiguration, self).setUp()
|
||||
utils.reset_is_neutron()
|
||||
|
@ -948,7 +948,7 @@ class ValidateNeutronConfiguration(test.TestCase):
|
|||
self.assertTrue(utils.is_neutron())
|
||||
|
||||
|
||||
class AutoDiskConfigUtilTestCase(test.TestCase):
|
||||
class AutoDiskConfigUtilTestCase(test.NoDBTestCase):
|
||||
def test_is_auto_disk_config_disabled(self):
|
||||
self.assertTrue(utils.is_auto_disk_config_disabled("Disabled "))
|
||||
|
||||
|
@ -959,7 +959,7 @@ class AutoDiskConfigUtilTestCase(test.TestCase):
|
|||
self.assertFalse(utils.is_auto_disk_config_disabled("false"))
|
||||
|
||||
|
||||
class GetSystemMetadataFromImageTestCase(test.TestCase):
|
||||
class GetSystemMetadataFromImageTestCase(test.NoDBTestCase):
|
||||
def get_image(self):
|
||||
image_meta = {
|
||||
"id": "fake-image",
|
||||
|
@ -1030,7 +1030,7 @@ class GetSystemMetadataFromImageTestCase(test.TestCase):
|
|||
self.assertTrue(sys_key not in sys_meta)
|
||||
|
||||
|
||||
class GetImageFromSystemMetadataTestCase(test.TestCase):
|
||||
class GetImageFromSystemMetadataTestCase(test.NoDBTestCase):
|
||||
def get_system_metadata(self):
|
||||
sys_meta = {
|
||||
"image_min_ram": 1,
|
||||
|
|
|
@ -23,7 +23,7 @@ from nova import test
|
|||
from nova import version
|
||||
|
||||
|
||||
class VersionTestCase(test.TestCase):
|
||||
class VersionTestCase(test.NoDBTestCase):
|
||||
"""Test cases for Versions code."""
|
||||
|
||||
def test_version_string_with_package_is_good(self):
|
||||
|
|
|
@ -37,7 +37,7 @@ SSL_CERT_DIR = os.path.normpath(os.path.join(
|
|||
'ssl_cert'))
|
||||
|
||||
|
||||
class TestLoaderNothingExists(test.TestCase):
|
||||
class TestLoaderNothingExists(test.NoDBTestCase):
|
||||
"""Loader tests where os.path.exists always returns False."""
|
||||
|
||||
def setUp(self):
|
||||
|
@ -51,7 +51,7 @@ class TestLoaderNothingExists(test.TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestLoaderNormalFilesystem(test.TestCase):
|
||||
class TestLoaderNormalFilesystem(test.NoDBTestCase):
|
||||
"""Loader tests with normal filesystem (unmodified os.path module)."""
|
||||
|
||||
_paste_config = """
|
||||
|
@ -87,7 +87,7 @@ document_root = /tmp
|
|||
super(TestLoaderNormalFilesystem, self).tearDown()
|
||||
|
||||
|
||||
class TestWSGIServer(test.TestCase):
|
||||
class TestWSGIServer(test.NoDBTestCase):
|
||||
"""WSGI server tests."""
|
||||
|
||||
def test_no_app(self):
|
||||
|
@ -132,7 +132,7 @@ class TestWSGIServer(test.TestCase):
|
|||
server.wait()
|
||||
|
||||
|
||||
class TestWSGIServerWithSSL(test.TestCase):
|
||||
class TestWSGIServerWithSSL(test.NoDBTestCase):
|
||||
"""WSGI server with SSL tests."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -35,7 +35,7 @@ from nova.virt.baremetal import utils as bm_utils
|
|||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class BareMetalIPMITestCase(test.TestCase):
|
||||
class BareMetalIPMITestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BareMetalIPMITestCase, self).setUp()
|
||||
|
|
|
@ -126,7 +126,7 @@ class WorkerTestCase(bm_db_base.BMDBTestCase):
|
|||
self.mox.VerifyAll()
|
||||
|
||||
|
||||
class PhysicalWorkTestCase(test.TestCase):
|
||||
class PhysicalWorkTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(PhysicalWorkTestCase, self).setUp()
|
||||
|
||||
|
@ -223,7 +223,7 @@ class PhysicalWorkTestCase(test.TestCase):
|
|||
pxe_config_path, root_mb, swap_mb)
|
||||
|
||||
|
||||
class SwitchPxeConfigTestCase(test.TestCase):
|
||||
class SwitchPxeConfigTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(SwitchPxeConfigTestCase, self).setUp()
|
||||
(fd, self.fname) = tempfile.mkstemp()
|
||||
|
@ -242,7 +242,7 @@ class SwitchPxeConfigTestCase(test.TestCase):
|
|||
self.assertEqual(pxeconf, _PXECONF_BOOT)
|
||||
|
||||
|
||||
class OtherFunctionTestCase(test.TestCase):
|
||||
class OtherFunctionTestCase(test.NoDBTestCase):
|
||||
def test_get_dev(self):
|
||||
expected = '/dev/disk/by-path/ip-1.2.3.4:5678-iscsi-iqn.fake-lun-9'
|
||||
actual = bmdh.get_dev('1.2.3.4', 5678, 'iqn.fake', 9)
|
||||
|
|
|
@ -30,7 +30,7 @@ from nova.virt.baremetal import utils as bm_utils
|
|||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class BareMetalPduTestCase(test.TestCase):
|
||||
class BareMetalPduTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BareMetalPduTestCase, self).setUp()
|
||||
|
|
|
@ -25,7 +25,7 @@ from nova import test
|
|||
from nova.virt.baremetal import utils
|
||||
|
||||
|
||||
class BareMetalUtilsTestCase(test.TestCase):
|
||||
class BareMetalUtilsTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_random_alnum(self):
|
||||
s = utils.random_alnum(10)
|
||||
|
|
|
@ -127,7 +127,7 @@ def fake_show_tgtadm():
|
|||
return SHOW_OUTPUT
|
||||
|
||||
|
||||
class BareMetalVolumeTestCase(test.TestCase):
|
||||
class BareMetalVolumeTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BareMetalVolumeTestCase, self).setUp()
|
||||
|
|
|
@ -23,7 +23,7 @@ from nova import test
|
|||
from nova.virt.disk import api
|
||||
|
||||
|
||||
class APITestCase(test.TestCase):
|
||||
class APITestCase(test.NoDBTestCase):
|
||||
|
||||
def test_can_resize_need_fs_type_specified(self):
|
||||
# NOTE(mikal): Bug 1094373 saw a regression where we failed to
|
||||
|
|
|
@ -34,7 +34,7 @@ def _fake_trycmd_losetup_fails(*args, **kwards):
|
|||
return '', 'doh'
|
||||
|
||||
|
||||
class LoopTestCase(test.TestCase):
|
||||
class LoopTestCase(test.NoDBTestCase):
|
||||
def test_get_dev(self):
|
||||
tempdir = self.useFixture(fixtures.TempDir()).path
|
||||
l = loop.LoopMount(None, tempdir)
|
||||
|
|
|
@ -62,7 +62,7 @@ def _fake_noop(*args, **kwargs):
|
|||
return
|
||||
|
||||
|
||||
class NbdTestCase(test.TestCase):
|
||||
class NbdTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(NbdTestCase, self).setUp()
|
||||
self.stubs.Set(nbd.NbdMount, '_detect_nbd_devices',
|
||||
|
|
|
@ -35,7 +35,7 @@ class FakeResponse(object):
|
|||
return self._headers.get(key)
|
||||
|
||||
|
||||
class DockerHTTPClientTestCase(test.TestCase):
|
||||
class DockerHTTPClientTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_list_containers(self):
|
||||
mock_conn = self.mox.CreateMockAnything()
|
||||
|
|
|
@ -21,7 +21,7 @@ from nova import test
|
|||
from nova.virt.docker import hostinfo
|
||||
|
||||
|
||||
class HostInfoTestCase(test.TestCase):
|
||||
class HostInfoTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(HostInfoTestCase, self).setUp()
|
||||
|
|
|
@ -66,7 +66,7 @@ CONF = cfg.CONF
|
|||
CONF.import_opt('vswitch_name', 'nova.virt.hyperv.vif', 'hyperv')
|
||||
|
||||
|
||||
class HyperVAPITestCase(test.TestCase):
|
||||
class HyperVAPITestCase(test.NoDBTestCase):
|
||||
"""Unit tests for Hyper-V driver calls."""
|
||||
|
||||
def __init__(self, test_case_name):
|
||||
|
|
|
@ -22,7 +22,7 @@ from nova.virt.hyperv import networkutilsv2
|
|||
from nova.virt.hyperv import vmutils
|
||||
|
||||
|
||||
class NetworkUtilsV2TestCase(test.TestCase):
|
||||
class NetworkUtilsV2TestCase(test.NoDBTestCase):
|
||||
"""Unit tests for the Hyper-V NetworkUtilsV2 class."""
|
||||
|
||||
_FAKE_VSWITCH_NAME = "fake_vswitch_name"
|
||||
|
|
|
@ -23,7 +23,7 @@ from nova.virt.hyperv import vhdutils
|
|||
from nova.virt.hyperv import vmutils
|
||||
|
||||
|
||||
class VHDUtilsTestCase(test.TestCase):
|
||||
class VHDUtilsTestCase(test.NoDBTestCase):
|
||||
"""Unit tests for the Hyper-V VHDUtils class."""
|
||||
|
||||
_FAKE_VHD_PATH = "C:\\fake_path.vhdx"
|
||||
|
|
|
@ -22,7 +22,7 @@ from nova.virt.hyperv import constants
|
|||
from nova.virt.hyperv import vhdutilsv2
|
||||
|
||||
|
||||
class VHDUtilsV2TestCase(test.TestCase):
|
||||
class VHDUtilsV2TestCase(test.NoDBTestCase):
|
||||
"""Unit tests for the Hyper-V VHDUtilsV2 class."""
|
||||
|
||||
_FAKE_VHD_PATH = "C:\\fake_path.vhdx"
|
||||
|
|
|
@ -22,7 +22,7 @@ from nova import test
|
|||
from nova.virt.hyperv import vmutils
|
||||
|
||||
|
||||
class VMUtilsTestCase(test.TestCase):
|
||||
class VMUtilsTestCase(test.NoDBTestCase):
|
||||
"""Unit tests for the Hyper-V VMUtils class."""
|
||||
|
||||
_FAKE_VM_NAME = 'fake_vm'
|
||||
|
|
|
@ -21,7 +21,7 @@ from nova import test
|
|||
from nova.virt.hyperv import vmutilsv2
|
||||
|
||||
|
||||
class VMUtilsV2TestCase(test.TestCase):
|
||||
class VMUtilsV2TestCase(test.NoDBTestCase):
|
||||
"""Unit tests for the Hyper-V VMUtilsV2 class."""
|
||||
|
||||
_FAKE_VM_NAME = 'fake_vm'
|
||||
|
|
|
@ -18,7 +18,7 @@ from nova import test
|
|||
from nova.virt.libvirt import designer
|
||||
|
||||
|
||||
class DesignerTestCase(test.TestCase):
|
||||
class DesignerTestCase(test.NoDBTestCase):
|
||||
def test_set_vif_bandwidth_config_no_extra_specs(self):
|
||||
# Test whether test_set_vif_bandwidth_config_no_extra_specs fails when
|
||||
# its second parameter has no 'extra_specs' field.
|
||||
|
|
|
@ -61,7 +61,7 @@ def get_vm_xml(name="testname", uuid=None, source_type='file',
|
|||
'interface_type': interface_type}
|
||||
|
||||
|
||||
class FakeLibvirtTests(test.TestCase):
|
||||
class FakeLibvirtTests(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(FakeLibvirtTests, self).setUp()
|
||||
libvirt._reset()
|
||||
|
|
|
@ -23,7 +23,7 @@ from nova.virt import images
|
|||
from nova.virt.libvirt import utils as libvirt_utils
|
||||
|
||||
|
||||
class ImageUtilsTestCase(test.TestCase):
|
||||
class ImageUtilsTestCase(test.NoDBTestCase):
|
||||
def test_disk_type(self):
|
||||
# Seems like lvm detection
|
||||
# if its in /dev ??
|
||||
|
|
|
@ -150,7 +150,7 @@ class _ImageTestCase(object):
|
|||
'fallocate -n -l %s %s' % (self.SIZE, self.PATH)])
|
||||
|
||||
|
||||
class RawTestCase(_ImageTestCase, test.TestCase):
|
||||
class RawTestCase(_ImageTestCase, test.NoDBTestCase):
|
||||
|
||||
SIZE = 1024
|
||||
|
||||
|
@ -219,7 +219,7 @@ class RawTestCase(_ImageTestCase, test.TestCase):
|
|||
self.mox.VerifyAll()
|
||||
|
||||
|
||||
class Qcow2TestCase(_ImageTestCase, test.TestCase):
|
||||
class Qcow2TestCase(_ImageTestCase, test.NoDBTestCase):
|
||||
SIZE = 1024 * 1024 * 1024
|
||||
|
||||
def setUp(self):
|
||||
|
@ -344,7 +344,7 @@ class Qcow2TestCase(_ImageTestCase, test.TestCase):
|
|||
self.mox.VerifyAll()
|
||||
|
||||
|
||||
class LvmTestCase(_ImageTestCase, test.TestCase):
|
||||
class LvmTestCase(_ImageTestCase, test.NoDBTestCase):
|
||||
VG = 'FakeVG'
|
||||
TEMPLATE_SIZE = 512
|
||||
SIZE = 1024
|
||||
|
@ -496,7 +496,7 @@ class LvmTestCase(_ImageTestCase, test.TestCase):
|
|||
self.assertEqual(fake_processutils.fake_execute_get_log(), [])
|
||||
|
||||
|
||||
class RbdTestCase(_ImageTestCase, test.TestCase):
|
||||
class RbdTestCase(_ImageTestCase, test.NoDBTestCase):
|
||||
POOL = "FakePool"
|
||||
USER = "FakeUser"
|
||||
CONF = "FakeConf"
|
||||
|
@ -620,7 +620,7 @@ class RbdTestCase(_ImageTestCase, test.TestCase):
|
|||
self.assertEqual(fake_processutils.fake_execute_get_log(), [])
|
||||
|
||||
|
||||
class BackendTestCase(test.TestCase):
|
||||
class BackendTestCase(test.NoDBTestCase):
|
||||
INSTANCE = {'name': 'fake-instance',
|
||||
'uuid': uuidutils.generate_uuid()}
|
||||
NAME = 'fake-name.suffix'
|
||||
|
|
|
@ -53,7 +53,7 @@ def intercept_log_messages():
|
|||
mylog.logger.removeHandler(handler)
|
||||
|
||||
|
||||
class ImageCacheManagerTestCase(test.TestCase):
|
||||
class ImageCacheManagerTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ImageCacheManagerTestCase, self).setUp()
|
||||
|
@ -820,7 +820,7 @@ class ImageCacheManagerTestCase(test.TestCase):
|
|||
self.assertTrue(was['called'])
|
||||
|
||||
|
||||
class VerifyChecksumTestCase(test.TestCase):
|
||||
class VerifyChecksumTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VerifyChecksumTestCase, self).setUp()
|
||||
|
|
|
@ -21,7 +21,7 @@ from nova.tests import matchers
|
|||
from nova.virt.libvirt import config
|
||||
|
||||
|
||||
class LibvirtConfigBaseTest(test.TestCase):
|
||||
class LibvirtConfigBaseTest(test.NoDBTestCase):
|
||||
def assertXmlEqual(self, expectedXmlstr, actualXmlstr):
|
||||
self.assertThat(actualXmlstr, matchers.XMLMatches(expectedXmlstr))
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ from nova import utils
|
|||
from nova.virt.libvirt import utils as libvirt_utils
|
||||
|
||||
|
||||
class LibvirtUtilsTestCase(test.TestCase):
|
||||
class LibvirtUtilsTestCase(test.NoDBTestCase):
|
||||
def test_get_disk_type(self):
|
||||
path = "disk.config"
|
||||
example_output = """image: disk.config
|
||||
|
|
|
@ -32,7 +32,7 @@ from nova.virt.libvirt import volume
|
|||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class LibvirtVolumeTestCase(test.TestCase):
|
||||
class LibvirtVolumeTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LibvirtVolumeTestCase, self).setUp()
|
||||
|
|
|
@ -31,7 +31,7 @@ from nova.virt.vmwareapi import vmops
|
|||
from nova.virt.vmwareapi import vmware_images
|
||||
|
||||
|
||||
class ConfigDriveTestCase(test.TestCase):
|
||||
class ConfigDriveTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(ConfigDriveTestCase, self).setUp()
|
||||
self.context = context.RequestContext('fake', 'fake', is_admin=False)
|
||||
|
|
|
@ -54,7 +54,7 @@ class fake_vm_ref(object):
|
|||
self._type = 'VirtualMachine'
|
||||
|
||||
|
||||
class VMwareAPIConfTestCase(test.TestCase):
|
||||
class VMwareAPIConfTestCase(test.NoDBTestCase):
|
||||
"""Unit tests for VMWare API configurations."""
|
||||
def setUp(self):
|
||||
super(VMwareAPIConfTestCase, self).setUp()
|
||||
|
@ -105,7 +105,7 @@ class VMwareAPIConfTestCase(test.TestCase):
|
|||
self.assertEqual("https://www.example.com/sdk", url)
|
||||
|
||||
|
||||
class VMwareAPIVMTestCase(test.TestCase):
|
||||
class VMwareAPIVMTestCase(test.NoDBTestCase):
|
||||
"""Unit tests for Vmware API connection calls."""
|
||||
|
||||
def setUp(self):
|
||||
|
@ -829,7 +829,7 @@ class VMwareAPIVMTestCase(test.TestCase):
|
|||
self.conn.detach_volume(connection_info, self.instance, mount_point)
|
||||
|
||||
|
||||
class VMwareAPIHostTestCase(test.TestCase):
|
||||
class VMwareAPIHostTestCase(test.NoDBTestCase):
|
||||
"""Unit tests for Vmware API host calls."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -21,7 +21,7 @@ from nova.virt.vmwareapi import network_util
|
|||
from nova.virt.vmwareapi import vif
|
||||
|
||||
|
||||
class VMwareVifTestCase(test.TestCase):
|
||||
class VMwareVifTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(VMwareVifTestCase, self).setUp()
|
||||
self.flags(vlan_interface='vmnet0', group='vmware')
|
||||
|
|
|
@ -34,7 +34,7 @@ class fake_session(object):
|
|||
return self.ret
|
||||
|
||||
|
||||
class VMwareVMUtilTestCase(test.TestCase):
|
||||
class VMwareVMUtilTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(VMwareVMUtilTestCase, self).setUp()
|
||||
fake.reset()
|
||||
|
|
|
@ -21,7 +21,7 @@ from nova import utils
|
|||
from nova.virt.vmwareapi import vmops
|
||||
|
||||
|
||||
class VMwareVMOpsTestCase(test.TestCase):
|
||||
class VMwareVMOpsTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(VMwareVMOpsTestCase, self).setUp()
|
||||
subnet_4 = network_model.Subnet(cidr='192.168.0.1/24',
|
||||
|
|
|
@ -110,7 +110,7 @@ class MockEntryPoint(object):
|
|||
return another_fetcher
|
||||
|
||||
|
||||
class LookupTorrentURLTestCase(test.TestCase):
|
||||
class LookupTorrentURLTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(LookupTorrentURLTestCase, self).setUp()
|
||||
self.store = bittorrent.BittorrentStore()
|
||||
|
|
|
@ -22,7 +22,7 @@ from nova import test
|
|||
from nova.virt.xenapi.image import utils
|
||||
|
||||
|
||||
class GlanceImageTestCase(test.TestCase):
|
||||
class GlanceImageTestCase(test.NoDBTestCase):
|
||||
def _get_image(self):
|
||||
return utils.GlanceImage('context', 'href')
|
||||
|
||||
|
@ -100,7 +100,7 @@ class GlanceImageTestCase(test.TestCase):
|
|||
self.assertEquals('data', image.data())
|
||||
|
||||
|
||||
class RawImageTestCase(test.TestCase):
|
||||
class RawImageTestCase(test.NoDBTestCase):
|
||||
def test_get_size(self):
|
||||
glance_image = self.mox.CreateMock(utils.GlanceImage)
|
||||
glance_image.meta = {'size': '123'}
|
||||
|
@ -118,7 +118,7 @@ class RawImageTestCase(test.TestCase):
|
|||
self.assertEquals('result', raw_image.stream_to('file'))
|
||||
|
||||
|
||||
class TestIterableBasedFile(test.TestCase):
|
||||
class TestIterableBasedFile(test.NoDBTestCase):
|
||||
def test_constructor(self):
|
||||
class FakeIterable(object):
|
||||
def __iter__(_self):
|
||||
|
@ -169,7 +169,7 @@ class TestIterableBasedFile(test.TestCase):
|
|||
self.assertEquals('chunk2', the_file.read(100))
|
||||
|
||||
|
||||
class RawTGZTestCase(test.TestCase):
|
||||
class RawTGZTestCase(test.NoDBTestCase):
|
||||
def test_as_tarfile(self):
|
||||
image = utils.RawTGZImage(None)
|
||||
self.mox.StubOutWithMock(image, '_as_file')
|
||||
|
|
|
@ -30,7 +30,7 @@ def fake_context(result=None):
|
|||
yield result
|
||||
|
||||
|
||||
class TestDelegatingToCommand(test.TestCase):
|
||||
class TestDelegatingToCommand(test.NoDBTestCase):
|
||||
def test_upload_image_is_delegated_to_command(self):
|
||||
command = self.mox.CreateMock(vdi_through_dev.UploadToGlanceAsRawTgz)
|
||||
self.mox.StubOutWithMock(vdi_through_dev, 'UploadToGlanceAsRawTgz')
|
||||
|
@ -47,7 +47,7 @@ class TestDelegatingToCommand(test.TestCase):
|
|||
self.assertEquals('result', result)
|
||||
|
||||
|
||||
class TestUploadToGlanceAsRawTgz(test.TestCase):
|
||||
class TestUploadToGlanceAsRawTgz(test.NoDBTestCase):
|
||||
def test_upload_image(self):
|
||||
store = vdi_through_dev.UploadToGlanceAsRawTgz(
|
||||
'context', 'session', 'instance', ['vdi0', 'vdi1'], 'id')
|
||||
|
@ -138,7 +138,7 @@ class TestUploadToGlanceAsRawTgz(test.TestCase):
|
|||
self.assertEqual(('rfile', 'wfile'), result)
|
||||
|
||||
|
||||
class TestTarGzProducer(test.TestCase):
|
||||
class TestTarGzProducer(test.NoDBTestCase):
|
||||
def test_constructor(self):
|
||||
producer = vdi_through_dev.TarGzProducer('devpath', 'writefile',
|
||||
'100', 'fname')
|
||||
|
@ -184,7 +184,7 @@ class TestTarGzProducer(test.TestCase):
|
|||
producer.get_metadata())
|
||||
|
||||
|
||||
class TestUpdateGlanceImage(test.TestCase):
|
||||
class TestUpdateGlanceImage(test.NoDBTestCase):
|
||||
def test_start(self):
|
||||
consumer = vdi_through_dev.UpdateGlanceImage(
|
||||
'context', 'id', 'metadata', 'stream')
|
||||
|
|
Loading…
Reference in New Issue