Merge "Unit test consistency: DB base and utils prefix"
This commit is contained in:
commit
cbedc8268c
@ -26,14 +26,14 @@ import pecan
|
||||
import pecan.testing
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
|
||||
PATH_PREFIX = '/v1'
|
||||
|
||||
cfg.CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token')
|
||||
|
||||
|
||||
class BaseApiTest(base.DbTestCase):
|
||||
class BaseApiTest(db_base.DbTestCase):
|
||||
"""Pecan controller functional testing class.
|
||||
|
||||
Used for functional tests of Pecan controllers where you need to
|
||||
|
@ -24,7 +24,7 @@ from ironic.api.controllers.v1 import node as node_controller
|
||||
from ironic.api.controllers.v1 import port as port_controller
|
||||
from ironic.api.controllers.v1 import portgroup as portgroup_controller
|
||||
from ironic.drivers import base as drivers_base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
|
||||
ADMIN_TOKEN = '4562138218392831'
|
||||
MEMBER_TOKEN = '4562138218392832'
|
||||
@ -91,7 +91,7 @@ def remove_internal(values, internal):
|
||||
|
||||
|
||||
def node_post_data(**kw):
|
||||
node = utils.get_test_node(**kw)
|
||||
node = db_utils.get_test_node(**kw)
|
||||
# These values are not part of the API object
|
||||
node.pop('version')
|
||||
node.pop('conductor_affinity')
|
||||
@ -113,7 +113,7 @@ def node_post_data(**kw):
|
||||
|
||||
|
||||
def port_post_data(**kw):
|
||||
port = utils.get_test_port(**kw)
|
||||
port = db_utils.get_test_port(**kw)
|
||||
# These values are not part of the API object
|
||||
port.pop('version')
|
||||
port.pop('node_id')
|
||||
@ -125,7 +125,7 @@ def port_post_data(**kw):
|
||||
|
||||
|
||||
def chassis_post_data(**kw):
|
||||
chassis = utils.get_test_chassis(**kw)
|
||||
chassis = db_utils.get_test_chassis(**kw)
|
||||
# version is not part of the API object
|
||||
chassis.pop('version')
|
||||
internal = chassis_controller.ChassisPatchType.internal_attrs()
|
||||
@ -136,14 +136,14 @@ def post_get_test_node(**kw):
|
||||
# NOTE(lucasagomes): When creating a node via API (POST)
|
||||
# we have to use chassis_uuid
|
||||
node = node_post_data(**kw)
|
||||
chassis = utils.get_test_chassis()
|
||||
chassis = db_utils.get_test_chassis()
|
||||
node['chassis_uuid'] = kw.get('chassis_uuid', chassis['uuid'])
|
||||
return node
|
||||
|
||||
|
||||
def portgroup_post_data(**kw):
|
||||
"""Return a Portgroup object without internal attributes."""
|
||||
portgroup = utils.get_test_portgroup(**kw)
|
||||
portgroup = db_utils.get_test_portgroup(**kw)
|
||||
|
||||
# These values are not part of the API object
|
||||
portgroup.pop('version')
|
||||
@ -164,6 +164,6 @@ def portgroup_post_data(**kw):
|
||||
def post_get_test_portgroup(**kw):
|
||||
"""Return a Portgroup object with appropriate attributes."""
|
||||
portgroup = portgroup_post_data(**kw)
|
||||
node = utils.get_test_node()
|
||||
node = db_utils.get_test_node()
|
||||
portgroup['node_uuid'] = kw.get('node_uuid', node['uuid'])
|
||||
return portgroup
|
||||
|
@ -38,7 +38,7 @@ from ironic.objects import fields as obj_fields
|
||||
from ironic.tests import base
|
||||
from ironic.tests.unit.api import base as test_api_base
|
||||
from ironic.tests.unit.api import utils as apiutils
|
||||
from ironic.tests.unit.db import utils as dbutils
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
@ -46,8 +46,8 @@ from ironic.tests.unit.objects import utils as obj_utils
|
||||
# we have to use node_uuid and portgroup_uuid
|
||||
def post_get_test_port(**kw):
|
||||
port = apiutils.port_post_data(**kw)
|
||||
node = dbutils.get_test_node()
|
||||
portgroup = dbutils.get_test_portgroup()
|
||||
node = db_utils.get_test_node()
|
||||
portgroup = db_utils.get_test_portgroup()
|
||||
port['node_uuid'] = kw.get('node_uuid', node['uuid'])
|
||||
port['portgroup_uuid'] = kw.get('portgroup_uuid', portgroup['uuid'])
|
||||
return port
|
||||
|
@ -15,10 +15,10 @@ import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
from ironic.cmd import conductor
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
|
||||
|
||||
class ConductorStartTestCase(base.DbTestCase):
|
||||
class ConductorStartTestCase(db_base.DbTestCase):
|
||||
|
||||
@mock.patch.object(conductor, 'LOG', autospec=True)
|
||||
def test_warn_about_unsafe_shred_parameters_defaults(self, log_mock):
|
||||
|
@ -16,10 +16,10 @@
|
||||
# under the License.
|
||||
|
||||
from ironic.db import migration
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
|
||||
|
||||
class DbSyncTestCase(base.DbTestCase):
|
||||
class DbSyncTestCase(db_base.DbTestCase):
|
||||
|
||||
def test_upgrade_and_version(self):
|
||||
migration.upgrade('head')
|
||||
|
@ -34,7 +34,7 @@ from ironic import objects
|
||||
from ironic.objects import fields
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as tests_db_base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ CONF = cfg.CONF
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class StartStopTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
class StartStopTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test_start_registers_conductor(self):
|
||||
self.assertRaises(exception.ConductorNotFound,
|
||||
objects.Conductor.get_by_hostname,
|
||||
@ -273,8 +273,7 @@ class StartStopTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
self._start_service()
|
||||
|
||||
|
||||
class CheckInterfacesTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class CheckInterfacesTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test__check_enabled_interfaces_success(self):
|
||||
base_manager._check_enabled_interfaces()
|
||||
|
||||
@ -290,7 +289,7 @@ class CheckInterfacesTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
base_manager._check_enabled_interfaces()
|
||||
|
||||
|
||||
class KeepAliveTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
class KeepAliveTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test__conductor_service_record_keepalive(self):
|
||||
self._start_service()
|
||||
# avoid wasting time at the event.wait()
|
||||
@ -345,7 +344,7 @@ class ManagerSpawnWorkerTestCase(tests_base.TestCase):
|
||||
autospec=True)
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class RegisterInterfacesTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(RegisterInterfacesTestCase, self).setUp()
|
||||
self._start_service()
|
||||
@ -417,8 +416,7 @@ class RegisterInterfacesTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
self.assertFalse(reg_mock.called)
|
||||
|
||||
|
||||
class StartConsolesTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class StartConsolesTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
@mock.patch.object(notification_utils, 'emit_console_notification')
|
||||
def test__start_consoles(self, mock_notify):
|
||||
obj_utils.create_test_node(self.context,
|
||||
|
@ -49,8 +49,8 @@ from ironic.objects import base as obj_base
|
||||
from ironic.objects import fields as obj_fields
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as tests_db_base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -58,7 +58,7 @@ CONF = cfg.CONF
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class ChangeNodePowerStateTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
|
||||
def test_change_node_power_state_power_on(self):
|
||||
# Test change_node_power_state including integration with
|
||||
@ -442,8 +442,7 @@ class ChangeNodePowerStateTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class CreateNodeTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class CreateNodeTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test_create_node(self):
|
||||
node = obj_utils.get_test_node(self.context, driver='fake',
|
||||
extra={'test': 'one'})
|
||||
@ -474,8 +473,7 @@ class CreateNodeTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class UpdateNodeTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class UpdateNodeTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test_update_node(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake',
|
||||
extra={'test': 'one'})
|
||||
@ -619,8 +617,7 @@ class UpdateNodeTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class VendorPassthruTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class VendorPassthruTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
@mock.patch.object(task_manager.TaskManager, 'upgrade_lock')
|
||||
@mock.patch.object(task_manager.TaskManager, 'spawn_after')
|
||||
@ -1070,7 +1067,7 @@ class VendorPassthruTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
@mgr_utils.mock_record_keepalive
|
||||
@mock.patch.object(images, 'is_whole_disk_image')
|
||||
class ServiceDoNodeDeployTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test_do_node_deploy_invalid_state(self, mock_iwdi):
|
||||
mock_iwdi.return_value = False
|
||||
self._start_service()
|
||||
@ -1340,7 +1337,7 @@ class ServiceDoNodeDeployTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DoNodeDeployTearDownTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.deploy')
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.prepare')
|
||||
def test__do_node_deploy_driver_raises_prepare_error(self, mock_prepare,
|
||||
@ -1807,8 +1804,7 @@ class DoNodeDeployTearDownTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(DoNodeCleanTestCase, self).setUp()
|
||||
self.config(automated_clean=True, group='conductor')
|
||||
@ -2663,8 +2659,7 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DoNodeVerifyTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class DoNodeVerifyTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
@mock.patch('ironic.objects.node.NodeCorrectedPowerStateNotification')
|
||||
@mock.patch('ironic.drivers.modules.fake.FakePower.get_power_state')
|
||||
@mock.patch('ironic.drivers.modules.fake.FakePower.validate')
|
||||
@ -2763,10 +2758,10 @@ class DoNodeVerifyTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class MiscTestCase(mgr_utils.ServiceSetUpMixin, mgr_utils.CommonMixIn,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test__mapped_to_this_conductor(self):
|
||||
self._start_service()
|
||||
n = utils.get_test_node()
|
||||
n = db_utils.get_test_node()
|
||||
self.assertTrue(self.service._mapped_to_this_conductor(n['uuid'],
|
||||
'fake'))
|
||||
self.assertFalse(self.service._mapped_to_this_conductor(n['uuid'],
|
||||
@ -2855,7 +2850,7 @@ class MiscTestCase(mgr_utils.ServiceSetUpMixin, mgr_utils.CommonMixIn,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class ConsoleTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
class ConsoleTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test_set_console_mode_worker_pool_full(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
self._start_service()
|
||||
@ -3035,8 +3030,7 @@ class ConsoleTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DestroyNodeTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class DestroyNodeTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
def test_destroy_node(self):
|
||||
self._start_service()
|
||||
@ -3157,8 +3151,7 @@ class DestroyNodeTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class CreatePortTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class CreatePortTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
@mock.patch.object(conductor_utils, 'validate_port_physnet')
|
||||
def test_create_port(self, mock_validate):
|
||||
@ -3229,8 +3222,7 @@ class CreatePortTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class UpdatePortTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class UpdatePortTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
@mock.patch.object(conductor_utils, 'validate_port_physnet')
|
||||
@mock.patch.object(n_flat.FlatNetwork, 'port_changed', autospec=True)
|
||||
@ -3752,7 +3744,7 @@ class UpdatePortTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
@mock.patch.object(n_flat.FlatNetwork, 'validate', autospec=True)
|
||||
class VifTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
class VifTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VifTestCase, self).setUp()
|
||||
@ -3859,8 +3851,7 @@ class VifTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class UpdatePortgroupTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class UpdatePortgroupTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
@mock.patch.object(n_flat.FlatNetwork, 'portgroup_changed', autospec=True)
|
||||
@mock.patch.object(n_flat.FlatNetwork, 'validate', autospec=True)
|
||||
def test_update_portgroup(self, mock_val, mock_pc):
|
||||
@ -4012,7 +4003,7 @@ class UpdatePortgroupTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class RaidTestCases(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
class RaidTestCases(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
driver_name = 'fake'
|
||||
raid_interface = None
|
||||
@ -4118,7 +4109,7 @@ class RaidHardwareTypeTestCases(RaidTestCases):
|
||||
|
||||
|
||||
@mock.patch.object(conductor_utils, 'node_power_action')
|
||||
class ManagerDoSyncPowerStateTestCase(tests_db_base.DbTestCase):
|
||||
class ManagerDoSyncPowerStateTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(ManagerDoSyncPowerStateTestCase, self).setUp()
|
||||
self.service = manager.ConductorManager('hostname', 'test-topic')
|
||||
@ -4402,7 +4393,7 @@ class ManagerDoSyncPowerStateTestCase(tests_db_base.DbTestCase):
|
||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||
@mock.patch.object(dbapi.IMPL, 'get_nodeinfo_list')
|
||||
class ManagerSyncPowerStatesTestCase(mgr_utils.CommonMixIn,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(ManagerSyncPowerStatesTestCase, self).setUp()
|
||||
self.service = manager.ConductorManager('hostname', 'test-topic')
|
||||
@ -4632,7 +4623,7 @@ class ManagerSyncPowerStatesTestCase(mgr_utils.CommonMixIn,
|
||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||
@mock.patch.object(dbapi.IMPL, 'get_nodeinfo_list')
|
||||
class ManagerCheckDeployTimeoutsTestCase(mgr_utils.CommonMixIn,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(ManagerCheckDeployTimeoutsTestCase, self).setUp()
|
||||
self.config(deploy_callback_timeout=300, group='conductor')
|
||||
@ -4867,8 +4858,7 @@ class ManagerCheckDeployTimeoutsTestCase(mgr_utils.CommonMixIn,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class ManagerTestProperties(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class ManagerTestProperties(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ManagerTestProperties, self).setUp()
|
||||
@ -4980,7 +4970,7 @@ class ManagerTestProperties(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class ManagerTestHardwareTypeProperties(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
|
||||
def _check_hardware_type_properties(self, hardware_type, expected):
|
||||
self.config(enabled_hardware_types=[hardware_type])
|
||||
@ -4999,8 +4989,7 @@ class ManagerTestHardwareTypeProperties(mgr_utils.ServiceSetUpMixin,
|
||||
@mock.patch.object(task_manager, 'acquire')
|
||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||
@mock.patch.object(dbapi.IMPL, 'get_nodeinfo_list')
|
||||
class ManagerSyncLocalStateTestCase(mgr_utils.CommonMixIn,
|
||||
tests_db_base.DbTestCase):
|
||||
class ManagerSyncLocalStateTestCase(mgr_utils.CommonMixIn, db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ManagerSyncLocalStateTestCase, self).setUp()
|
||||
@ -5200,8 +5189,7 @@ class StoreConfigDriveTestCase(tests_base.TestCase):
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class NodeInspectHardware(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class NodeInspectHardware(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeInspect.inspect_hardware')
|
||||
def test_inspect_hardware_ok(self, mock_inspect):
|
||||
@ -5355,7 +5343,7 @@ class NodeInspectHardware(mgr_utils.ServiceSetUpMixin,
|
||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||
@mock.patch.object(dbapi.IMPL, 'get_nodeinfo_list')
|
||||
class ManagerCheckInspectTimeoutsTestCase(mgr_utils.CommonMixIn,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(ManagerCheckInspectTimeoutsTestCase, self).setUp()
|
||||
self.config(inspect_timeout=300, group='conductor')
|
||||
@ -5576,8 +5564,7 @@ class ManagerCheckInspectTimeoutsTestCase(mgr_utils.CommonMixIn,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DestroyPortTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class DestroyPortTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
def test_destroy_port(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
|
||||
@ -5600,7 +5587,7 @@ class DestroyPortTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DestroyPortgroupTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test_destroy_portgroup(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
portgroup = obj_utils.create_test_portgroup(self.context,
|
||||
@ -5625,7 +5612,7 @@ class DestroyPortgroupTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||
@mock.patch.object(dbapi.IMPL, 'get_offline_conductors')
|
||||
class ManagerCheckDeployingStatusTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(ManagerCheckDeployingStatusTestCase, self).setUp()
|
||||
self._start_service()
|
||||
@ -5715,7 +5702,7 @@ class ManagerCheckDeployingStatusTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
err_handler=conductor_utils.provisioning_error_handler)
|
||||
|
||||
|
||||
class TestIndirectionApiConductor(tests_db_base.DbTestCase):
|
||||
class TestIndirectionApiConductor(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIndirectionApiConductor, self).setUp()
|
||||
@ -5818,8 +5805,7 @@ class TestIndirectionApiConductor(tests_db_base.DbTestCase):
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DoNodeTakeOverTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class DoNodeTakeOverTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeConsole.start_console')
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.take_over')
|
||||
@ -5893,9 +5879,7 @@ class DoNodeTakeOverTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DoNodeAdoptionTestCase(
|
||||
mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
@mock.patch('ironic.drivers.modules.fake.FakePower.validate')
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeBoot.validate')
|
||||
@ -6055,7 +6039,7 @@ class DoNodeAdoptionTestCase(
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DestroyVolumeConnectorTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test_destroy_volume_connector(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
|
||||
@ -6083,7 +6067,7 @@ class DestroyVolumeConnectorTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class UpdateVolumeConnectorTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test_update_volume_connector(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
|
||||
@ -6147,7 +6131,7 @@ class UpdateVolumeConnectorTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class DestroyVolumeTargetTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test_destroy_volume_target(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
|
||||
@ -6198,7 +6182,7 @@ class DestroyVolumeTargetTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
|
||||
@mgr_utils.mock_record_keepalive
|
||||
class UpdateVolumeTargetTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
tests_db_base.DbTestCase):
|
||||
db_base.DbTestCase):
|
||||
def test_update_volume_target(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
|
||||
|
@ -26,11 +26,11 @@ from ironic.objects import fields
|
||||
from ironic.objects import node as node_objects
|
||||
from ironic.objects import notification
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
class TestNotificationUtils(base.DbTestCase):
|
||||
class TestNotificationUtils(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(TestNotificationUtils, self).setUp()
|
||||
self.config(notification_level='debug')
|
||||
|
@ -33,8 +33,8 @@ from ironic.conductor import manager as conductor_manager
|
||||
from ironic.conductor import rpcapi as conductor_rpcapi
|
||||
from ironic import objects
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils as dbutils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
@ -62,14 +62,14 @@ class ConductorRPCAPITestCase(tests_base.TestCase):
|
||||
self.assertEqual('3', mock_get_client.call_args[1]['version_cap'])
|
||||
|
||||
|
||||
class RPCAPITestCase(base.DbTestCase):
|
||||
class RPCAPITestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(RPCAPITestCase, self).setUp()
|
||||
self.fake_node = dbutils.get_test_node(driver='fake-driver')
|
||||
self.fake_node = db_utils.get_test_node(driver='fake-driver')
|
||||
self.fake_node_obj = objects.Node._from_db_object(
|
||||
self.context, objects.Node(), self.fake_node)
|
||||
self.fake_portgroup = dbutils.get_test_portgroup()
|
||||
self.fake_portgroup = db_utils.get_test_portgroup()
|
||||
|
||||
def test_serialized_instance_has_uuid(self):
|
||||
self.assertIn('uuid', self.fake_node)
|
||||
@ -266,14 +266,14 @@ class RPCAPITestCase(base.DbTestCase):
|
||||
enabled=True)
|
||||
|
||||
def test_create_port(self):
|
||||
fake_port = dbutils.get_test_port()
|
||||
fake_port = db_utils.get_test_port()
|
||||
self._test_rpcapi('create_port',
|
||||
'call',
|
||||
version='1.41',
|
||||
port_obj=fake_port)
|
||||
|
||||
def test_update_port(self):
|
||||
fake_port = dbutils.get_test_port()
|
||||
fake_port = db_utils.get_test_port()
|
||||
self._test_rpcapi('update_port',
|
||||
'call',
|
||||
version='1.13',
|
||||
@ -431,14 +431,14 @@ class RPCAPITestCase(base.DbTestCase):
|
||||
version='1.34')
|
||||
|
||||
def test_destroy_volume_connector(self):
|
||||
fake_volume_connector = dbutils.get_test_volume_connector()
|
||||
fake_volume_connector = db_utils.get_test_volume_connector()
|
||||
self._test_rpcapi('destroy_volume_connector',
|
||||
'call',
|
||||
version='1.35',
|
||||
connector=fake_volume_connector)
|
||||
|
||||
def test_update_volume_connector(self):
|
||||
fake_volume_connector = dbutils.get_test_volume_connector()
|
||||
fake_volume_connector = db_utils.get_test_volume_connector()
|
||||
self._test_rpcapi('update_volume_connector',
|
||||
'call',
|
||||
version='1.35',
|
||||
@ -451,14 +451,14 @@ class RPCAPITestCase(base.DbTestCase):
|
||||
node_obj=self.fake_node)
|
||||
|
||||
def test_destroy_volume_target(self):
|
||||
fake_volume_target = dbutils.get_test_volume_target()
|
||||
fake_volume_target = db_utils.get_test_volume_target()
|
||||
self._test_rpcapi('destroy_volume_target',
|
||||
'call',
|
||||
version='1.37',
|
||||
target=fake_volume_target)
|
||||
|
||||
def test_update_volume_target(self):
|
||||
fake_volume_target = dbutils.get_test_volume_target()
|
||||
fake_volume_target = db_utils.get_test_volume_target()
|
||||
self._test_rpcapi('update_volume_target',
|
||||
'call',
|
||||
version='1.37',
|
||||
|
@ -30,7 +30,7 @@ from ironic.conductor import task_manager
|
||||
from ironic import objects
|
||||
from ironic.objects import fields
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.db import base as tests_db_base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ from ironic.tests.unit.objects import utils as obj_utils
|
||||
@mock.patch.object(objects.Portgroup, 'list_by_node_id')
|
||||
@mock.patch.object(objects.VolumeConnector, 'list_by_node_id')
|
||||
@mock.patch.object(objects.VolumeTarget, 'list_by_node_id')
|
||||
class TaskManagerTestCase(tests_db_base.DbTestCase):
|
||||
class TaskManagerTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(TaskManagerTestCase, self).setUp()
|
||||
self.host = 'test-host'
|
||||
|
@ -24,19 +24,19 @@ from ironic import objects
|
||||
from ironic.objects import fields as obj_fields
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class NodeSetBootDeviceTestCase(base.DbTestCase):
|
||||
class NodeSetBootDeviceTestCase(db_base.DbTestCase):
|
||||
|
||||
def test_node_set_boot_device_non_existent_device(self):
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
|
||||
self.driver = driver_factory.get_driver("fake_ipmitool")
|
||||
ipmi_info = utils.get_test_ipmi_info()
|
||||
ipmi_info = db_utils.get_test_ipmi_info()
|
||||
node = obj_utils.create_test_node(self.context,
|
||||
uuid=uuidutils.generate_uuid(),
|
||||
driver='fake_ipmitool',
|
||||
@ -50,7 +50,7 @@ class NodeSetBootDeviceTestCase(base.DbTestCase):
|
||||
def test_node_set_boot_device_valid(self):
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
|
||||
self.driver = driver_factory.get_driver("fake_ipmitool")
|
||||
ipmi_info = utils.get_test_ipmi_info()
|
||||
ipmi_info = db_utils.get_test_ipmi_info()
|
||||
node = obj_utils.create_test_node(self.context,
|
||||
uuid=uuidutils.generate_uuid(),
|
||||
driver='fake_ipmitool',
|
||||
@ -68,7 +68,7 @@ class NodeSetBootDeviceTestCase(base.DbTestCase):
|
||||
def test_node_set_boot_device_adopting(self):
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
|
||||
self.driver = driver_factory.get_driver("fake_ipmitool")
|
||||
ipmi_info = utils.get_test_ipmi_info()
|
||||
ipmi_info = db_utils.get_test_ipmi_info()
|
||||
node = obj_utils.create_test_node(self.context,
|
||||
uuid=uuidutils.generate_uuid(),
|
||||
driver='fake_ipmitool',
|
||||
@ -83,7 +83,7 @@ class NodeSetBootDeviceTestCase(base.DbTestCase):
|
||||
self.assertFalse(mock_sbd.called)
|
||||
|
||||
|
||||
class NodePowerActionTestCase(base.DbTestCase):
|
||||
class NodePowerActionTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(NodePowerActionTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager()
|
||||
@ -559,7 +559,7 @@ class NodePowerActionTestCase(base.DbTestCase):
|
||||
self.assertIsNone(node['last_error'])
|
||||
|
||||
|
||||
class NodeSoftPowerActionTestCase(base.DbTestCase):
|
||||
class NodeSoftPowerActionTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NodeSoftPowerActionTestCase, self).setUp()
|
||||
@ -715,7 +715,7 @@ class CleanupAfterTimeoutTestCase(tests_base.TestCase):
|
||||
self.assertIn('Deploy timed out', self.node.last_error)
|
||||
|
||||
|
||||
class NodeCleaningStepsTestCase(base.DbTestCase):
|
||||
class NodeCleaningStepsTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(NodeCleaningStepsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager()
|
||||
@ -1077,7 +1077,7 @@ class ErrorHandlersTestCase(tests_base.TestCase):
|
||||
self.assertFalse(log_mock.warning.called)
|
||||
|
||||
|
||||
class ValidatePortPhysnetTestCase(base.DbTestCase):
|
||||
class ValidatePortPhysnetTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ValidatePortPhysnetTestCase, self).setUp()
|
||||
@ -1187,11 +1187,11 @@ class ValidatePortPhysnetTestCase(base.DbTestCase):
|
||||
|
||||
# Prepare the port on which we are performing the operation.
|
||||
if operation == 'create':
|
||||
# NOTE(mgoddard): We use utils here rather than obj_utils as it
|
||||
# NOTE(mgoddard): We use db_utils here rather than obj_utils as it
|
||||
# allows us to create a Port without a physical_network field, more
|
||||
# closely matching what happens during creation of a port when a
|
||||
# physical_network is not specified.
|
||||
port = utils.get_test_port(
|
||||
port = db_utils.get_test_port(
|
||||
node_id=self.node.id, portgroup_id=portgroup.id,
|
||||
address=next(macs), uuid=uuidutils.generate_uuid(),
|
||||
physical_network=new_physnet)
|
||||
|
@ -25,7 +25,7 @@ from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.drac import common as drac_common
|
||||
from ironic.drivers.modules.drac import power as drac_power
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
@ -34,7 +34,7 @@ INFO_DICT = db_utils.get_test_drac_info()
|
||||
|
||||
@mock.patch.object(drac_common, 'get_drac_client', spec_set=True,
|
||||
autospec=True)
|
||||
class DracPowerTestCase(base.DbTestCase):
|
||||
class DracPowerTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(DracPowerTestCase, self).setUp()
|
||||
|
@ -21,16 +21,16 @@ from testtools import matchers
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
class TestChassisObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
class TestChassisObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
|
||||
def setUp(self):
|
||||
super(TestChassisObject, self).setUp()
|
||||
self.fake_chassis = utils.get_test_chassis()
|
||||
self.fake_chassis = db_utils.get_test_chassis()
|
||||
|
||||
def test_get_by_id(self):
|
||||
chassis_id = self.fake_chassis['id']
|
||||
@ -62,7 +62,7 @@ class TestChassisObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
chassis = objects.Chassis(self.context, **self.fake_chassis)
|
||||
with mock.patch.object(self.dbapi, 'create_chassis',
|
||||
autospec=True) as mock_create_chassis:
|
||||
mock_create_chassis.return_value = utils.get_test_chassis()
|
||||
mock_create_chassis.return_value = db_utils.get_test_chassis()
|
||||
|
||||
chassis.create()
|
||||
|
||||
@ -79,7 +79,8 @@ class TestChassisObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
with mock.patch.object(self.dbapi, 'update_chassis',
|
||||
autospec=True) as mock_update_chassis:
|
||||
mock_update_chassis.return_value = (
|
||||
utils.get_test_chassis(extra=extra, updated_at=test_time))
|
||||
db_utils.get_test_chassis(extra=extra,
|
||||
updated_at=test_time))
|
||||
c = objects.Chassis.get_by_uuid(self.context, uuid)
|
||||
c.extra = extra
|
||||
c.save()
|
||||
@ -114,7 +115,7 @@ class TestChassisObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
# This test will avoid update_chassis() regressions in future.
|
||||
def test_save_after_refresh(self):
|
||||
# Ensure that it's possible to do object.save() after object.refresh()
|
||||
db_chassis = utils.create_test_chassis()
|
||||
db_chassis = db_utils.create_test_chassis()
|
||||
c = objects.Chassis.get_by_uuid(self.context, db_chassis.uuid)
|
||||
c_copy = objects.Chassis.get_by_uuid(self.context, db_chassis.uuid)
|
||||
c.description = 'b240'
|
||||
|
@ -21,16 +21,16 @@ from oslo_utils import timeutils
|
||||
|
||||
from ironic import objects
|
||||
from ironic.objects import fields
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
|
||||
|
||||
class TestConductorObject(base.DbTestCase):
|
||||
class TestConductorObject(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestConductorObject, self).setUp()
|
||||
self.fake_conductor = (
|
||||
utils.get_test_conductor(updated_at=timeutils.utcnow()))
|
||||
db_utils.get_test_conductor(updated_at=timeutils.utcnow()))
|
||||
|
||||
def test_load(self):
|
||||
host = self.fake_conductor['hostname']
|
||||
|
@ -21,17 +21,17 @@ from testtools import matchers
|
||||
from ironic.common import context
|
||||
from ironic.common import exception
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
class TestNodeObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
class TestNodeObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNodeObject, self).setUp()
|
||||
self.ctxt = context.get_admin_context()
|
||||
self.fake_node = utils.get_test_node()
|
||||
self.fake_node = db_utils.get_test_node()
|
||||
self.node = obj_utils.get_test_node(self.ctxt, **self.fake_node)
|
||||
|
||||
def test_get_by_id(self):
|
||||
@ -79,7 +79,7 @@ class TestNodeObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
mock_get_node.return_value = self.fake_node
|
||||
with mock.patch.object(self.dbapi, 'update_node',
|
||||
autospec=True) as mock_update_node:
|
||||
mock_update_node.return_value = utils.get_test_node(
|
||||
mock_update_node.return_value = db_utils.get_test_node(
|
||||
properties={"fake": "property"}, driver='fake-driver',
|
||||
driver_internal_info={}, updated_at=test_time)
|
||||
n = objects.Node.get(self.context, uuid)
|
||||
@ -110,7 +110,7 @@ class TestNodeObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
with mock.patch.object(self.dbapi, 'update_node',
|
||||
autospec=True) as mock_update_node:
|
||||
mock_update_node.return_value = (
|
||||
utils.get_test_node(extra=extra, updated_at=test_time))
|
||||
db_utils.get_test_node(extra=extra, updated_at=test_time))
|
||||
n = objects.Node.get(self.context, uuid)
|
||||
self.assertEqual({"private_state": "secret value"},
|
||||
n.driver_internal_info)
|
||||
@ -148,7 +148,7 @@ class TestNodeObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
|
||||
def test_save_after_refresh(self):
|
||||
# Ensure that it's possible to do object.save() after object.refresh()
|
||||
db_node = utils.create_test_node()
|
||||
db_node = db_utils.create_test_node()
|
||||
n = objects.Node.get_by_uuid(self.context, db_node.uuid)
|
||||
n_copy = objects.Node.get_by_uuid(self.context, db_node.uuid)
|
||||
n.name = 'b240'
|
||||
@ -218,7 +218,7 @@ class TestNodeObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
node = objects.Node(self.context, **self.fake_node)
|
||||
with mock.patch.object(self.dbapi, 'create_node',
|
||||
autospec=True) as mock_create_node:
|
||||
mock_create_node.return_value = utils.get_test_node()
|
||||
mock_create_node.return_value = db_utils.get_test_node()
|
||||
|
||||
node.create()
|
||||
|
||||
|
@ -20,16 +20,16 @@ from testtools import matchers
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
class TestPortObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
class TestPortObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
|
||||
def setUp(self):
|
||||
super(TestPortObject, self).setUp()
|
||||
self.fake_port = utils.get_test_port()
|
||||
self.fake_port = db_utils.get_test_port()
|
||||
|
||||
def test_get_by_id(self):
|
||||
port_id = self.fake_port['id']
|
||||
@ -72,7 +72,7 @@ class TestPortObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
port = objects.Port(self.context, **self.fake_port)
|
||||
with mock.patch.object(self.dbapi, 'create_port',
|
||||
autospec=True) as mock_create_port:
|
||||
mock_create_port.return_value = utils.get_test_port()
|
||||
mock_create_port.return_value = db_utils.get_test_port()
|
||||
|
||||
port.create()
|
||||
|
||||
@ -89,7 +89,8 @@ class TestPortObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
with mock.patch.object(self.dbapi, 'update_port',
|
||||
autospec=True) as mock_update_port:
|
||||
mock_update_port.return_value = (
|
||||
utils.get_test_port(address=address, updated_at=test_time))
|
||||
db_utils.get_test_port(address=address,
|
||||
updated_at=test_time))
|
||||
p = objects.Port.get_by_uuid(self.context, uuid)
|
||||
p.address = address
|
||||
p.save()
|
||||
@ -105,7 +106,7 @@ class TestPortObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
def test_refresh(self):
|
||||
uuid = self.fake_port['uuid']
|
||||
returns = [self.fake_port,
|
||||
utils.get_test_port(address="c3:54:00:cf:2d:40")]
|
||||
db_utils.get_test_port(address="c3:54:00:cf:2d:40")]
|
||||
expected = [mock.call(uuid), mock.call(uuid)]
|
||||
with mock.patch.object(self.dbapi, 'get_port_by_uuid',
|
||||
side_effect=returns,
|
||||
@ -121,8 +122,8 @@ class TestPortObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
def test_save_after_refresh(self):
|
||||
# Ensure that it's possible to do object.save() after object.refresh()
|
||||
address = "b2:54:00:cf:2d:40"
|
||||
db_node = utils.create_test_node()
|
||||
db_port = utils.create_test_port(node_id=db_node.id)
|
||||
db_node = db_utils.create_test_node()
|
||||
db_port = db_utils.create_test_port(node_id=db_node.id)
|
||||
p = objects.Port.get_by_uuid(self.context, db_port.uuid)
|
||||
p_copy = objects.Port.get_by_uuid(self.context, db_port.uuid)
|
||||
p.address = address
|
||||
|
@ -17,16 +17,16 @@ from testtools import matchers
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
|
||||
class TestPortgroupObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
class TestPortgroupObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
|
||||
def setUp(self):
|
||||
super(TestPortgroupObject, self).setUp()
|
||||
self.fake_portgroup = utils.get_test_portgroup()
|
||||
self.fake_portgroup = db_utils.get_test_portgroup()
|
||||
|
||||
def test_get_by_id(self):
|
||||
portgroup_id = self.fake_portgroup['id']
|
||||
@ -81,7 +81,7 @@ class TestPortgroupObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
portgroup = objects.Portgroup(self.context, **self.fake_portgroup)
|
||||
with mock.patch.object(self.dbapi, 'create_portgroup',
|
||||
autospec=True) as mock_create_portgroup:
|
||||
mock_create_portgroup.return_value = utils.get_test_portgroup()
|
||||
mock_create_portgroup.return_value = db_utils.get_test_portgroup()
|
||||
|
||||
portgroup.create()
|
||||
|
||||
@ -98,8 +98,8 @@ class TestPortgroupObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
with mock.patch.object(self.dbapi, 'update_portgroup',
|
||||
autospec=True) as mock_update_portgroup:
|
||||
mock_update_portgroup.return_value = (
|
||||
utils.get_test_portgroup(address=address,
|
||||
updated_at=test_time))
|
||||
db_utils.get_test_portgroup(address=address,
|
||||
updated_at=test_time))
|
||||
p = objects.Portgroup.get_by_uuid(self.context, uuid)
|
||||
p.address = address
|
||||
p.save()
|
||||
@ -115,7 +115,7 @@ class TestPortgroupObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
def test_refresh(self):
|
||||
uuid = self.fake_portgroup['uuid']
|
||||
returns = [self.fake_portgroup,
|
||||
utils.get_test_portgroup(address="c3:54:00:cf:2d:40")]
|
||||
db_utils.get_test_portgroup(address="c3:54:00:cf:2d:40")]
|
||||
expected = [mock.call(uuid), mock.call(uuid)]
|
||||
with mock.patch.object(self.dbapi, 'get_portgroup_by_uuid',
|
||||
side_effect=returns,
|
||||
@ -131,8 +131,8 @@ class TestPortgroupObject(base.DbTestCase, obj_utils.SchemasTestMixIn):
|
||||
def test_save_after_refresh(self):
|
||||
# Ensure that it's possible to do object.save() after object.refresh()
|
||||
address = "b2:54:00:cf:2d:40"
|
||||
db_node = utils.create_test_node()
|
||||
db_portgroup = utils.create_test_portgroup(node_id=db_node.id)
|
||||
db_node = db_utils.create_test_node()
|
||||
db_portgroup = db_utils.create_test_portgroup(node_id=db_node.id)
|
||||
p = objects.Portgroup.get_by_uuid(self.context, db_portgroup.uuid)
|
||||
p_copy = objects.Portgroup.get_by_uuid(self.context, db_portgroup.uuid)
|
||||
p.address = address
|
||||
|
@ -19,15 +19,15 @@ from testtools.matchers import HasLength
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
|
||||
|
||||
class TestVolumeConnectorObject(base.DbTestCase):
|
||||
class TestVolumeConnectorObject(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestVolumeConnectorObject, self).setUp()
|
||||
self.volume_connector_dict = utils.get_test_volume_connector()
|
||||
self.volume_connector_dict = db_utils.get_test_volume_connector()
|
||||
|
||||
@mock.patch('ironic.objects.VolumeConnector.get_by_uuid')
|
||||
@mock.patch('ironic.objects.VolumeConnector.get_by_id')
|
||||
@ -145,8 +145,8 @@ class TestVolumeConnectorObject(base.DbTestCase):
|
||||
with mock.patch.object(self.dbapi, 'update_volume_connector',
|
||||
autospec=True) as mock_update_connector:
|
||||
mock_update_connector.return_value = (
|
||||
utils.get_test_volume_connector(connector_id=connector_id,
|
||||
updated_at=test_time))
|
||||
db_utils.get_test_volume_connector(
|
||||
connector_id=connector_id, updated_at=test_time))
|
||||
c = objects.VolumeConnector.get_by_uuid(self.context, uuid)
|
||||
c.connector_id = connector_id
|
||||
c.save()
|
||||
@ -164,7 +164,7 @@ class TestVolumeConnectorObject(base.DbTestCase):
|
||||
uuid = self.volume_connector_dict['uuid']
|
||||
old_connector_id = self.volume_connector_dict['connector_id']
|
||||
returns = [self.volume_connector_dict,
|
||||
utils.get_test_volume_connector(
|
||||
db_utils.get_test_volume_connector(
|
||||
connector_id="new_connector_id")]
|
||||
expected = [mock.call(uuid), mock.call(uuid)]
|
||||
with mock.patch.object(self.dbapi, 'get_volume_connector_by_uuid',
|
||||
@ -181,7 +181,7 @@ class TestVolumeConnectorObject(base.DbTestCase):
|
||||
|
||||
def test_save_after_refresh(self):
|
||||
# Ensure that it's possible to do object.save() after object.refresh()
|
||||
db_volume_connector = utils.create_test_volume_connector()
|
||||
db_volume_connector = db_utils.create_test_volume_connector()
|
||||
|
||||
vc = objects.VolumeConnector.get_by_uuid(self.context,
|
||||
db_volume_connector.uuid)
|
||||
|
@ -19,15 +19,15 @@ from testtools.matchers import HasLength
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.db import base
|
||||
from ironic.tests.unit.db import utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
|
||||
|
||||
class TestVolumeTargetObject(base.DbTestCase):
|
||||
class TestVolumeTargetObject(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestVolumeTargetObject, self).setUp()
|
||||
self.volume_target_dict = utils.get_test_volume_target()
|
||||
self.volume_target_dict = db_utils.get_test_volume_target()
|
||||
|
||||
@mock.patch('ironic.objects.VolumeTarget.get_by_uuid')
|
||||
@mock.patch('ironic.objects.VolumeTarget.get_by_id')
|
||||
@ -157,8 +157,8 @@ class TestVolumeTargetObject(base.DbTestCase):
|
||||
with mock.patch.object(self.dbapi, 'update_volume_target',
|
||||
autospec=True) as mock_update_target:
|
||||
mock_update_target.return_value = (
|
||||
utils.get_test_volume_target(boot_index=boot_index,
|
||||
updated_at=test_time))
|
||||
db_utils.get_test_volume_target(boot_index=boot_index,
|
||||
updated_at=test_time))
|
||||
target = objects.VolumeTarget.get_by_uuid(self.context, uuid)
|
||||
target.boot_index = boot_index
|
||||
target.save()
|
||||
@ -176,7 +176,7 @@ class TestVolumeTargetObject(base.DbTestCase):
|
||||
uuid = self.volume_target_dict['uuid']
|
||||
old_boot_index = self.volume_target_dict['boot_index']
|
||||
returns = [self.volume_target_dict,
|
||||
utils.get_test_volume_target(boot_index=100)]
|
||||
db_utils.get_test_volume_target(boot_index=100)]
|
||||
expected = [mock.call(uuid), mock.call(uuid)]
|
||||
with mock.patch.object(self.dbapi, 'get_volume_target_by_uuid',
|
||||
side_effect=returns,
|
||||
@ -192,7 +192,7 @@ class TestVolumeTargetObject(base.DbTestCase):
|
||||
|
||||
def test_save_after_refresh(self):
|
||||
# Ensure that it's possible to do object.save() after object.refresh()
|
||||
db_volume_target = utils.create_test_volume_target()
|
||||
db_volume_target = db_utils.create_test_volume_target()
|
||||
|
||||
vt = objects.VolumeTarget.get_by_uuid(self.context,
|
||||
db_volume_target.uuid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user