Adding regression test for update_group

Initially the issue was fixed here If74d23b9413209ee8db3c58fc71d215abeb580b2,
but due to code changes, the same issue was repeated and fixed here,
Ia43a6f2df7fd4066a0ed26450b26a1456d4cecfa.
Addressing the comment on the latest fix, adding test case.

Change-Id: I03d6214abf050e5f9a2cc5fa0772150bbbf8520e
Related-Bug: #1645207
This commit is contained in:
whoami-rajat 2018-10-15 16:27:15 +05:30
parent 65d1e2bddc
commit 6449d734c7
1 changed files with 16 additions and 0 deletions

View File

@ -382,6 +382,22 @@ class GroupManagerTestCase(test.TestCase):
self.volume.db.volume_get.reset_mock()
self.volume.db.volume_get = volume_get_orig
def test_update_group_vol_not_found(self):
"""Test add non existent volume to group"""
group = tests_utils.create_group(
self.context,
availability_zone=CONF.storage_availability_zone,
volume_type_ids=[fake.VOLUME_TYPE_ID],
group_type_id=fake.GROUP_TYPE_ID,
host=CONF.host)
self.volume.create_group(self.context, group)
self.assertRaises(exception.VolumeNotFound,
self.volume.update_group,
self.context, group,
add_volumes=fake.VOLUME_ID,
remove_volumes=fake.VOLUME2_ID)
@mock.patch('cinder.db.sqlalchemy.api.'
'volume_glance_metadata_copy_to_volume')
@mock.patch('cinder.db.sqlalchemy.api.'