Merge "Remove aggressive assert from share server test"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index e52ca42..8183d1c 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -135,6 +135,9 @@
                      "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/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
index 2ccf9b5..7a454fa 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -725,10 +725,15 @@
                     consistency_group_id=consistency_group_id)
 
             if int(time.time()) - start >= self.build_timeout:
+                consistency_group_name = (
+                    consistency_group_name if consistency_group_name else
+                    consistency_group_id
+                )
                 message = ('Consistency Group %s failed to reach %s status '
-                           'within the required time (%s s).' %
+                           'within the required time (%s s). '
+                           'Current status: %s' %
                            (consistency_group_name, status,
-                            self.build_timeout))
+                            self.build_timeout, consistency_group_status))
                 raise exceptions.TimeoutException(message)
 
 ###############
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index badedc2..3c99083 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 @@
 
     @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 @@
     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 7850a2d..1cd0ac0 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 @@
 
     @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 da6dcce..77eae42 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 e2d2c37..94dec59 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,
diff --git a/manila_tempest_tests/tests/api/test_shares.py b/manila_tempest_tests/tests/api/test_shares.py
index 7f8ae9f..46d1558 100644
--- a/manila_tempest_tests/tests/api/test_shares.py
+++ b/manila_tempest_tests/tests/api/test_shares.py
@@ -168,7 +168,7 @@
             "actual_sn": get["share_network_id"],
             "expected_sn": parent["share_network_id"],
         }
-        msg = ("Expected share_network_id %(expected_sn)s for"
+        msg = ("Expected share_network_id %(expected_sn)s for "
                "share %(share)s, but %(actual_sn)s found." % keys)
         self.assertEqual(
             get["share_network_id"], parent["share_network_id"], msg)