Merge "Correct and optimize hpe3par tests"

This commit is contained in:
Zuul 2019-05-02 21:55:52 +00:00 committed by Gerrit Code Review
commit 6fcb7c6639
2 changed files with 10 additions and 14 deletions

View File

@ -14,9 +14,9 @@
# under the License.
"""Unit tests for OpenStack Cinder volume drivers."""
import mock
import ast
import copy
import mock
from oslo_utils import units
@ -3509,9 +3509,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
# setup_mock_client drive with default configuration
# and return the mock HTTP 3PAR client
mock_client = self.setup_driver()
volume_type_hos = self.volume_type_hos
volume_type_hos['extra_specs']['convert_to_base'] = False
_mock_volume_types.return_value = volume_type_hos
_mock_volume_types.return_value = self.volume_type_hos
with mock.patch.object(hpecommon.HPE3PARCommon,
'_create_client') as mock_create_client:
@ -3553,7 +3551,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
'getVolume.return_value': {}
}
mock_client = self.setup_driver(mock_conf=conf)
volume_type_hos = self.volume_type_hos
volume_type_hos = copy.deepcopy(self.volume_type_hos)
volume_type_hos['extra_specs']['convert_to_base'] = True
_mock_volume_types.return_value = volume_type_hos
with mock.patch.object(hpecommon.HPE3PARCommon,
@ -3606,9 +3604,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
'getVolume.return_value': {}
}
mock_client = self.setup_driver(mock_conf=conf)
volume_type_hos = self.volume_type_hos
volume_type_hos['extra_specs']['convert_to_base'] = False
_mock_volume_types.return_value = volume_type_hos
_mock_volume_types.return_value = self.volume_type_hos
with mock.patch.object(hpecommon.HPE3PARCommon,
'_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
@ -3661,7 +3657,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
'getVolume.return_value': {}
}
mock_client = self.setup_driver(mock_conf=conf)
volume_type_hos = self.volume_type_hos
volume_type_hos = copy.deepcopy(self.volume_type_hos)
volume_type_hos['extra_specs']['convert_to_base'] = True
_mock_volume_types.return_value = volume_type_hos
with mock.patch.object(hpecommon.HPE3PARCommon,

View File

@ -2100,7 +2100,7 @@ class HPE3PARCommon(object):
# by default, set convert_to_base to False
convert_to_base = self._get_boolean_key_value(
hpe3par_keys, 'convert_to_base', False)
hpe3par_keys, 'convert_to_base')
# if provisioning is not set use thin
default_prov = self.valid_prov_values[0]
@ -2643,7 +2643,7 @@ class HPE3PARCommon(object):
# by default, set convert_to_base to False
convert_to_base = self._get_boolean_key_value(
hpe3par_keys, 'convert_to_base', False)
hpe3par_keys, 'convert_to_base')
LOG.debug("convert_to_base: %(convert)s",
{'convert': convert_to_base})
@ -2971,9 +2971,9 @@ class HPE3PARCommon(object):
# Update v2 object as required for
# _convert_to_base function
v2['volume_type_id'] = \
v2['volume_type_id'] = (
self._get_3par_vol_comment_value(
v1['comment'], 'volume_type_id')
v1['comment'], 'volume_type_id'))
v2['id'] = self._get_3par_vol_comment_value(
v2['comment'], 'volume_id')