Browse Source

Merge "Bump hacking version to 3.1.0"

changes/61/742861/2
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
2124f39f9d
5 changed files with 28 additions and 22 deletions
  1. +6
    -6
      cinder/tests/unit/policies/test_volume.py
  2. +16
    -10
      cinder/tests/unit/targets/test_iet_driver.py
  3. +1
    -1
      cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py
  4. +4
    -4
      cinder/volume/drivers/dell_emc/unity/client.py
  5. +1
    -1
      test-requirements.txt

+ 6
- 6
cinder/tests/unit/policies/test_volume.py View File

@@ -133,7 +133,7 @@ class VolumePolicyTests(test_base.CinderPolicyTests):

volume = self._create_fake_volume(admin_context)
path = '/v3/%(project_id)s/volumes/detail' % {
'project_id': admin_context.project_id, 'volume_id': volume.id
'project_id': admin_context.project_id
}

response = self._get_request_response(admin_context, path, 'GET')
@@ -149,7 +149,7 @@ class VolumePolicyTests(test_base.CinderPolicyTests):

volume = self._create_fake_volume(user_context)
path = '/v3/%(project_id)s/volumes/detail' % {
'project_id': user_context.project_id, 'volume_id': volume.id
'project_id': user_context.project_id
}

response = self._get_request_response(user_context, path, 'GET')
@@ -288,9 +288,9 @@ class VolumePolicyTests(test_base.CinderPolicyTests):
# Make sure admins are authorized to show tenant_id in volume detail
admin_context = self.admin_context

volume = self._create_fake_volume(admin_context)
self._create_fake_volume(admin_context)
path = '/v3/%(project_id)s/volumes/detail' % {
'project_id': admin_context.project_id, 'volume_id': volume.id
'project_id': admin_context.project_id
}

response = self._get_request_response(admin_context, path, 'GET')
@@ -305,9 +305,9 @@ class VolumePolicyTests(test_base.CinderPolicyTests):
# Make sure owners are authorized to show tenant_id in volume detail
user_context = self.user_context

volume = self._create_fake_volume(user_context)
self._create_fake_volume(user_context)
path = '/v3/%(project_id)s/volumes/detail' % {
'project_id': user_context.project_id, 'volume_id': volume.id
'project_id': user_context.project_id
}

response = self._get_request_response(user_context, path, 'GET')


+ 16
- 10
cinder/tests/unit/targets/test_iet_driver.py View File

@@ -33,16 +33,19 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
def test_get_target(self):
tmp_file = six.StringIO()
tmp_file.write(
'tid:1 name:iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45\n' # noqa
' sid:844427031282176 initiator:iqn.1994-05.com.redhat:5a6894679665\n' # noqa
'tid:1 name:iqn.2010-10.org.openstack:'
'volume-83c2e877-feed-46be-8435-77884fe55b45\n'
' sid:844427031282176 initiator:'
'iqn.1994-05.com.redhat:5a6894679665\n'
' cid:0 ip:10.9.8.7 state:active hd:none dd:none')
tmp_file.seek(0)
with mock.patch('six.moves.builtins.open') as mock_open:
mock_open.return_value = contextlib.closing(tmp_file)
self.assertEqual('1',
self.target._get_target(
'iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45' # noqa
))
'iqn.2010-10.org.openstack:'
'volume-83c2e877-feed-46be-8435-77884fe55b45'
))

# Test the failure case: Failed to handle the config file
mock_open.side_effect = MemoryError()
@@ -153,18 +156,21 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
def test_find_sid_cid_for_target(self, mock_delete_target):
tmp_file = six.StringIO()
tmp_file.write(
'tid:1 name:iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45\n' # noqa
' sid:844427031282176 initiator:iqn.1994-05.com.redhat:5a6894679665\n' # noqa
'tid:1 name:iqn.2010-10.org.openstack:'
'volume-83c2e877-feed-46be-8435-77884fe55b45\n'
' sid:844427031282176 initiator:'
'iqn.1994-05.com.redhat:5a6894679665\n'
' cid:0 ip:10.9.8.7 state:active hd:none dd:none')
tmp_file.seek(0)
with mock.patch('six.moves.builtins.open') as mock_open:
mock_open.return_value = contextlib.closing(tmp_file)
self.assertEqual(('844427031282176', '0'),
self.target._find_sid_cid_for_target(
'1',
'iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45', # noqa
'volume-83c2e877-feed-46be-8435-77884fe55b45' # noqa
))
'1',
'iqn.2010-10.org.openstack:'
'volume-83c2e877-feed-46be-8435-77884fe55b45',
'volume-83c2e877-feed-46be-8435-77884fe55b45'
))

@mock.patch('cinder.volume.targets.iet.IetAdm._get_target',
return_value=1)


+ 1
- 1
cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py View File

@@ -1699,7 +1699,7 @@ class PowerMaxCommonTest(test.TestCase):
clone_name = 'OS-' + clone_volume.id
with mock.patch.object(
self.common, '_cleanup_target') as mock_cleanup:
self.assertRaises(
self.assertRaises( # noqa: H202
Exception, self.common._create_replica, array,
clone_volume, source_device_id,
self.data.extra_specs, snap_name) # noqa: ignore=H202


+ 4
- 4
cinder/volume/drivers/dell_emc/unity/client.py View File

@@ -513,8 +513,8 @@ class UnityClient(object):
dst_resource_id=dst_resource_id)
except storops_ex.UnityResourceNotFoundError:
raise ClientReplicationError(
'Replication session with name %(name)s not found.'.format(
name=name))
'Replication session with name %(name)s not found.' %
{'name': name})

def failover_replication(self, rep_session):
"""Fails over a replication session.
@@ -532,7 +532,7 @@ class UnityClient(object):
except storops_ex.UnityException as ex:
raise ClientReplicationError(
'Failover of replication: %(name)s failed, '
'error: %(err)s'.format(name=name, err=ex)
'error: %(err)s' % {'name': name, 'err': ex}
)
LOG.debug('Replication: %s failed over', name)

@@ -552,7 +552,7 @@ class UnityClient(object):
except storops_ex.UnityException as ex:
raise ClientReplicationError(
'Failback of replication: %(name)s failed, '
'error: %(err)s'.format(name=name, err=ex)
'error: %(err)s' % {'name': name, 'err': ex}
)
LOG.debug('Replication: %s failed back', name)



+ 1
- 1
test-requirements.txt View File

@@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.

# Install bounded pep8/pyflakes first, then let flake8 install
hacking>=3.0.1,<3.1.0 # Apache-2.0
hacking>=3.1.0,<3.2.0 # Apache-2.0
flake8-import-order # LGPLv3
flake8-logging-format>=0.6.0 # Apache-2.0



Loading…
Cancel
Save