From 45f741a3b125b8a46aab38f13200e57390c0710c Mon Sep 17 00:00:00 2001 From: Valeriy Ponomaryov Date: Wed, 17 Feb 2016 21:19:39 +0200 Subject: [PATCH] Add possibility to skip quota tests in Tempest We have possibility to disable some sets of Manila functional tests using config options and cannot do it for quota tests. So, add new 'run_quota_tests' option to be able to do so. Change-Id: I0ce3170a2568f24a86573e4f45661a4e862af6ac --- manila_tempest_tests/config.py | 3 +++ manila_tempest_tests/tests/api/admin/test_quotas.py | 11 +++++++++++ .../tests/api/admin/test_quotas_negative.py | 3 +++ manila_tempest_tests/tests/api/test_quotas.py | 8 +++++++- .../tests/api/test_quotas_negative.py | 10 ++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py index e52ca425b8..8183d1cd02 100644 --- a/manila_tempest_tests/config.py +++ b/manila_tempest_tests/config.py @@ -135,6 +135,9 @@ ShareGroup = [ "enabling this opt."), # Switching ON/OFF test suites filtered by features + cfg.BoolOpt("run_quota_tests", + default=True, + help="Defines whether to run quota tests or not."), cfg.BoolOpt("run_extend_tests", default=True, help="Defines whether to run share extend tests or not. " diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py index badedc2170..3c99083950 100644 --- a/manila_tempest_tests/tests/api/admin/test_quotas.py +++ b/manila_tempest_tests/tests/api/admin/test_quotas.py @@ -26,6 +26,9 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest): @classmethod def resource_setup(cls): + if not CONF.share.run_quota_tests: + msg = "Quota tests are disabled." + raise cls.skipException(msg) cls.os = clients.AdminManager() super(SharesAdminQuotasTest, cls).resource_setup() cls.user_id = cls.shares_v2_client.user_id @@ -65,6 +68,14 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest): force_tenant_isolation = True client_version = '2' + @classmethod + def resource_setup(cls): + if not CONF.share.run_quota_tests: + msg = "Quota tests are disabled." + raise cls.skipException(msg) + cls.os = clients.AdminManager() + super(SharesAdminQuotasUpdateTest, cls).resource_setup() + def setUp(self): super(self.__class__, self).setUp() self.client = self.get_client_with_isolated_creds( diff --git a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py index 7850a2d0ee..1cd0ac0a3b 100644 --- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py +++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py @@ -30,6 +30,9 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest): @classmethod def resource_setup(cls): + if not CONF.share.run_quota_tests: + msg = "Quota tests are disabled." + raise cls.skipException(msg) cls.os = clients.AdminManager() super(SharesAdminQuotasNegativeTest, cls).resource_setup() cls.user_id = cls.shares_client.user_id diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py index da6dcce554..77eae4231c 100644 --- a/manila_tempest_tests/tests/api/test_quotas.py +++ b/manila_tempest_tests/tests/api/test_quotas.py @@ -14,16 +14,22 @@ # under the License. import ddt -from tempest import test # noqa +from tempest import config +from tempest import test from manila_tempest_tests.tests.api import base +CONF = config.CONF + @ddt.data class SharesQuotasTest(base.BaseSharesTest): @classmethod def resource_setup(cls): + if not CONF.share.run_quota_tests: + 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 diff --git a/manila_tempest_tests/tests/api/test_quotas_negative.py b/manila_tempest_tests/tests/api/test_quotas_negative.py index e2d2c37691..94dec592de 100644 --- a/manila_tempest_tests/tests/api/test_quotas_negative.py +++ b/manila_tempest_tests/tests/api/test_quotas_negative.py @@ -14,15 +14,25 @@ # under the License. import ddt +from tempest import config from tempest import test from tempest_lib import exceptions as lib_exc from manila_tempest_tests.tests.api import base +CONF = config.CONF + @ddt.ddt class SharesQuotasNegativeTest(base.BaseSharesTest): + @classmethod + def resource_setup(cls): + if not CONF.share.run_quota_tests: + msg = "Quota tests are disabled." + raise cls.skipException(msg) + super(SharesQuotasNegativeTest, cls).resource_setup() + @test.attr(type=["gate", "smoke", "negative"]) def test_get_quotas_with_empty_tenant_id(self): self.assertRaises(lib_exc.NotFound,