Move all conditions skipped under "skip_checks" method

Manila tempest plugin class structure should be compatible
with tempest project as manila tempest plugin is a plugin
of tempest.
In some cases incompatibility can cause problems.
For example: using "check_uuid" tool for generating UUIDs
for tests does not work properly in manila, Because some
classes are wrapped with conditions skipped.
I suggest to use "skip_checks" method that been used to
evaluate config before tests methods and skip them based
on these checks.

This patch moves all conditions under this method.

Two new functions been added to "skip_checks" method
in order to skip by microversions and reduce a duplicated
code:
  - "check_skip_with_microversion"
  - "check_skip_with_microversion_not_supported"

Change-Id: Id0a15dbfbd3d85d7773c26e252f4cc4d906cf377
This commit is contained in:
lkuchlan 2020-01-07 10:45:45 +02:00 committed by Goutham Pacha Ravi
parent 820064b6d7
commit a3b6f7ad25
41 changed files with 391 additions and 171 deletions

View File

@ -27,10 +27,14 @@ CONF = config.CONF
LATEST_MICROVERSION = CONF.share.max_api_microversion
@base.skip_if_microversion_not_supported("2.9")
@ddt.ddt
class ExportLocationsTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ExportLocationsTest, cls).skip_checks()
utils.check_skip_if_microversion_not_supported('2.9')
@classmethod
def resource_setup(cls):
super(ExportLocationsTest, cls).resource_setup()

View File

@ -18,13 +18,18 @@ from tempest.lib import exceptions as lib_exc
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_not_supported("2.9")
class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ExportLocationsNegativeTest, cls).skip_checks()
utils.check_skip_if_microversion_lt("2.9")
@classmethod
def resource_setup(cls):
super(ExportLocationsNegativeTest, cls).resource_setup()
@ -82,9 +87,13 @@ class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
)
@base.skip_if_microversion_not_supported("2.9")
class ExportLocationsAPIOnlyNegativeTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ExportLocationsAPIOnlyNegativeTest, cls).skip_checks()
utils.check_skip_if_microversion_lt("2.9")
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_get_export_locations_by_nonexistent_share(self):
self.assertRaises(

View File

@ -14,7 +14,6 @@
# under the License.
from tempest import config
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
@ -26,11 +25,16 @@ CONF = config.CONF
_MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationAdminTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationAdminTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ReplicationAdminTest, cls).resource_setup()

View File

@ -24,17 +24,22 @@ CONF = config.CONF
_MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@testtools.skipIf(
CONF.share.multitenancy_enabled,
"Only for driver_handles_share_servers = False driver mode.")
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationAdminTest(base.BaseSharesMixedTest):
class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationActionsAdminTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
if CONF.share.multitenancy_enabled:
raise cls.skipException(
'Only for driver_handles_share_servers = False driver mode.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ReplicationAdminTest, cls).resource_setup()
super(ReplicationActionsAdminTest, cls).resource_setup()
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
cls.replication_type = CONF.share.backend_replication_type

View File

@ -16,7 +16,6 @@
import ddt
from tempest import config
from tempest.lib.common.utils import data_utils
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
@ -28,12 +27,18 @@ CONF = config.CONF
LATEST_MICROVERSION = CONF.share.max_api_microversion
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
@ddt.ddt
class ShareGroupTypesTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareGroupTypesTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupTypesTest, cls).resource_setup()

View File

@ -13,20 +13,26 @@
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
class ShareGroupTypesAdminNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ShareGroupTypesAdminNegativeTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupTypesAdminNegativeTest, cls).resource_setup()

View File

@ -20,15 +20,22 @@ from testtools import testcase as tc
from manila_tempest_tests.common import constants
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
class ShareGroupsTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareGroupsTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupsTest, cls).resource_setup()

View File

@ -15,21 +15,27 @@
from tempest import config
from tempest.lib.common.utils import data_utils
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
class ShareGroupsNegativeTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareGroupsNegativeTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
def test_create_share_group_with_wrong_consistent_snapshot_spec(self):
# Create valid share type for share group type

