From 9bc7cec01621080e1403b68c1e1838ad02a6c9e6 Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Tue, 23 Feb 2021 15:07:17 -0800 Subject: [PATCH] Change public share tests Manila changed the default RBAC policy for public shares in the Stein release but maintained compatibility to the older expectation that regular/unprivileged users could create public shares, or modify private shares to become public [1]. This compatibility is being dropped [2] So we must adjust the functional test expectations here. [1] https://review.opendev.org/634864 [2] https://review.opendev.org/776869 Depends-On: I6e7608be57de8987117f3f4ace018a7eb91c8bd2 Change-Id: I57111b676487fef0c82f749e90b165465151f0c1 Signed-off-by: Goutham Pacha Ravi --- manilaclient/tests/functional/test_shares.py | 10 +++++++++- manilaclient/tests/functional/test_shares_listing.py | 7 +++---- manilaclient/tests/functional/test_snapshot_access.py | 1 - 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/manilaclient/tests/functional/test_shares.py b/manilaclient/tests/functional/test_shares.py index 0778e8d32..4f68ce5cc 100644 --- a/manilaclient/tests/functional/test_shares.py +++ b/manilaclient/tests/functional/test_shares.py @@ -78,7 +78,15 @@ class SharesReadWriteBase(base.BaseTestCase): self.assertEqual('False', create['is_public']) self.user_client.update_share( - create['id'], new_name, new_description, True) + create['id'], name=new_name, description=new_description) + get = self.user_client.get_share(create['id']) + + self.assertEqual(new_name, get['name']) + self.assertEqual(new_description, get['description']) + self.assertEqual('False', get['is_public']) + + # only admins operating at system scope can set a share to be public + self.admin_client.update_share(create['id'], is_public=True) get = self.user_client.get_share(create['id']) self.assertEqual(new_name, get['name']) diff --git a/manilaclient/tests/functional/test_shares_listing.py b/manilaclient/tests/functional/test_shares_listing.py index 45433c135..312dc06ed 100644 --- a/manilaclient/tests/functional/test_shares_listing.py +++ b/manilaclient/tests/functional/test_shares_listing.py @@ -144,11 +144,11 @@ class SharesListReadWriteTest(base.BaseTestCase): name=self.public_name, description=self.public_description, public=True, - client=self.get_user_client()) + client=self.admin_client) for share_id in (self.private_share['id'], self.public_share['id'], self.admin_private_share['id']): - self.get_admin_client().wait_for_resource_status( + self.admin_client.wait_for_resource_status( share_id, constants.STATUS_AVAILABLE) def _list_shares(self, filters=None): @@ -314,8 +314,7 @@ class SharesListReadWriteTest(base.BaseTestCase): self.create_share( name=u'共享名称', description=u'共享描述', - public=True, - client=self.get_user_client()) + client=self.user_client) filters = {'name~': u'名称'} shares = self.user_client.list_shares(filters=filters) self.assertGreater(len(shares), 0) diff --git a/manilaclient/tests/functional/test_snapshot_access.py b/manilaclient/tests/functional/test_snapshot_access.py index dee34670a..ec297dee2 100644 --- a/manilaclient/tests/functional/test_snapshot_access.py +++ b/manilaclient/tests/functional/test_snapshot_access.py @@ -38,7 +38,6 @@ class SnapshotAccessReadBase(base.BaseTestCase): "snapshot access tests." % self.protocol) self.share = self.create_share(share_protocol=self.protocol, - public=True, client=self.get_user_client()) int_range = range(0, 10)