diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py index fa0a090a..59e1683d 100644 --- a/nova/tests/access_unittest.py +++ b/nova/tests/access_unittest.py @@ -33,8 +33,6 @@ class Context(object): class AccessTestCase(test.BaseTestCase): def setUp(self): super(AccessTestCase, self).setUp() - FLAGS.connection_type = 'fake' - FLAGS.fake_storage = True um = manager.AuthManager() # Make test users try: diff --git a/nova/tests/auth_unittest.py b/nova/tests/auth_unittest.py index 59a81818..b54e6827 100644 --- a/nova/tests/auth_unittest.py +++ b/nova/tests/auth_unittest.py @@ -34,8 +34,7 @@ FLAGS = flags.FLAGS class AuthTestCase(test.BaseTestCase): def setUp(self): super(AuthTestCase, self).setUp() - self.flags(connection_type='fake', - fake_storage=True) + self.flags(connection_type='fake') self.manager = manager.AuthManager() def test_001_can_create_users(self): diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index e6796e3d..29947e03 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -39,8 +39,7 @@ FLAGS = flags.FLAGS class CloudTestCase(test.BaseTestCase): def setUp(self): super(CloudTestCase, self).setUp() - self.flags(connection_type='fake', - fake_storage=True) + self.flags(connection_type='fake') self.conn = rpc.Connection.instance() logging.getLogger().setLevel(logging.DEBUG) diff --git a/nova/tests/compute_unittest.py b/nova/tests/compute_unittest.py index 867b572f..07a2fceb 100644 --- a/nova/tests/compute_unittest.py +++ b/nova/tests/compute_unittest.py @@ -38,8 +38,7 @@ class ComputeTestCase(test.TrialTestCase): def setUp(self): # pylint: disable-msg=C0103 logging.getLogger().setLevel(logging.DEBUG) super(ComputeTestCase, self).setUp() - self.flags(connection_type='fake', - fake_storage=True) + self.flags(connection_type='fake') self.compute = utils.import_object(FLAGS.compute_manager) self.manager = manager.AuthManager() self.user = self.manager.create_user('fake', 'fake', 'fake') diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index 3114912b..8f475465 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -20,8 +20,8 @@ from nova import flags FLAGS = flags.FLAGS -flags.DECLARE('fake_storage', 'nova.volume.manager') -FLAGS.fake_storage = True +flags.DECLARE('volume_driver', 'nova.volume.manager') +FLAGS.volume_driver = 'nova.volume.driver.FakeAOEDriver' FLAGS.connection_type = 'fake' FLAGS.fake_rabbit = True FLAGS.auth_driver = 'nova.auth.ldapdriver.FakeLdapDriver' @@ -37,4 +37,3 @@ FLAGS.num_shelves = 2 FLAGS.blades_per_shelf = 4 FLAGS.verbose = True FLAGS.sql_connection = 'sqlite:///nova.sqlite' -#FLAGS.sql_connection = 'mysql://root@localhost/test' diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index 8e462b9d..a89f1d62 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -39,7 +39,6 @@ class NetworkTestCase(test.TrialTestCase): # NOTE(vish): if you change these flags, make sure to change the # flags in the corresponding section in nova-dhcpbridge self.flags(connection_type='fake', - fake_storage=True, fake_network=True, auth_driver='nova.auth.ldapdriver.FakeLdapDriver', network_size=16, diff --git a/nova/tests/real_flags.py b/nova/tests/real_flags.py index 121f4eb4..71da0499 100644 --- a/nova/tests/real_flags.py +++ b/nova/tests/real_flags.py @@ -21,7 +21,6 @@ from nova import flags FLAGS = flags.FLAGS FLAGS.connection_type = 'libvirt' -FLAGS.fake_storage = False FLAGS.fake_rabbit = False FLAGS.fake_network = False FLAGS.verbose = False diff --git a/nova/tests/service_unittest.py b/nova/tests/service_unittest.py index 590d760b..097a045e 100644 --- a/nova/tests/service_unittest.py +++ b/nova/tests/service_unittest.py @@ -47,9 +47,9 @@ class ServiceTestCase(test.BaseTestCase): self.mox.StubOutWithMock(service, 'db') def test_create(self): - host='foo' - binary='nova-fake' - topic='fake' + host = 'foo' + binary = 'nova-fake' + topic = 'fake' self.mox.StubOutWithMock(rpc, 'AdapterConsumer', use_mock_anything=True) @@ -75,19 +75,19 @@ class ServiceTestCase(test.BaseTestCase): rpc.AdapterConsumer.attach_to_twisted() rpc.AdapterConsumer.attach_to_twisted() service_create = {'host': host, - 'binary': binary, - 'topic': topic, - 'report_count': 0} + 'binary': binary, + 'topic': topic, + 'report_count': 0} service_ref = {'host': host, - 'binary': binary, - 'report_count': 0, - 'id': 1} + 'binary': binary, + 'report_count': 0, + 'id': 1} service.db.service_get_by_args(None, - host, - binary).AndRaise(exception.NotFound()) + host, + binary).AndRaise(exception.NotFound()) service.db.service_create(None, - service_create).AndReturn(service_ref['id']) + service_create).AndReturn(service_ref['id']) self.mox.ReplayAll() app = service.Service.create(host=host, binary=binary) @@ -101,15 +101,15 @@ class ServiceTestCase(test.BaseTestCase): host = 'foo' binary = 'bar' service_ref = {'host': host, - 'binary': binary, - 'report_count': 0, - 'id': 1} + 'binary': binary, + 'report_count': 0, + 'id': 1} service.db.__getattr__('report_state') service.db.service_get_by_args(None, - host, - binary).AndReturn(service_ref) + host, + binary).AndReturn(service_ref) service.db.service_update(None, service_ref['id'], - mox.ContainsKeyValue('report_count', 1)) + mox.ContainsKeyValue('report_count', 1)) self.mox.ReplayAll() s = service.Service() @@ -119,22 +119,22 @@ class ServiceTestCase(test.BaseTestCase): host = 'foo' binary = 'bar' service_create = {'host': host, - 'binary': binary, - 'report_count': 0} + 'binary': binary, + 'report_count': 0} service_ref = {'host': host, - 'binary': binary, - 'report_count': 0, - 'id': 1} + 'binary': binary, + 'report_count': 0, + 'id': 1} service.db.__getattr__('report_state') service.db.service_get_by_args(None, host, binary).AndRaise(exception.NotFound()) service.db.service_create(None, - service_create).AndReturn(service_ref['id']) + service_create).AndReturn(service_ref['id']) service.db.service_get(None, service_ref['id']).AndReturn(service_ref) service.db.service_update(None, service_ref['id'], - mox.ContainsKeyValue('report_count', 1)) + mox.ContainsKeyValue('report_count', 1)) self.mox.ReplayAll() s = service.Service() @@ -144,14 +144,14 @@ class ServiceTestCase(test.BaseTestCase): host = 'foo' binary = 'bar' service_ref = {'host': host, - 'binary': binary, - 'report_count': 0, - 'id': 1} + 'binary': binary, + 'report_count': 0, + 'id': 1} service.db.__getattr__('report_state') service.db.service_get_by_args(None, - host, - binary).AndRaise(Exception()) + host, + binary).AndRaise(Exception()) self.mox.ReplayAll() s = service.Service() @@ -163,16 +163,16 @@ class ServiceTestCase(test.BaseTestCase): host = 'foo' binary = 'bar' service_ref = {'host': host, - 'binary': binary, - 'report_count': 0, - 'id': 1} + 'binary': binary, + 'report_count': 0, + 'id': 1} service.db.__getattr__('report_state') service.db.service_get_by_args(None, - host, - binary).AndReturn(service_ref) + host, + binary).AndReturn(service_ref) service.db.service_update(None, service_ref['id'], - mox.ContainsKeyValue('report_count', 1)) + mox.ContainsKeyValue('report_count', 1)) self.mox.ReplayAll() s = service.Service() diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py deleted file mode 100644 index f400cd2f..00000000 --- a/nova/tests/storage_unittest.py +++ /dev/null @@ -1,115 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import logging - -from nova import exception -from nova import flags -from nova import test -from nova.compute import node -from nova.volume import storage - - -FLAGS = flags.FLAGS - - -class StorageTestCase(test.TrialTestCase): - def setUp(self): - logging.getLogger().setLevel(logging.DEBUG) - super(StorageTestCase, self).setUp() - self.mynode = node.Node() - self.mystorage = None - self.flags(connection_type='fake', - fake_storage=True) - self.mystorage = storage.BlockStore() - - def test_run_create_volume(self): - vol_size = '0' - user_id = 'fake' - project_id = 'fake' - volume_id = self.mystorage.create_volume(vol_size, user_id, project_id) - # TODO(termie): get_volume returns differently than create_volume - self.assertEqual(volume_id, - storage.get_volume(volume_id)['volume_id']) - - rv = self.mystorage.delete_volume(volume_id) - self.assertRaises(exception.Error, - storage.get_volume, - volume_id) - - def test_too_big_volume(self): - vol_size = '1001' - user_id = 'fake' - project_id = 'fake' - self.assertRaises(TypeError, - self.mystorage.create_volume, - vol_size, user_id, project_id) - - def test_too_many_volumes(self): - vol_size = '1' - user_id = 'fake' - project_id = 'fake' - num_shelves = FLAGS.last_shelf_id - FLAGS.first_shelf_id + 1 - total_slots = FLAGS.slots_per_shelf * num_shelves - vols = [] - for i in xrange(total_slots): - vid = self.mystorage.create_volume(vol_size, user_id, project_id) - vols.append(vid) - self.assertRaises(storage.NoMoreVolumes, - self.mystorage.create_volume, - vol_size, user_id, project_id) - for id in vols: - self.mystorage.delete_volume(id) - - def test_run_attach_detach_volume(self): - # Create one volume and one node to test with - instance_id = "storage-test" - vol_size = "5" - user_id = "fake" - project_id = 'fake' - mountpoint = "/dev/sdf" - volume_id = self.mystorage.create_volume(vol_size, user_id, project_id) - - volume_obj = storage.get_volume(volume_id) - volume_obj.start_attach(instance_id, mountpoint) - rv = yield self.mynode.attach_volume(volume_id, - instance_id, - mountpoint) - self.assertEqual(volume_obj['status'], "in-use") - self.assertEqual(volume_obj['attachStatus'], "attached") - self.assertEqual(volume_obj['instance_id'], instance_id) - self.assertEqual(volume_obj['mountpoint'], mountpoint) - - self.assertRaises(exception.Error, - self.mystorage.delete_volume, - volume_id) - - rv = yield self.mystorage.detach_volume(volume_id) - volume_obj = storage.get_volume(volume_id) - self.assertEqual(volume_obj['status'], "available") - - rv = self.mystorage.delete_volume(volume_id) - self.assertRaises(exception.Error, - storage.get_volume, - volume_id) - - def test_multi_node(self): - # TODO(termie): Figure out how to test with two nodes, - # each of them having a different FLAG for storage_node - # This will allow us to test cross-node interactions - pass diff --git a/nova/tests/volume_unittest.py b/nova/tests/volume_unittest.py index 0df0c20d..99b22870 100644 --- a/nova/tests/volume_unittest.py +++ b/nova/tests/volume_unittest.py @@ -37,8 +37,7 @@ class VolumeTestCase(test.TrialTestCase): logging.getLogger().setLevel(logging.DEBUG) super(VolumeTestCase, self).setUp() self.compute = utils.import_object(FLAGS.compute_manager) - self.flags(connection_type='fake', - fake_storage=True) + self.flags(connection_type='fake') self.volume = utils.import_object(FLAGS.volume_manager) self.context = None