[Tempest] Fix visibility of test_quotas.py module
Commit [1] added wrong decorator to test class located in "manila_tempest_tests/tests/api/test_quotas.py" module that made it invisible for tempest. It should be "ddt.ddt" instead of "ddt.data" as it is now. Also, fix negative quota tests that were testing wrong thing. It should have been testing "quota-sets" and "os-quota-sets", not "services" and "os-services" as it is now. [1] I82f00114db985b4b3bf4db0a64191559508ac600 Change-Id: Ie0eb7d32b7b032ffdb7f7dd47f68841211e7d7a6 Closes-Bug: #1635588
This commit is contained in:
parent
78e500c52b
commit
4475a5ca00
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ddt
|
||||
from tempest import config
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from testtools import testcase as tc
|
||||
@ -22,6 +23,7 @@ from manila_tempest_tests.tests.api import base
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
|
||||
|
||||
force_tenant_isolation = True
|
||||
@ -176,3 +178,28 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
|
||||
client.tenant_id,
|
||||
client.user_id,
|
||||
share_networks=bigger_value)
|
||||
|
||||
@ddt.data(
|
||||
('quota-sets', '2.0', 'show_quotas'),
|
||||
('quota-sets', '2.0', 'default_quotas'),
|
||||
('quota-sets', '2.0', 'reset_quotas'),
|
||||
('quota-sets', '2.0', 'update_quotas'),
|
||||
('quota-sets', '2.6', 'show_quotas'),
|
||||
('quota-sets', '2.6', 'default_quotas'),
|
||||
('quota-sets', '2.6', 'reset_quotas'),
|
||||
('quota-sets', '2.6', 'update_quotas'),
|
||||
('os-quota-sets', '2.7', 'show_quotas'),
|
||||
('os-quota-sets', '2.7', 'default_quotas'),
|
||||
('os-quota-sets', '2.7', 'reset_quotas'),
|
||||
('os-quota-sets', '2.7', 'update_quotas'),
|
||||
)
|
||||
@ddt.unpack
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@base.skip_if_microversion_not_supported("2.7")
|
||||
def test_show_quotas_with_wrong_versions(self, url, version, method_name):
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
getattr(self.shares_v2_client, method_name),
|
||||
self.shares_v2_client.tenant_id,
|
||||
version=version, url=url,
|
||||
)
|
||||
|
@ -231,6 +231,14 @@ class BaseSharesTest(test.BaseTestCase):
|
||||
super(BaseSharesTest, cls).setup_clients()
|
||||
os = getattr(cls, 'os_%s' % cls.credentials[0])
|
||||
os.shares_client = shares_client.SharesClient(os.auth_provider)
|
||||
|
||||
if CONF.identity.auth_version == 'v3':
|
||||
project_id = os.auth_provider.auth_data[1]['project']['id']
|
||||
else:
|
||||
project_id = os.auth_provider.auth_data[1]['token']['tenant']['id']
|
||||
cls.tenant_id = project_id
|
||||
cls.user_id = os.auth_provider.auth_data[1]['user']['id']
|
||||
|
||||
cls.shares_client = os.shares_client
|
||||
os.shares_v2_client = shares_v2_client.SharesV2Client(
|
||||
os.auth_provider)
|
||||
|
@ -22,7 +22,7 @@ from manila_tempest_tests.tests.api import base
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
@ddt.data
|
||||
@ddt.ddt
|
||||
class SharesQuotasTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@ -31,8 +31,8 @@ class SharesQuotasTest(base.BaseSharesTest):
|
||||
msg = "Quota tests are disabled."
|
||||
raise cls.skipException(msg)
|
||||
super(SharesQuotasTest, cls).resource_setup()
|
||||
cls.user_id = cls.shares_v2_client.user_id
|
||||
cls.tenant_id = cls.shares_v2_client.tenant_id
|
||||
cls.user_id = cls.shares_v2_client.user_id or cls.user_id
|
||||
cls.tenant_id = cls.shares_v2_client.tenant_id or cls.tenant_id
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
|
||||
@ddt.data('shares_client', 'shares_v2_client')
|
||||
|
@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ddt
|
||||
from tempest import config
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from testtools import testcase as tc
|
||||
@ -23,7 +22,6 @@ from manila_tempest_tests.tests.api import base
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class SharesQuotasNegativeTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@ -50,28 +48,3 @@ class SharesQuotasNegativeTest(base.BaseSharesTest):
|
||||
self.shares_v2_client.update_quotas,
|
||||
self.shares_v2_client.tenant_id,
|
||||
shares=9)
|
||||
|
||||
@ddt.data(
|
||||
('services', '2.0', 'show_quotas'),
|
||||
('services', '2.0', 'default_quotas'),
|
||||
('services', '2.0', 'reset_quotas'),
|
||||
('services', '2.0', 'update_quotas'),
|
||||
('services', '2.6', 'show_quotas'),
|
||||
('services', '2.6', 'default_quotas'),
|
||||
('services', '2.6', 'reset_quotas'),
|
||||
('services', '2.6', 'update_quotas'),
|
||||
('os-services', '2.7', 'show_quotas'),
|
||||
('os-services', '2.7', 'default_quotas'),
|
||||
('os-services', '2.7', 'reset_quotas'),
|
||||
('os-services', '2.7', 'update_quotas'),
|
||||
)
|
||||
@ddt.unpack
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@base.skip_if_microversion_not_supported("2.7")
|
||||
def test_show_quotas_with_wrong_versions(self, url, version, method_name):
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
getattr(self.shares_v2_client, method_name),
|
||||
self.shares_v2_client.tenant_id,
|
||||
version=version, url=url,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user