Refactoring skip conditions process
Checking ip rules for protocols is placed under 'setUp'
method which prevents running other protocols that do
not support ip rules.
This patch moves the skipping condition under 'skip_checks'
method for each class.
Change-Id: Ieb8082e8314c27b58e0a2d23981068f15b93e336
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index c4cf027..23fc4c4 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -61,18 +61,14 @@
super(ShareScenarioTest, cls).skip_checks()
if not CONF.service_available.manila:
raise cls.skipException("Manila support is required")
+ if cls.ipv6_enabled and not CONF.share.run_ipv6_tests:
+ raise cls.skipException("IPv6 tests are disabled")
+ if cls.protocol not in CONF.share.enable_protocols:
+ message = "%s tests are disabled" % cls.protocol
+ raise cls.skipException(message)
def setUp(self):
base.verify_test_has_appropriate_tags(self)
- if self.ipv6_enabled and not CONF.share.run_ipv6_tests:
- raise self.skipException("IPv6 tests are disabled")
- if self.protocol not in CONF.share.enable_protocols:
- message = "%s tests are disabled" % self.protocol
- raise self.skipException(message)
- if self.protocol not in CONF.share.enable_ip_rules_for_protocols:
- message = ("%s tests for access rules other than IP are disabled" %
- self.protocol)
- raise self.skipException(message)
super(ShareScenarioTest, self).setUp()
self.image_id = None
diff --git a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
index b9b17da..882f7cb 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -44,6 +44,14 @@
* Terminate the instance
"""
+ @classmethod
+ def skip_checks(cls):
+ super(ShareBasicOpsBase, cls).skip_checks()
+ if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+ message = ("%s tests for access rules other than IP are disabled" %
+ cls.protocol)
+ raise cls.skipException(message)
+
def get_ip_and_version_from_export_location(self, export):
export = export.replace('[', '').replace(']', '')
if self.protocol == 'nfs' and ':/' in export:
@@ -116,11 +124,6 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_BACKEND)
def test_write_with_ro_access(self):
'''Test if an instance with ro access can write on the share.'''
- if self.protocol.upper() == 'CIFS':
- msg = ("Skipped for CIFS protocol because RO access is not "
- "supported for shares by IP.")
- raise self.skipException(msg)
-
test_data = "Some test data to write"
instance = self.boot_instance(wait_until="BUILD")
@@ -289,10 +292,6 @@
@testtools.skipUnless(
CONF.share.run_snapshot_tests, "Snapshot tests are disabled.")
def test_write_data_to_share_created_from_snapshot(self):
- if self.protocol.upper() == 'CIFS':
- msg = "Skipped for CIFS protocol because of bug/1649573"
- raise self.skipException(msg)
-
# 1 - Create UVM, ok, created
instance = self.boot_instance(wait_until="BUILD")
@@ -377,10 +376,6 @@
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_read_mountable_snapshot(self):
- if self.protocol.upper() == 'CIFS':
- msg = "Skipped for CIFS protocol because of bug/1649573"
- raise self.skipException(msg)
-
# 1 - Create UVM, ok, created
instance = self.boot_instance(wait_until="BUILD")
@@ -463,6 +458,22 @@
"sudo mount.cifs \"%s\" %s -o guest" % (location, target_dir)
)
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_BACKEND)
+ def test_write_with_ro_access(self):
+ msg = ("Skipped for CIFS protocol because RO access is not "
+ "supported for shares by IP.")
+ raise self.skipException(msg)
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
+ def test_read_mountable_snapshot(self):
+ msg = "Skipped for CIFS protocol because of bug/1649573"
+ raise self.skipException(msg)
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
+ def test_write_data_to_share_created_from_snapshot(self):
+ msg = "Skipped for CIFS protocol because of bug/1649573"
+ raise self.skipException(msg)
+
class TestShareBasicOpsNFSIPv6(TestShareBasicOpsNFS):
ip_version = 6
diff --git a/manila_tempest_tests/tests/scenario/test_share_extend.py b/manila_tempest_tests/tests/scenario/test_share_extend.py
index 446ec25..66d4a87 100644
--- a/manila_tempest_tests/tests/scenario/test_share_extend.py
+++ b/manila_tempest_tests/tests/scenario/test_share_extend.py
@@ -45,6 +45,14 @@
* Terminate the instance
"""
+ @classmethod
+ def skip_checks(cls):
+ super(ShareExtendBase, cls).skip_checks()
+ if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+ message = ("%s tests for access rules other than IP are disabled" %
+ cls.protocol)
+ raise cls.skipException(message)
+
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
def test_create_extend_and_write(self):
default_share_size = CONF.share.share_size
diff --git a/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py b/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
index 8e93335..d58378c 100644
--- a/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
+++ b/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
@@ -51,6 +51,14 @@
* Terminate the instance
"""
+ @classmethod
+ def skip_checks(cls):
+ super(ShareManageUnmanageBase, cls).skip_checks()
+ if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+ message = ("%s tests for access rules other than IP are disabled" %
+ cls.protocol)
+ raise cls.skipException(message)
+
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@testtools.skipUnless(
CONF.share.run_manage_unmanage_tests,
diff --git a/manila_tempest_tests/tests/scenario/test_share_shrink.py b/manila_tempest_tests/tests/scenario/test_share_shrink.py
index 44882c8..1595fbc 100644
--- a/manila_tempest_tests/tests/scenario/test_share_shrink.py
+++ b/manila_tempest_tests/tests/scenario/test_share_shrink.py
@@ -46,6 +46,14 @@
* Terminate the instance
"""
+ @classmethod
+ def skip_checks(cls):
+ super(ShareShrinkBase, cls).skip_checks()
+ if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+ message = ("%s tests for access rules other than IP are disabled" %
+ cls.protocol)
+ raise cls.skipException(message)
+
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@testtools.skipUnless(
CONF.share.run_shrink_tests, 'Shrink share tests are disabled.')