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 the final pass at moving test cases over to the database lacking version. Change-Id: Iba5ec1f5c0a5724f01779eb5b0f164c4e232632a Closes-Bug: 1227473
This commit is contained in:
parent
bdbcdd869d
commit
cc3510cf5a
|
@ -23,7 +23,7 @@ from nova import test
|
||||||
from nova.tests.cells import fakes
|
from nova.tests.cells import fakes
|
||||||
|
|
||||||
|
|
||||||
class FiltersTestCase(test.TestCase):
|
class FiltersTestCase(test.NoDBTestCase):
|
||||||
"""Makes sure the proper filters are in the directory."""
|
"""Makes sure the proper filters are in the directory."""
|
||||||
|
|
||||||
def test_all_filters(self):
|
def test_all_filters(self):
|
||||||
|
@ -32,7 +32,7 @@ class FiltersTestCase(test.TestCase):
|
||||||
self.assertIn("TargetCellFilter", class_names)
|
self.assertIn("TargetCellFilter", class_names)
|
||||||
|
|
||||||
|
|
||||||
class _FilterTestClass(test.TestCase):
|
class _FilterTestClass(test.NoDBTestCase):
|
||||||
"""Base class for testing individual filter plugins."""
|
"""Base class for testing individual filter plugins."""
|
||||||
filter_cls_name = None
|
filter_cls_name = None
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ FAKE_TASK_LOGS = [dict(id=1, host='host1'),
|
||||||
dict(id=2, host='host2')]
|
dict(id=2, host='host2')]
|
||||||
|
|
||||||
|
|
||||||
class CellsManagerClassTestCase(test.TestCase):
|
class CellsManagerClassTestCase(test.NoDBTestCase):
|
||||||
"""Test case for CellsManager class."""
|
"""Test case for CellsManager class."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -33,7 +33,7 @@ CONF.import_opt('rpc_driver_queue_base', 'nova.cells.rpc_driver',
|
||||||
group='cells')
|
group='cells')
|
||||||
|
|
||||||
|
|
||||||
class CellsRPCDriverTestCase(test.TestCase):
|
class CellsRPCDriverTestCase(test.NoDBTestCase):
|
||||||
"""Test case for Cells communication via RPC."""
|
"""Test case for Cells communication via RPC."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -221,7 +221,7 @@ class CellsRPCDriverTestCase(test.TestCase):
|
||||||
self.assertTrue(call_info['process_called'])
|
self.assertTrue(call_info['process_called'])
|
||||||
|
|
||||||
|
|
||||||
class ParseTransportURLTestCase(test.TestCase):
|
class ParseTransportURLTestCase(test.NoDBTestCase):
|
||||||
def test_bad_scheme(self):
|
def test_bad_scheme(self):
|
||||||
url = "bad:///"
|
url = "bad:///"
|
||||||
self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
|
self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
|
||||||
|
@ -332,7 +332,7 @@ class ParseTransportURLTestCase(test.TestCase):
|
||||||
self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
|
self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
|
||||||
|
|
||||||
|
|
||||||
class UnparseTransportURLTestCase(test.TestCase):
|
class UnparseTransportURLTestCase(test.NoDBTestCase):
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
result = rpc_driver.unparse_transport_url({})
|
result = rpc_driver.unparse_transport_url({})
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ CONF = cfg.CONF
|
||||||
CONF.import_opt('topic', 'nova.cells.opts', group='cells')
|
CONF.import_opt('topic', 'nova.cells.opts', group='cells')
|
||||||
|
|
||||||
|
|
||||||
class CellsAPITestCase(test.TestCase):
|
class CellsAPITestCase(test.NoDBTestCase):
|
||||||
"""Test case for cells.api interfaces."""
|
"""Test case for cells.api interfaces."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -23,7 +23,7 @@ from nova import db
|
||||||
from nova import test
|
from nova import test
|
||||||
|
|
||||||
|
|
||||||
class CellsUtilsTestCase(test.TestCase):
|
class CellsUtilsTestCase(test.NoDBTestCase):
|
||||||
"""Test case for Cells utility methods."""
|
"""Test case for Cells utility methods."""
|
||||||
def test_get_instances_to_sync(self):
|
def test_get_instances_to_sync(self):
|
||||||
fake_context = 'fake_context'
|
fake_context = 'fake_context'
|
||||||
|
|
|
@ -58,7 +58,7 @@ def _get_fake_cells():
|
||||||
return [cell1, cell2, cell3, cell4]
|
return [cell1, cell2, cell3, cell4]
|
||||||
|
|
||||||
|
|
||||||
class CellsWeightsTestCase(test.TestCase):
|
class CellsWeightsTestCase(test.NoDBTestCase):
|
||||||
"""Makes sure the proper weighers are in the directory."""
|
"""Makes sure the proper weighers are in the directory."""
|
||||||
|
|
||||||
def test_all_weighers(self):
|
def test_all_weighers(self):
|
||||||
|
@ -70,7 +70,7 @@ class CellsWeightsTestCase(test.TestCase):
|
||||||
self.assert_('RamByInstanceTypeWeigher', class_names)
|
self.assert_('RamByInstanceTypeWeigher', class_names)
|
||||||
|
|
||||||
|
|
||||||
class _WeigherTestClass(test.TestCase):
|
class _WeigherTestClass(test.NoDBTestCase):
|
||||||
"""Base class for testing individual weigher plugins."""
|
"""Base class for testing individual weigher plugins."""
|
||||||
weigher_cls_name = None
|
weigher_cls_name = None
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ from nova import test
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
class CertRpcAPITestCase(test.TestCase):
|
class CertRpcAPITestCase(test.NoDBTestCase):
|
||||||
def _test_cert_api(self, method, **kwargs):
|
def _test_cert_api(self, method, **kwargs):
|
||||||
ctxt = context.RequestContext('fake_user', 'fake_project')
|
ctxt = context.RequestContext('fake_user', 'fake_project')
|
||||||
rpcapi = cert_rpcapi.CertAPI()
|
rpcapi = cert_rpcapi.CertAPI()
|
||||||
|
|
|
@ -40,7 +40,7 @@ class DummyTracker(object):
|
||||||
self.pci_tracker = pci_manager.PciDevTracker()
|
self.pci_tracker = pci_manager.PciDevTracker()
|
||||||
|
|
||||||
|
|
||||||
class ClaimTestCase(test.TestCase):
|
class ClaimTestCase(test.NoDBTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ClaimTestCase, self).setUp()
|
super(ClaimTestCase, self).setUp()
|
||||||
|
|
|
@ -23,7 +23,7 @@ from nova.compute import vm_states
|
||||||
from nova import test
|
from nova import test
|
||||||
|
|
||||||
|
|
||||||
class StatsTestCase(test.TestCase):
|
class StatsTestCase(test.NoDBTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(StatsTestCase, self).setUp()
|
super(StatsTestCase, self).setUp()
|
||||||
self.stats = stats.Stats()
|
self.stats = stats.Stats()
|
||||||
|
|
|
@ -24,7 +24,7 @@ from nova.virt import fake
|
||||||
from nova.virt import virtapi
|
from nova.virt import virtapi
|
||||||
|
|
||||||
|
|
||||||
class VirtAPIBaseTest(test.TestCase, test.APICoverage):
|
class VirtAPIBaseTest(test.NoDBTestCase, test.APICoverage):
|
||||||
|
|
||||||
cover_api = virtapi.VirtAPI
|
cover_api = virtapi.VirtAPI
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ from nova import test
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
|
|
||||||
|
|
||||||
class ComputeVMModeTest(test.TestCase):
|
class ComputeVMModeTest(test.NoDBTestCase):
|
||||||
|
|
||||||
def test_case(self):
|
def test_case(self):
|
||||||
inst = dict(vm_mode="HVM")
|
inst = dict(vm_mode="HVM")
|
||||||
|
|
|
@ -28,7 +28,7 @@ from nova import test
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
class ConsoleRpcAPITestCase(test.TestCase):
|
class ConsoleRpcAPITestCase(test.NoDBTestCase):
|
||||||
def _test_console_api(self, method, rpc_method, **kwargs):
|
def _test_console_api(self, method, rpc_method, **kwargs):
|
||||||
ctxt = context.RequestContext('fake_user', 'fake_project')
|
ctxt = context.RequestContext('fake_user', 'fake_project')
|
||||||
rpcapi = console_rpcapi.ConsoleAPI()
|
rpcapi = console_rpcapi.ConsoleAPI()
|
||||||
|
|
|
@ -24,7 +24,7 @@ from nova import test
|
||||||
import nova.tests.image.fake
|
import nova.tests.image.fake
|
||||||
|
|
||||||
|
|
||||||
class FakeImageServiceTestCase(test.TestCase):
|
class FakeImageServiceTestCase(test.NoDBTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FakeImageServiceTestCase, self).setUp()
|
super(FakeImageServiceTestCase, self).setUp()
|
||||||
self.image_service = nova.tests.image.fake.FakeImageService()
|
self.image_service = nova.tests.image.fake.FakeImageService()
|
||||||
|
|
|
@ -23,7 +23,7 @@ from nova.tests import fake_network_cache_model
|
||||||
from nova.virt import netutils
|
from nova.virt import netutils
|
||||||
|
|
||||||
|
|
||||||
class RouteTests(test.TestCase):
|
class RouteTests(test.NoDBTestCase):
|
||||||
def test_create_route_with_attrs(self):
|
def test_create_route_with_attrs(self):
|
||||||
route = fake_network_cache_model.new_route()
|
route = fake_network_cache_model.new_route()
|
||||||
ip = fake_network_cache_model.new_ip(dict(address='192.168.1.1'))
|
ip = fake_network_cache_model.new_ip(dict(address='192.168.1.1'))
|
||||||
|
@ -50,7 +50,7 @@ class RouteTests(test.TestCase):
|
||||||
self.assertEqual(route['interface'], None)
|
self.assertEqual(route['interface'], None)
|
||||||
|
|
||||||
|
|
||||||
class FixedIPTests(test.TestCase):
|
class FixedIPTests(test.NoDBTestCase):
|
||||||
def test_createnew_fixed_ip_with_attrs(self):
|
def test_createnew_fixed_ip_with_attrs(self):
|
||||||
fixed_ip = model.FixedIP(address='192.168.1.100')
|
fixed_ip = model.FixedIP(address='192.168.1.100')
|
||||||
self.assertEqual(fixed_ip['address'], '192.168.1.100')
|
self.assertEqual(fixed_ip['address'], '192.168.1.100')
|
||||||
|
@ -99,7 +99,7 @@ class FixedIPTests(test.TestCase):
|
||||||
self.assertEqual(fixed_ip['floating_ips'], ['192.168.1.101'])
|
self.assertEqual(fixed_ip['floating_ips'], ['192.168.1.101'])
|
||||||
|
|
||||||
|
|
||||||
class SubnetTests(test.TestCase):
|
class SubnetTests(test.NoDBTestCase):
|
||||||
def test_create_subnet_with_attrs(self):
|
def test_create_subnet_with_attrs(self):
|
||||||
subnet = fake_network_cache_model.new_subnet()
|
subnet = fake_network_cache_model.new_subnet()
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class SubnetTests(test.TestCase):
|
||||||
self.assertEqual(subnet['version'], 4)
|
self.assertEqual(subnet['version'], 4)
|
||||||
|
|
||||||
|
|
||||||
class NetworkTests(test.TestCase):
|
class NetworkTests(test.NoDBTestCase):
|
||||||
def test_create_network(self):
|
def test_create_network(self):
|
||||||
network = fake_network_cache_model.new_network()
|
network = fake_network_cache_model.new_network()
|
||||||
self.assertEqual(network['id'], 1)
|
self.assertEqual(network['id'], 1)
|
||||||
|
@ -250,7 +250,7 @@ class NetworkTests(test.TestCase):
|
||||||
dict(cidr='255.255.255.255'))])
|
dict(cidr='255.255.255.255'))])
|
||||||
|
|
||||||
|
|
||||||
class VIFTests(test.TestCase):
|
class VIFTests(test.NoDBTestCase):
|
||||||
def test_create_vif(self):
|
def test_create_vif(self):
|
||||||
vif = fake_network_cache_model.new_vif()
|
vif = fake_network_cache_model.new_vif()
|
||||||
self.assertEqual(vif['id'], 1)
|
self.assertEqual(vif['id'], 1)
|
||||||
|
@ -322,7 +322,7 @@ class VIFTests(test.TestCase):
|
||||||
fake_network_cache_model.new_network())
|
fake_network_cache_model.new_network())
|
||||||
|
|
||||||
|
|
||||||
class NetworkInfoTests(test.TestCase):
|
class NetworkInfoTests(test.NoDBTestCase):
|
||||||
def test_create_model(self):
|
def test_create_model(self):
|
||||||
ninfo = model.NetworkInfo([fake_network_cache_model.new_vif(),
|
ninfo = model.NetworkInfo([fake_network_cache_model.new_vif(),
|
||||||
fake_network_cache_model.new_vif(
|
fake_network_cache_model.new_vif(
|
||||||
|
|
|
@ -42,7 +42,7 @@ class FakeCinderClient(object):
|
||||||
self.volume_snapshots = self.volumes
|
self.volume_snapshots = self.volumes
|
||||||
|
|
||||||
|
|
||||||
class CinderApiTestCase(test.TestCase):
|
class CinderApiTestCase(test.NoDBTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CinderApiTestCase, self).setUp()
|
super(CinderApiTestCase, self).setUp()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue