Update unity tests to use our test base
Deprecation warnings were being emitted due to use of assertRaisesRegex, even though a py2/3 wrapper was created in I3cf8e29184a68a07d35fb121c816e40b89df393e. This was due to the Unity tests inheriting from unittest.TestCase instead of our own base TestCase. Switched test cases over to use cinder.test.TestCase gets rid of the deprecation warning for assertRaisesRegex. Our base test installs a logging fixture to make sure log messages are OK. This uncovered that the driver code was trying to pass an object in as if it were a dict of formatting values, resulting in an error. This patch fixes this my creating a dict of the needed values to pass in so the tests will pass under the new inheritance. Change-Id: I2a6643ab4827dae244212c90c73402ff6d61cf76
This commit is contained in:
parent
ab5dfc096e
commit
406959ad1c
|
@ -15,12 +15,12 @@
|
|||
|
||||
import contextlib
|
||||
import functools
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from oslo_utils import units
|
||||
|
||||
from cinder import exception
|
||||
from cinder import test
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.unity \
|
||||
import fake_exception as ex
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.unity import test_client
|
||||
|
@ -329,8 +329,9 @@ class IdMatcher(object):
|
|||
########################
|
||||
|
||||
@mock.patch.object(adapter, 'storops_ex', new=ex)
|
||||
class CommonAdapterTest(unittest.TestCase):
|
||||
class CommonAdapterTest(test.TestCase):
|
||||
def setUp(self):
|
||||
super(CommonAdapterTest, self).setUp()
|
||||
self.adapter = mock_adapter(adapter.CommonAdapter)
|
||||
|
||||
def test_get_managed_pools(self):
|
||||
|
@ -686,8 +687,9 @@ class CommonAdapterTest(unittest.TestCase):
|
|||
self.adapter.normalize_config(config)
|
||||
|
||||
|
||||
class FCAdapterTest(unittest.TestCase):
|
||||
class FCAdapterTest(test.TestCase):
|
||||
def setUp(self):
|
||||
super(FCAdapterTest, self).setUp()
|
||||
self.adapter = mock_adapter(adapter.FCAdapter)
|
||||
|
||||
def test_setup(self):
|
||||
|
@ -799,8 +801,9 @@ class FCAdapterTest(unittest.TestCase):
|
|||
self.adapter.validate_ports(['spa_iom*', 'spc_invalid'])
|
||||
|
||||
|
||||
class ISCSIAdapterTest(unittest.TestCase):
|
||||
class ISCSIAdapterTest(test.TestCase):
|
||||
def setUp(self):
|
||||
super(ISCSIAdapterTest, self).setUp()
|
||||
self.adapter = mock_adapter(adapter.ISCSIAdapter)
|
||||
|
||||
def test_iscsi_protocol(self):
|
||||
|
|
|
@ -264,10 +264,16 @@ class CommonAdapter(object):
|
|||
:param volume: volume information
|
||||
"""
|
||||
params = VolumeParams(self, volume)
|
||||
log_params = {
|
||||
'name': params.name,
|
||||
'size': params.size,
|
||||
'description': params.description,
|
||||
'pool': params.pool,
|
||||
'io_limit_policy': params.io_limit_policy}
|
||||
|
||||
LOG.info('Create Volume: %(name)s, size: %(size)s, description: '
|
||||
'%(description)s, pool: %(pool)s, io limit policy: '
|
||||
'%(io_limit_policy)s.', params)
|
||||
'%(io_limit_policy)s.', log_params)
|
||||
|
||||
return self.makeup_model(
|
||||
self.client.create_lun(name=params.name,
|
||||
|
|
Loading…
Reference in New Issue