[Share Groups] Fix creation of share group types with wrong specs values
If we provide some other type than None or dict as group specs creating share group type, then we get error 500 caused by unhandled exception. So, avoid it by explicitly checking type of provided group specs. Change-Id: I81312617f37a8f559b3c9201b03cf8be31761365 Closes-Bug: #1673446
This commit is contained in:
parent
989e54d5be
commit
e92f09f322
|
@ -69,6 +69,15 @@ class ShareGroupTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
|||
self.create_share_group_type,
|
||||
"x" * 256, client=self.admin_shares_v2_client)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_create_share_group_type_with_wrong_value_for_group_specs(self):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.create_share_group_type,
|
||||
name=data_utils.rand_name("tempest_manila"),
|
||||
share_types=[self.share_type['share_type']['id']],
|
||||
group_specs="expecting_error_code_400")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_get_share_group_type_using_nonexistent_id(self):
|
||||
self.assertRaises(
|
||||
|
|
|
@ -595,7 +595,8 @@ class BaseSharesTest(test.BaseTestCase):
|
|||
group_specs=None, client=None,
|
||||
cleanup_in_class=True, **kwargs):
|
||||
client = client or cls.shares_v2_client
|
||||
if group_specs is None:
|
||||
if (group_specs is None and
|
||||
CONF.share.capability_sg_consistent_snapshot_support):
|
||||
group_specs = {
|
||||
'consistent_snapshot_support': (
|
||||
CONF.share.capability_sg_consistent_snapshot_support),
|
||||
|
|
Loading…
Reference in New Issue