View File

@ -16,7 +16,7 @@
import ddt
from tempest import config
from tempest.lib.common.utils import data_utils
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
@ -35,9 +35,12 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
# won't be deleted.
@classmethod
@testtools.skipUnless(
CONF.share.run_manage_unmanage_tests,
"Manage/unmanage tests are disabled.")
def skip_checks(cls):
super(ManageNFSShareTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_tests:
raise cls.skipException('Manage/unmanage tests are disabled.')
@classmethod
def resource_setup(cls):
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol

View File

@ -34,9 +34,12 @@ class ManageNFSShareNegativeTest(base.BaseSharesAdminTest):
# won't be deleted.
@classmethod
@testtools.skipUnless(
CONF.share.run_manage_unmanage_tests,
"Manage/unmanage tests are disabled.")
def skip_checks(cls):
super(ManageNFSShareNegativeTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_tests:
raise cls.skipException('Manage/unmanage tests are disabled.')
@classmethod
def resource_setup(cls):
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol

View File

@ -29,12 +29,16 @@ from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.multitenancy_enabled,
'Share servers can be tested only with multitenant drivers.')
@ddt.ddt
class ShareServersAdminTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareServersAdminTest, cls).skip_checks()
if not CONF.share.multitenancy_enabled:
raise cls.skipException(
'Share servers can be tested only with multitenant drivers.')
@classmethod
def resource_setup(cls):
super(ShareServersAdminTest, cls).resource_setup()

View File

@ -25,16 +25,19 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt("2.49")
@testtools.skipUnless(
CONF.share.multitenancy_enabled,
'Multitenancy tests are disabled.')
@testtools.skipUnless(
CONF.share.run_manage_unmanage_tests,
'Manage/unmanage tests are disabled.')
@ddt.ddt
class ManageShareServersTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ManageShareServersTest, cls).skip_checks()
if not CONF.share.multitenancy_enabled:
raise cls.skipException('Multitenancy tests are disabled.')
if not CONF.share.run_manage_unmanage_tests:
raise cls.skipException('Manage/unmanage tests are disabled.')
utils.check_skip_if_microversion_lt('2.49')
@classmethod
def resource_setup(cls):
super(ManageShareServersTest, cls).resource_setup()

View File

@ -29,16 +29,19 @@ CONF = config.CONF
LATEST_MICROVERSION = CONF.share.max_api_microversion
@base.skip_if_microversion_lt("2.49")
@testtools.skipUnless(
CONF.share.multitenancy_enabled,
'Multitenancy tests are disabled')
@testtools.skipUnless(
CONF.share.run_manage_unmanage_tests,
'Manage/unmanage tests are disabled.')
@ddt.ddt
class ManageShareServersNegativeTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ManageShareServersNegativeTest, cls).skip_checks()
if not CONF.share.multitenancy_enabled:
raise cls.skipException('Multitenancy tests are disabled.')
if not CONF.share.run_manage_unmanage_tests:
raise cls.skipException('Manage/unmanage tests are disabled.')
utils.check_skip_if_microversion_lt('2.49')
@classmethod
def resource_setup(cls):
super(ManageShareServersNegativeTest, cls).resource_setup()

View File

@ -15,20 +15,25 @@
import ddt
from tempest import config
import testtools
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests are disabled.')
@base.skip_if_microversion_lt("2.19")
@ddt.ddt
class ShareSnapshotInstancesTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareSnapshotInstancesTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
utils.check_skip_if_microversion_lt("2.19")
@classmethod
def resource_setup(cls):
super(ShareSnapshotInstancesTest, cls).resource_setup()

View File

@ -15,19 +15,24 @@
from tempest import config
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests are disabled.')
@base.skip_if_microversion_lt("2.19")
class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotInstancesNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
utils.check_skip_if_microversion_lt('2.19')
@classmethod
def resource_setup(cls):
super(SnapshotInstancesNegativeTest, cls).resource_setup()
@ -69,11 +74,16 @@ class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
'error')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests are disabled.')
@base.skip_if_microversion_lt("2.19")
class SnapshotInstancesNegativeNoResourceTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotInstancesNegativeNoResourceTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
utils.check_skip_if_microversion_lt('2.19')
@classmethod
def resource_setup(cls):
super(SnapshotInstancesNegativeNoResourceTest, cls).resource_setup()

View File

@ -17,22 +17,28 @@ import ddt
from oslo_utils import uuidutils
import six
from tempest import config
import testtools
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
LATEST_MICROVERSION = CONF.share.max_api_microversion
@base.skip_if_microversion_lt("2.32")
@testtools.skipUnless(CONF.share.run_mount_snapshot_tests and
CONF.share.run_snapshot_tests,
"Mountable snapshots tests are disabled.")
@ddt.ddt
class SnapshotExportLocationsTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotExportLocationsTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
if not CONF.share.run_mount_snapshot_tests:
raise cls.skipException('Mountable snapshots tests are disabled.')
utils.check_skip_if_microversion_lt("2.32")
@classmethod
def setup_clients(cls):
super(SnapshotExportLocationsTest, cls).setup_clients()

View File

@ -15,20 +15,26 @@
from tempest import config
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt("2.32")
@testtools.skipUnless(CONF.share.run_mount_snapshot_tests and
CONF.share.run_snapshot_tests,
"Mountable snapshots tests are disabled.")
class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotExportLocationsNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
if not CONF.share.run_mount_snapshot_tests:
raise cls.skipException('Mountable snapshots tests are disabled.')
utils.check_skip_if_microversion_lt("2.32")
@classmethod
def setup_clients(cls):
super(SnapshotExportLocationsNegativeTest, cls).setup_clients()
@ -107,12 +113,18 @@ class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
)
@testtools.skipUnless(CONF.share.run_mount_snapshot_tests and
CONF.share.run_snapshot_tests,
"Mountable snapshots tests are disabled.")
@base.skip_if_microversion_lt("2.32")
class SnapshotExportLocationsAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotExportLocationsAPIOnlyNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
if not CONF.share.run_mount_snapshot_tests:
raise cls.skipException('Mountable snapshots tests are disabled.')
utils.check_skip_if_microversion_lt('2.32')
@classmethod
def setup_clients(cls):
super(SnapshotExportLocationsAPIOnlyNegativeTest, cls).setup_clients()

View File

@ -17,7 +17,7 @@ import ddt
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
@ -35,17 +35,20 @@ class ManageNFSSnapshotTest(base.BaseSharesAdminTest):
# because cinder volume snapshots won't be deleted.
@classmethod
@base.skip_if_microversion_lt("2.12")
@testtools.skipUnless(
CONF.share.run_manage_unmanage_snapshot_tests,
"Manage/unmanage snapshot tests are disabled.")
def resource_setup(cls):
def skip_checks(cls):
super(ManageNFSSnapshotTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_snapshot_tests:
raise cls.skipException(
'Manage/unmanage snapshot tests are disabled.')
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol
raise cls.skipException(message)
utils.check_skip_if_microversion_lt('2.12')
utils.skip_if_manage_not_supported_for_version()
@classmethod
def resource_setup(cls):
super(ManageNFSSnapshotTest, cls).resource_setup()
# Create share type

View File

@ -16,6 +16,7 @@ from tempest import config
from tempest.lib import decorators
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@ -36,9 +37,13 @@ MESSAGE_KEYS = (
)
@base.skip_if_microversion_lt(MICROVERSION)
class UserMessageTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(UserMessageTest, cls).skip_checks()
utils.check_skip_if_microversion_lt(MICROVERSION)
def setUp(self):
super(UserMessageTest, self).setUp()
self.message = self.create_user_message()

View File

@ -16,15 +16,20 @@ from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
MICROVERSION = '2.37'
@base.skip_if_microversion_lt(MICROVERSION)
class UserMessageNegativeTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(UserMessageNegativeTest, cls).skip_checks()
utils.check_skip_if_microversion_lt(MICROVERSION)
def setUp(self):
super(UserMessageNegativeTest, self).setUp()
self.message = self.create_user_message()

View File

@ -257,6 +257,9 @@ class BaseSharesTest(test.BaseTestCase):
super(BaseSharesTest, cls).skip_checks()
if not CONF.service_available.manila:
raise cls.skipException("Manila support is required")
if not any(p in CONF.share.enable_protocols for p in cls.protocols):
skip_msg = "%s tests are disabled" % CONF.share.enable_protocols
raise cls.skipException(skip_msg)
@classmethod
def verify_nonempty(cls, *args):
@ -301,15 +304,6 @@ class BaseSharesTest(test.BaseTestCase):
}
cls.class_resources.insert(0, resource)
@classmethod
def resource_setup(cls):
if not (any(p in CONF.share.enable_protocols
for p in cls.protocols) and
CONF.service_available.manila):
skip_msg = "Manila is disabled"
raise cls.skipException(skip_msg)
super(BaseSharesTest, cls).resource_setup()
def setUp(self):
super(BaseSharesTest, self).setUp()
self.addCleanup(self.clear_isolated_creds)

View File

@ -24,17 +24,12 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt(
constants.MIN_SHARE_ACCESS_METADATA_MICROVERSION)
@ddt.ddt
class AccessRulesMetadataTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AccessRulesMetadataTest, cls).resource_setup()
# The share access rule metadata doesn't care about the value of
# access type, access protocol, access_to, so we only get one of
# the value that the driver support.
def skip_checks(cls):
super(AccessRulesMetadataTest, cls).skip_checks()
if not (any(p in CONF.share.enable_ip_rules_for_protocols
for p in cls.protocols) or
any(p in CONF.share.enable_user_rules_for_protocols
@ -45,6 +40,16 @@ class AccessRulesMetadataTest(base.BaseSharesMixedTest):
for p in cls.protocols)):
cls.message = "Rule tests are disabled"
raise cls.skipException(cls.message)
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_ACCESS_METADATA_MICROVERSION)
@classmethod
def resource_setup(cls):
super(AccessRulesMetadataTest, cls).resource_setup()
# The share access rule metadata doesn't care about the value of
# access type, access protocol, access_to, so we only get one of
# the value that the driver support.
if CONF.share.enable_ip_rules_for_protocols:
cls.protocol = CONF.share.enable_ip_rules_for_protocols[0]
cls.access_type = "ip"

View File

@ -25,14 +25,12 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt(
constants.MIN_SHARE_ACCESS_METADATA_MICROVERSION)
@ddt.ddt
class AccessesMetadataNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AccessesMetadataNegativeTest, cls).resource_setup()
def skip_checks(cls):
super(AccessesMetadataNegativeTest, cls).skip_checks()
if not (any(p in CONF.share.enable_ip_rules_for_protocols
for p in cls.protocols) or
any(p in CONF.share.enable_user_rules_for_protocols
@ -43,6 +41,13 @@ class AccessesMetadataNegativeTest(base.BaseSharesMixedTest):
for p in cls.protocols)):
cls.message = "Rule tests are disabled"
raise cls.skipException(cls.message)
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_ACCESS_METADATA_MICROVERSION)
@classmethod
def resource_setup(cls):
super(AccessesMetadataNegativeTest, cls).resource_setup()
if CONF.share.enable_ip_rules_for_protocols:
cls.protocol = CONF.share.enable_ip_rules_for_protocols[0]
cls.access_type = "ip"

View File

@ -17,11 +17,16 @@ from tempest.lib import exceptions as lib_exc
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
@base.skip_if_microversion_not_supported("2.7")
class AvailabilityZonesNegativeTest(base.BaseSharesTest):
@classmethod
def skip_checks(cls):
super(AvailabilityZonesNegativeTest, cls).skip_checks()
utils.check_skip_if_microversion_not_supported('2.7')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_list_availability_zones_api_not_found_with_legacy_url(self):
# NOTE(vponomaryov): remove this test with removal of availability zone

View File

@ -30,11 +30,16 @@ DETAIL_KEYS = SUMMARY_KEYS + ['availability_zone', 'updated_at',
'share_network_id', 'created_at']
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ReplicationTest, cls).resource_setup()
@ -348,11 +353,16 @@ class ReplicationTest(base.BaseSharesMixedTest):
constants.REPLICATION_STATE_ACTIVE, replica['replica_state'])
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationActionsTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationActionsTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ReplicationActionsTest, cls).resource_setup()

View File

@ -25,11 +25,15 @@ CONF = config.CONF
LATEST_MICROVERSION = CONF.share.max_api_microversion
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@ddt.ddt
class ReplicationExportLocationsTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationExportLocationsTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
@classmethod
def resource_setup(cls):
super(ReplicationExportLocationsTest, cls).resource_setup()

View File

@ -24,10 +24,14 @@ from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
class ReplicationExportLocationsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationExportLocationsNegativeTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
@classmethod
def resource_setup(cls):
super(ReplicationExportLocationsNegativeTest, cls).resource_setup()

View File

@ -28,11 +28,16 @@ CONF = config.CONF
_MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationNegativeTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ReplicationNegativeTest, cls).resource_setup()
@ -238,11 +243,16 @@ class ReplicationNegativeTest(base.BaseSharesMixedTest):
self.replica_zone)
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationAPIOnlyNegativeTest(base.BaseSharesTest):
@classmethod
def skip_checks(cls):
super(ReplicationAPIOnlyNegativeTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_get_replica_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,

View File

@ -26,13 +26,18 @@ CONF = config.CONF
_MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationSnapshotTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ReplicationSnapshotTest, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests disabled.')
utils.check_skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ReplicationSnapshotTest, cls).resource_setup()

View File

@ -27,8 +27,6 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_not_supported(
constants.REVERT_TO_SNAPSHOT_MICROVERSION)
@ddt.ddt
class RevertToSnapshotTest(base.BaseSharesMixedTest):
@ -45,6 +43,9 @@ class RevertToSnapshotTest(base.BaseSharesMixedTest):
msg = "Snapshot tests are disabled."
raise cls.skipException(msg)
utils.check_skip_if_microversion_not_supported(
constants.REVERT_TO_SNAPSHOT_MICROVERSION)
@classmethod
def resource_setup(cls):
super(RevertToSnapshotTest, cls).resource_setup()

View File

@ -22,12 +22,11 @@ from testtools import testcase as tc
from manila_tempest_tests.common import constants
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_not_supported(
constants.REVERT_TO_SNAPSHOT_MICROVERSION)
@ddt.ddt
class RevertToSnapshotNegativeTest(base.BaseSharesMixedTest):
@ -44,6 +43,9 @@ class RevertToSnapshotNegativeTest(base.BaseSharesMixedTest):
msg = "Snapshot tests are disabled."
raise cls.skipException(msg)
utils.check_skip_if_microversion_not_supported(
constants.REVERT_TO_SNAPSHOT_MICROVERSION)
@classmethod
def resource_setup(cls):
super(RevertToSnapshotNegativeTest, cls).resource_setup()

View File

@ -17,7 +17,6 @@
import ddt
from tempest import config
from tempest.lib.common.utils import data_utils
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
@ -27,13 +26,19 @@ from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
@ddt.ddt
class ShareGroupActionsTest(base.BaseSharesMixedTest):
"""Covers share group functionality."""
@classmethod
def skip_checks(cls):
super(ShareGroupActionsTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupActionsTest, cls).resource_setup()
@ -338,11 +343,17 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
share['share_network_id'])
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
class ShareGroupRenameTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ShareGroupRenameTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupRenameTest, cls).resource_setup()

View File

@ -16,22 +16,28 @@
import ddt
from tempest import config
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
@ddt.ddt
class ShareGroupsTest(base.BaseSharesMixedTest):
"""Covers share group functionality."""
@classmethod
def skip_checks(cls):
super(ShareGroupsTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupsTest, cls).resource_setup()

View File

@ -16,20 +16,27 @@
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ShareGroupsNegativeTest, cls).skip_checks()
if not CONF.share.run_share_group_tests:
raise cls.skipException('Share Group tests disabled.')
utils.check_skip_if_microversion_lt(
constants.MIN_SHARE_GROUP_MICROVERSION)
@classmethod
def resource_setup(cls):
super(ShareGroupsNegativeTest, cls).resource_setup()

View File

@ -24,10 +24,14 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt("2.51")
@ddt.ddt
class ShareNetworkSubnetsTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ShareNetworkSubnetsTest, cls).skip_checks()
utils.check_skip_if_microversion_lt("2.51")
@classmethod
def resource_setup(cls):
super(ShareNetworkSubnetsTest, cls).resource_setup()

View File

@ -27,10 +27,14 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt("2.51")
@ddt.ddt
class ShareNetworkSubnetsNegativeTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareNetworkSubnetsNegativeTest, cls).skip_checks()
utils.check_skip_if_microversion_lt("2.51")
@classmethod
def resource_setup(cls):
super(ShareNetworkSubnetsNegativeTest, cls).resource_setup()

View File

@ -16,15 +16,20 @@ from tempest.lib.common.utils import data_utils
import testtools
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
tc = testtools.testcase
CONF = config.CONF
@base.skip_if_microversion_not_supported("2.48")
@ddt.ddt
class ShareTypeAvailabilityZonesTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ShareTypeAvailabilityZonesTest, cls).skip_checks()
utils.check_skip_if_microversion_not_supported("2.48")
@classmethod
def resource_setup(cls):
super(ShareTypeAvailabilityZonesTest, cls).resource_setup()

View File

@ -15,12 +15,17 @@ from tempest.lib import exceptions as lib_exc
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
@base.skip_if_microversion_not_supported("2.48")
@ddt.ddt
class ShareTypeAvailabilityZonesNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(ShareTypeAvailabilityZonesNegativeTest, cls).skip_checks()
utils.check_skip_if_microversion_not_supported('2.48')
@classmethod
def resource_setup(cls):
super(ShareTypeAvailabilityZonesNegativeTest, cls).resource_setup()
@ -52,7 +57,6 @@ class ShareTypeAvailabilityZonesNegativeTest(base.BaseSharesMixedTest):
client=self.admin_shares_v2_client)
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@base.skip_if_microversion_not_supported("2.48")
def test_share_type_azs_filter_by_invalid_azs_extra_spec(self):
self.admin_shares_v2_client.update_share_type_extra_spec(
self.share_type_id, self.az_spec, self.valid_azs_spec)

View File

@ -17,10 +17,10 @@ import six
import ddt
from tempest import config
import testtools
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@ -60,22 +60,27 @@ class BaseShareSnapshotRulesTest(base.BaseSharesMixedTest):
self.snapshot['id'], rule['id'])
@base.skip_if_microversion_lt("2.32")
@testtools.skipUnless(CONF.share.run_mount_snapshot_tests and
CONF.share.run_snapshot_tests,
'Mountable snapshots tests are disabled.')
@ddt.ddt
class ShareSnapshotIpRulesForNFSTest(BaseShareSnapshotRulesTest):
protocol = "nfs"
@classmethod
def resource_setup(cls):
def skip_checks(cls):
super(ShareSnapshotIpRulesForNFSTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
if not CONF.share.run_mount_snapshot_tests:
raise cls.skipException('Mountable snapshots tests are disabled.')
if not (cls.protocol in CONF.share.enable_protocols and
cls.protocol in CONF.share.enable_ip_rules_for_protocols):
msg = "IP rule tests for %s protocol are disabled." % cls.protocol
raise cls.skipException(msg)
super(ShareSnapshotIpRulesForNFSTest, cls).resource_setup()
utils.check_skip_if_microversion_lt('2.32')
@classmethod
def resource_setup(cls):
super(ShareSnapshotIpRulesForNFSTest, cls).resource_setup()
cls.access_type = "ip"
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@ -84,22 +89,25 @@ class ShareSnapshotIpRulesForNFSTest(BaseShareSnapshotRulesTest):
self._test_create_delete_access_rules(access_to)
@base.skip_if_microversion_lt("2.32")
@testtools.skipUnless(CONF.share.run_mount_snapshot_tests,
'Mountable snapshots tests are disabled.')
@ddt.ddt
class ShareSnapshotUserRulesForCIFSTest(BaseShareSnapshotRulesTest):
protocol = "cifs"
@classmethod
def resource_setup(cls):
def skip_checks(cls):
super(ShareSnapshotUserRulesForCIFSTest, cls).skip_checks()
if not CONF.share.run_mount_snapshot_tests:
raise cls.skipException('Mountable snapshots tests are disabled.')
if not (cls.protocol in CONF.share.enable_protocols and
cls.protocol in CONF.share.enable_user_rules_for_protocols):
msg = ("User rule tests for %s protocol are "
"disabled." % cls.protocol)
raise cls.skipException(msg)
super(ShareSnapshotUserRulesForCIFSTest, cls).resource_setup()
utils.check_skip_if_microversion_lt('2.32')
@classmethod
def resource_setup(cls):
super(ShareSnapshotUserRulesForCIFSTest, cls).resource_setup()
cls.access_type = "user"
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)

View File

@ -16,7 +16,6 @@
import ddt
from tempest import config
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
@ -26,21 +25,27 @@ from manila_tempest_tests import utils
CONF = config.CONF
@base.skip_if_microversion_lt("2.32")
@testtools.skipUnless(CONF.share.run_mount_snapshot_tests and
CONF.share.run_snapshot_tests,
'Mountable snapshots tests are disabled.')
@ddt.ddt
class SnapshotIpRulesForNFSNegativeTest(
test_snapshot_rules.BaseShareSnapshotRulesTest):
protocol = "nfs"
@classmethod
def resource_setup(cls):
def skip_checks(cls):
super(SnapshotIpRulesForNFSNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
raise cls.skipException('Snapshot tests are disabled.')
if not CONF.share.run_mount_snapshot_tests:
raise cls.skipException('Mountable snapshots tests are disabled.')
if not (cls.protocol in CONF.share.enable_protocols and
cls.protocol in CONF.share.enable_ip_rules_for_protocols):
msg = "IP rule tests for %s protocol are disabled." % cls.protocol
raise cls.skipException(msg)
utils.check_skip_if_microversion_lt('2.32')
@classmethod
def resource_setup(cls):
super(SnapshotIpRulesForNFSNegativeTest, cls).resource_setup()
# create share type
extra_specs = {'mount_snapshot_support': 'True'}

View File

@ -92,6 +92,19 @@ def skip_if_microversion_lt(microversion):
return lambda f: f
def check_skip_if_microversion_lt(microversion):
if is_microversion_lt(CONF.share.max_api_microversion, microversion):
reason = ("Skipped. Test requires microversion greater than or "
"equal to '%s'." % microversion)
raise testtools.TestCase.skipException(reason)
def check_skip_if_microversion_not_supported(microversion):
if not is_microversion_supported(microversion):
reason = ("Skipped. Test requires microversion '%s'." % microversion)
raise testtools.TestCase.skipException(reason)
def rand_ip(network=False):
"""This uses the TEST-NET-3 range of reserved IP addresses.