Merge "Add test case for reset group status"
This commit is contained in:
commit
78fd3d30e2
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add reset group status API to v3 groups_client library, min_microversion
|
||||
of this API is 3.20. This feature enables the possibility to reset group
|
||||
status.
|
@ -23,10 +23,7 @@ from tempest.lib import decorators
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class GroupsTest(base.BaseVolumeAdminTest):
|
||||
_api_version = 3
|
||||
min_microversion = '3.14'
|
||||
max_microversion = 'latest'
|
||||
class BaseGroupsTest(base.BaseVolumeAdminTest):
|
||||
|
||||
def _delete_group(self, grp_id, delete_volumes=True):
|
||||
self.groups_client.delete_group(grp_id, delete_volumes)
|
||||
@ -65,6 +62,12 @@ class GroupsTest(base.BaseVolumeAdminTest):
|
||||
self.assertEqual(grp_name, grp['name'])
|
||||
return grp
|
||||
|
||||
|
||||
class GroupsTest(BaseGroupsTest):
|
||||
min_microversion = '3.14'
|
||||
max_microversion = 'latest'
|
||||
_api_version = 3
|
||||
|
||||
@decorators.idempotent_id('4b111d28-b73d-4908-9bd2-03dc2992e4d4')
|
||||
def test_group_create_show_list_delete(self):
|
||||
# Create volume type
|
||||
@ -320,3 +323,30 @@ class GroupsTest(base.BaseVolumeAdminTest):
|
||||
if vol['group_id'] == grp['id']:
|
||||
grp_vols.append(vol)
|
||||
self.assertEqual(2, len(grp_vols))
|
||||
|
||||
|
||||
class GroupsV320Test(BaseGroupsTest):
|
||||
_api_version = 3
|
||||
min_microversion = '3.20'
|
||||
max_microversion = 'latest'
|
||||
|
||||
@decorators.idempotent_id('b20c696b-0cbc-49a5-8b3a-b1fb9338f45c')
|
||||
def test_reset_group_status(self):
|
||||
# Create volume type
|
||||
volume_type = self.create_volume_type()
|
||||
|
||||
# Create group type
|
||||
group_type = self.create_group_type()
|
||||
|
||||
# Create group
|
||||
group = self._create_group(group_type, volume_type)
|
||||
|
||||
# Reset group status
|
||||
self.addCleanup(waiters.wait_for_volume_resource_status,
|
||||
self.groups_client, group['id'], 'available')
|
||||
self.addCleanup(self.admin_groups_client.reset_group_status,
|
||||
group['id'], 'available')
|
||||
for status in ['creating', 'available', 'error']:
|
||||
self.admin_groups_client.reset_group_status(group['id'], status)
|
||||
waiters.wait_for_volume_resource_status(
|
||||
self.groups_client, group['id'], status)
|
||||
|
@ -109,6 +109,17 @@ class GroupsClient(base_client.BaseClient):
|
||||
self.expected_success(202, resp.status)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
|
||||
def reset_group_status(self, group_id, status_to_set):
|
||||
"""Resets group status.
|
||||
|
||||
For more information, please refer to the official API reference:
|
||||
https://developer.openstack.org/api-ref/block-storage/v3/#reset-group-status
|
||||
"""
|
||||
post_body = json.dumps({'reset_status': {'status': status_to_set}})
|
||||
resp, body = self.post('groups/%s/action' % group_id, post_body)
|
||||
self.expected_success(202, resp.status)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
|
||||
def is_resource_deleted(self, id):
|
||||
try:
|
||||
self.show_group(id)
|
||||
|
@ -184,3 +184,12 @@ class TestGroupsClient(base.BaseServiceTest):
|
||||
group_id='0e701ab8-1bec-4b9f-b026-a7ba4af13578',
|
||||
status=202,
|
||||
**self.FAKE_UPDATE_GROUP['group'])
|
||||
|
||||
def test_reset_group_status(self):
|
||||
self.check_service_client_function(
|
||||
self.client.reset_group_status,
|
||||
'tempest.lib.common.rest_client.RestClient.post',
|
||||
{},
|
||||
status=202,
|
||||
group_id='0e701ab8-1bec-4b9f-b026-a7ba4af13578',
|
||||
status_to_set='error')
|
||||
|
Loading…
Reference in New Issue
Block a user