Add new configuration section for share features

We are currently skipping feature tests in a confusing way,
for example regarding snapshot feature we use two configuration
options: ``capability_snapshot_support``, ``run_snapshot_tests``
So in order to run a snapshot test we need enable these two
configuration options.

This patch suggests using a new single configuration option,
like other openstack services, called 'share-feature-enabled'.
This way we can skip tests depending on the features that the
environment supports.

This patch is part of the patches that will be uploaded later.
This patch removes the configuration options below:
``capability_snapshot_support``
``capability_create_share_from_snapshot_support``
``run_snapshot_tests``
``run_manage_unmanage_snapshot_tests``

This patch adds a new decorator used to set an attr for each
share feature and skips a test in case the environment does
not support the feature.

Change-Id: Ia41761352f1c3fb5004eeeda2d789a3ea6a8fc25
This commit is contained in:
lkuchlan 2021-04-14 11:16:41 +03:00
parent cbab9fe0c7
commit 1dfcc82e13
43 changed files with 339 additions and 100 deletions

View File

@ -118,14 +118,20 @@ ShareGroup = [
help="Defines extra spec that satisfies specific back end "
"capability called 'snapshot_support' and will be used "
"for setting up custom share type. Defaults to value of "
"other config option 'run_snapshot_tests'."),
"other config option 'run_snapshot_tests'.",
deprecated_for_removal=True,
deprecated_reason="New configuration section for share "
"features, called 'share-feature-enabled'"),
cfg.BoolOpt("capability_create_share_from_snapshot_support",
help="Defines extra spec that satisfies specific back end "
"capability called 'create_share_from_snapshot_support' "
"and will be used for setting up a custom share type. "
"Defaults to the value of run_snapshot_tests. Set it to "
"False if the driver being tested does not support "
"creating shares from snapshots."),
"creating shares from snapshots.",
deprecated_for_removal=True,
deprecated_reason="New configuration section for share "
"features, called 'share-feature-enabled'"),
cfg.BoolOpt("capability_revert_to_snapshot_support",
deprecated_for_removal=True,
deprecated_reason="Redundant configuration option. Please use "
@ -233,7 +239,10 @@ ShareGroup = [
default=True,
help="Defines whether to run tests that use share snapshots "
"or not. Disable this feature if used driver doesn't "
"support it."),
"support it.",
deprecated_for_removal=True,
deprecated_reason="New configuration section for share "
"features, called 'share-feature-enabled'"),
cfg.BoolOpt("run_revert_to_snapshot_tests",
default=False,
help="Defines whether to run tests that revert shares "
@ -277,7 +286,10 @@ ShareGroup = [
default=False,
help="Defines whether to run manage/unmanage snapshot tests "
"or not. These tests may leave orphaned resources, so be "
"careful enabling this opt."),
"careful enabling this opt.",
deprecated_for_removal=True,
deprecated_reason="New configuration section for share "
"features, called 'share-feature-enabled'"),
cfg.BoolOpt("run_mount_snapshot_tests",
default=False,
help="Enable or disable mountable snapshot tests."),
@ -360,3 +372,33 @@ ShareGroup = [
default={'dummy': True},
help="Share backup driver options specified as dict."),
]
share_feature_group = cfg.OptGroup(name='share-feature-enabled',
title='Enabled Share Features')
ShareFeaturesGroup = [
cfg.BoolOpt('snapshot',
default=False,
help='Does the environment support the creation of share '
'snapshot?'),
cfg.BoolOpt('share_from_snapshot',
default=False,
help="Defines extra spec that satisfies specific back end "
"capability called 'create_share_from_snapshot_support' "
"and will be used for setting up a custom share type. "),
cfg.BoolOpt('revert_to_snapshot',
default=False,
help="Defines extra spec that satisfies specific back end "
"capability called 'revert_to_snapshot_support' "
"and will be used for setting up custom share type. "),
cfg.BoolOpt('manage_share',
default=False,
help="Defines whether to run manage/unmanage tests or not. "
"These test may leave orphaned resources, so be careful "
"enabling this opt."),
cfg.BoolOpt('manage_snapshot',
default=False,
help="Defines whether to run manage/unmanage snapshot tests "
"or not. These tests may leave orphaned resources, so be "
"careful enabling this opt."),
]

View File

@ -37,6 +37,9 @@ class ManilaTempestPlugin(plugins.TempestPlugin):
group='enforce_scope')
conf.register_group(config_share.share_group)
conf.register_opts(config_share.ShareGroup, group='share')
conf.register_group(config_share.share_feature_group)
conf.register_opts(config_share.ShareFeaturesGroup,
group='share_feature_enabled')
# NOTE(vponomaryov): Set options 'capability_snapshot_support' and
# 'capability_create_share_from_snapshot_support' to opt

View File

@ -90,3 +90,7 @@ class ShareServerMigrationException(exceptions.TempestException):
class ShareBackupBuildErrorException(exceptions.TempestException):
message = ("Share backup %(backup_id)s failed and is in ERROR status")
class ShareFeatureEnabled(exceptions.TempestException):
message = "Invalid share feature"

View File

@ -38,7 +38,8 @@ class AdminActionsTest(base.BaseSharesAdminTest):
cls.bad_status = "error_deleting"
# create share type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -80,6 +81,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
@ddt.data("error", "available", "error_deleting", "deleting", "creating")
def test_reset_snapshot_state(self, status):
snapshot = self.create_snapshot_wait_for_active(self.share["id"])
@ -142,6 +144,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_force_delete_snapshot(self):
sn = self.create_snapshot_wait_for_active(self.share["id"])

View File

@ -35,7 +35,8 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
cls.member_client = cls.shares_v2_client
# create share type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -46,7 +47,8 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
cls.admin_client.get_instances_of_share(
cls.share["id"])['share_instances'][0]
)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
cls.snapshot = cls.create_snapshot_wait_for_active(
cls.share["id"], client=cls.admin_client)
@ -72,6 +74,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_reset_snapshot_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest,
self.admin_client.reset_state,
@ -102,6 +105,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_try_reset_snapshot_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
@ -128,6 +132,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_try_force_delete_snapshot_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
@ -188,6 +193,7 @@ class AdminActionsAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_force_delete_nonexistent_snapshot(self):
self.assertRaises(lib_exc.NotFound,
self.admin_client.force_delete,
@ -224,6 +230,7 @@ class AdminActionsAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_reset_nonexistent_snapshot_state(self):
self.assertRaises(lib_exc.NotFound, self.admin_client.reset_state,
"fake", s_type="snapshots")

View File

@ -414,6 +414,7 @@ class MigrationCancelNFSTest(MigrationBase):
@utils.skip_if_microversion_not_supported("2.29")
@testtools.skipUnless(
CONF.share.run_snapshot_tests, 'Snapshot tests are disabled.')
@utils.features('snapshot')
@testtools.skipUnless(
CONF.share.run_driver_assisted_migration_tests,
'Driver-assisted migration tests are disabled.')
@ -598,6 +599,7 @@ class MigrationOfShareWithSnapshotNFSTest(MigrationBase):
@utils.skip_if_microversion_not_supported("2.29")
@testtools.skipUnless(
CONF.share.run_snapshot_tests, 'Snapshot tests are disabled.')
@utils.features('snapshot')
@testtools.skipUnless(
CONF.share.run_driver_assisted_migration_tests,
'Driver-assisted migration tests are disabled.')
@ -640,6 +642,7 @@ class MigrationWithDifferentSnapshotSupportNFSTest(MigrationBase):
@utils.skip_if_microversion_not_supported("2.29")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests are disabled.')
@utils.features('snapshot')
@ddt.data(True, False)
def test_migrate_share_to_snapshot_capability_share_type(
self, force_host_assisted):
@ -653,6 +656,7 @@ class MigrationWithDifferentSnapshotSupportNFSTest(MigrationBase):
@utils.skip_if_microversion_not_supported("2.29")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests are disabled.')
@utils.features('snapshot')
@ddt.data(True, False)
def test_migrate_share_to_no_snapshot_capability_share_type(
self, force_host_assisted):

View File

@ -59,7 +59,8 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
# create share type (generic)
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -142,6 +143,7 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
@utils.skip_if_microversion_not_supported("2.29")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_migrate_share_with_snapshot(self):
snap = self.create_snapshot_wait_for_active(self.share['id'])
self.assertRaises(
@ -323,7 +325,8 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
property_to_evaluate = {
'extend_share': CONF.share.run_extend_tests,
'shrink_share': CONF.share.run_shrink_tests,
'create_snapshot': CONF.share.run_snapshot_tests,
'create_snapshot': (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests),
}
if not property_to_evaluate[method_name]:
raise self.skipException(method_name + 'tests are disabled.')

View File

@ -201,9 +201,11 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
super(SharesAdminQuotasUpdateTest, cls).resource_setup()
# create share type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -929,6 +931,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Tests for shares from snapshots are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_share_group_quotas_usages(self):
# Set quotas for project (3 SG, 1 SGS) and user (2 SG, 1 SGS)
self.update_quotas(self.tenant_id,

View File

@ -56,7 +56,8 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
# create share type
extra_specs = {"replication_type": cls.replication_type}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({"snapshot_support": True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -111,6 +112,7 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@testtools.skipUnless(CONF.share.run_manage_unmanage_tests,
'Manage/Unmanage Tests are disabled.')
@utils.features('manage_share')
def test_manage_share_for_replication_type(self):
"""Manage a share with replication share type."""
# Create a share and unmanage it
@ -148,6 +150,7 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_manage_unmanage_tests,
'Manage/Unmanage Tests are disabled.')
@utils.features('manage_share')
def test_unmanage_replicated_share_with_replica(self):
"""Try to unmanage a share having replica."""
# Create a share replica before unmanaging the share
@ -162,6 +165,7 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@testtools.skipUnless(CONF.share.run_manage_unmanage_tests,
'Manage/Unmanage Tests are disabled.')
@utils.features('manage_share')
def test_unmanage_replicated_share_with_no_replica(self):
"""Unmanage a replication type share that does not have replica."""
share = self.create_share(size=CONF.share.share_size,
@ -176,6 +180,7 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_manage_unmanage_snapshot_tests,
'Manage/Unmanage Snapshot Tests are disabled.')
@utils.features('manage_snapshot')
def test_manage_replicated_share_snapshot(self):
"""Try to manage a snapshot of the replicated."""
# Create a share replica before managing the snapshot
@ -192,6 +197,7 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_manage_unmanage_snapshot_tests,
'Manage/Unmanage Snapshot Tests are disabled.')
@utils.features('manage_snapshot')
def test_unmanage_replicated_share_snapshot(self):
"""Try to unmanage a snapshot of the replicated share with replica."""
# Create a share replica before unmanaging the snapshot

View File

@ -46,7 +46,8 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
super(ShareGroupsTest, cls).resource_setup()
# Create 2 share_types
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -180,6 +181,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
CONF.share.multitenancy_enabled, "Only for multitenancy.")
@testtools.skipUnless(
CONF.share.run_snapshot_tests, "Snapshot tests are disabled.")
@utils.features('snapshot')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
def test_create_sg_from_snapshot_verify_share_server_information_min(self):
# Create a share group

View File

@ -39,7 +39,8 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ManageNFSShareTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_tests:
if not (CONF.share_feature_enabled.manage_share or
CONF.share.run_manage_unmanage_tests):
raise cls.skipException('Manage/unmanage tests are disabled.')
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol

View File

@ -38,7 +38,8 @@ class ManageNFSShareNegativeTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ManageNFSShareNegativeTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_tests:
if not (CONF.share_feature_enabled.manage_share or
CONF.share.run_manage_unmanage_tests):
raise cls.skipException('Manage/unmanage tests are disabled.')
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol
@ -54,7 +55,8 @@ class ManageNFSShareNegativeTest(base.BaseSharesAdminTest):
cls.extra_specs = {
'storage_protocol': CONF.share.capability_storage_protocol,
'driver_handles_share_servers': CONF.share.multitenancy_enabled,
'snapshot_support': CONF.share.capability_snapshot_support,
'snapshot_support': (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support)
}
cls.st = cls.create_share_type(
@ -296,6 +298,7 @@ class ManageNFSShareNegativeTest(base.BaseSharesAdminTest):
@decorators.idempotent_id('7cad4763-8f78-46a5-aeeb-6ca174284d3d')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests are disabled.')
@utils.features('snapshot')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
def test_unmanage_share_with_snapshot(self):
# A share with snapshot cannot be unmanaged

View File

@ -34,7 +34,8 @@ class ManageShareServersTest(base.BaseSharesAdminTest):
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:
if not (CONF.share_feature_enabled.manage_share or
CONF.share.run_manage_unmanage_tests):
raise cls.skipException('Manage/unmanage tests are disabled.')
utils.check_skip_if_microversion_not_supported('2.49')

View File

@ -39,7 +39,8 @@ class ManageShareServersNegativeTest(base.BaseSharesAdminTest):
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:
if not (CONF.share_feature_enabled.manage_share or
CONF.share.run_manage_unmanage_tests):
raise cls.skipException('Manage/unmanage tests are disabled.')
utils.check_skip_if_microversion_not_supported('2.49')

View File

@ -58,7 +58,8 @@ class MigrationShareServerBase(base.BaseSharesAdminTest):
# create share type (generic)
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)

View File

@ -17,6 +17,7 @@ from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
@ -24,6 +25,7 @@ from manila_tempest_tests.common import constants
from manila_tempest_tests.common import waiters
from manila_tempest_tests.tests.api.admin import test_share_servers_migration
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
CONF = config.CONF
@ -37,7 +39,8 @@ class MigrationShareServerNegative(
"""Setup migration for negative tests."""
extra_specs = {
'driver_handles_share_servers': CONF.share.multitenancy_enabled}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs['snapshot_support'] = True
share_type = cls.create_share_type(
name=data_utils.rand_name("tempest-share-type"),
@ -257,11 +260,12 @@ class ShareServerMigrationStartNegativesNFS(MigrationShareServerNegative):
@decorators.idempotent_id('5b904db3-fc36-4c35-a8ef-cf6b80315388')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(
CONF.share.capability_snapshot_support,
'Snapshot tests are disabled or unsupported.')
@utils.features('snapshot')
def test_share_server_migration_start_try_create_snapshot(self):
"""Try create snap during a server migration."""
if not CONF.share.capability_snapshot_support:
raise self.skipException(
'Snapshot tests are disabled or unsupported.')
self.assertRaises(
lib_exc.BadRequest,
self.shares_v2_client.create_snapshot,

View File

@ -31,7 +31,8 @@ class ShareSnapshotInstancesTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ShareSnapshotInstancesTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
raise cls.skipException('Snapshot tests are disabled.')
utils.check_skip_if_microversion_not_supported("2.19")

View File

@ -29,7 +29,8 @@ class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotInstancesNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
raise cls.skipException('Snapshot tests are disabled.')
utils.check_skip_if_microversion_not_supported('2.19')
@ -84,7 +85,8 @@ class SnapshotInstancesNegativeNoResourceTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotInstancesNegativeNoResourceTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
raise cls.skipException('Snapshot tests are disabled.')
utils.check_skip_if_microversion_not_supported('2.19')

View File

@ -38,9 +38,11 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
# create share type for share filtering purposes
specs = {"storage_protocol": CONF.share.capability_storage_protocol}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=specs)
cls.share_type_id = cls.share_type['id']
@ -59,7 +61,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
share_type_id=cls.share_type_id,
))
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(
@ -67,7 +70,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
cls.snap = cls.create_snapshot_wait_for_active(
cls.shares[0]["id"], cls.snap_name, cls.snap_desc)
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
# create second share from snapshot for purposes of sorting and
# snapshot filtering
@ -166,7 +170,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
for share in shares:
self.assertDictContainsSubset(
filters['metadata'], share['metadata'])
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
@decorators.idempotent_id('d884c91e-88f5-4e42-83d9-ec3b440af893')
@ -305,6 +310,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('share_from_snapshot')
def test_list_shares_with_detail_filter_by_snapshot_id(self):
filters = {'snapshot_id': self.snap['id']}
@ -370,6 +376,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_get_snapshot(self):
# get snapshot
@ -401,6 +408,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_list_snapshots(self):
# list share snapshots
@ -419,6 +427,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_list_snapshots_with_detail(self):
# list share snapshots

View File

@ -32,7 +32,8 @@ class SnapshotExportLocationsTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotExportLocationsTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
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.')

View File

@ -29,7 +29,8 @@ class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotExportLocationsNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
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.')
@ -130,7 +131,8 @@ class SnapshotExportLocationsAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SnapshotExportLocationsAPIOnlyNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
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.')

View File

@ -39,7 +39,8 @@ class ManageNFSSnapshotTest(base.BaseSharesAdminTest):
@classmethod
def skip_checks(cls):
super(ManageNFSSnapshotTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_snapshot_tests:
if not (CONF.share_feature_enabled.manage_snapshot or
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:
@ -58,7 +59,8 @@ class ManageNFSSnapshotTest(base.BaseSharesAdminTest):
cls.extra_specs = {
'storage_protocol': CONF.share.capability_storage_protocol,
'driver_handles_share_servers': CONF.share.multitenancy_enabled,
'snapshot_support': CONF.share.capability_snapshot_support,
'snapshot_support': (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support),
}
cls.st = cls.create_share_type(

View File

@ -33,17 +33,21 @@ class ManageNFSSnapshotNegativeTest(base.BaseSharesAdminTest):
protocol = 'nfs'
@classmethod
@utils.skip_if_microversion_not_supported("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(ManageNFSSnapshotNegativeTest, cls).skip_checks()
if not (CONF.share_feature_enabled.manage_snapshot or
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_not_supported('2.12')
utils.skip_if_manage_not_supported_for_version()
@classmethod
def resource_setup(cls):
super(ManageNFSSnapshotNegativeTest, cls).resource_setup()
# Create share type
@ -52,7 +56,8 @@ class ManageNFSSnapshotNegativeTest(base.BaseSharesAdminTest):
'storage_protocol': CONF.share.capability_storage_protocol,
'driver_handles_share_servers': CONF.share.multitenancy_enabled,
'snapshot_support': str(
CONF.share.capability_snapshot_support),
(CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support)),
}
cls.st = cls.create_share_type(

View File

@ -35,7 +35,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
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:
if not (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
raise cls.skipException('Snapshot tests disabled.')
utils.check_skip_if_microversion_not_supported(
@ -59,7 +60,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
"replication_type": cls.replication_type,
"snapshot_support": True,
}
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
extra_specs.update({
"create_share_from_snapshot_support": True,
})
@ -108,7 +110,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
snapshot['id'])['snapshot']
self.assertEqual(constants.STATUS_AVAILABLE, snapshot['status'])
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
self.create_share(share_type_id=self.share_type_id,
snapshot_id=snapshot['id'],
share_network_id=self.sn_id)
@ -150,7 +153,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
snapshot['id'])['snapshot']
self.assertEqual(constants.STATUS_AVAILABLE, snapshot['status'])
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
self.create_share(share_type_id=self.share_type_id,
snapshot_id=snapshot['id'],
share_network_id=self.sn_id)
@ -201,7 +205,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
snapshot2['id'])['snapshot']
self.assertEqual(constants.STATUS_AVAILABLE, snapshot2['status'])
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
self.create_share(share_type_id=self.share_type_id,
snapshot_id=snapshot1['id'],
share_network_id=self.sn_id)
@ -237,6 +242,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('share_from_snapshot')
def test_create_replica_from_snapshot_share(self):
"""Test replica for a share that was created from snapshot."""

View File

@ -38,10 +38,9 @@ class RevertToSnapshotTest(base.BaseSharesMixedTest):
if not CONF.share.run_revert_to_snapshot_tests:
msg = "Revert to snapshot tests are disabled."
raise cls.skipException(msg)
if not CONF.share.capability_snapshot_support:
msg = "Snapshot support is disabled."
raise cls.skipException(msg)
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support or
CONF.share.run_snapshot_tests):
msg = "Snapshot tests are disabled."
raise cls.skipException(msg)

View File

@ -37,10 +37,9 @@ class RevertToSnapshotNegativeTest(base.BaseSharesMixedTest):
if not CONF.share.run_revert_to_snapshot_tests:
msg = "Revert to snapshot tests are disabled."
raise cls.skipException(msg)
if not CONF.share.capability_snapshot_support:
msg = "Snapshot support is disabled."
raise cls.skipException(msg)
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support or
CONF.share.run_snapshot_tests):
msg = "Snapshot tests are disabled."
raise cls.skipException(msg)

View File

@ -49,14 +49,16 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest):
# create share_type
extra_specs = None
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
extra_specs = {'snapshot_support': True}
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
share_type_id=cls.share_type_id)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@ -189,14 +191,16 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
raise cls.skipException(msg)
# create share type
extra_specs = None
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
extra_specs = {'snapshot_support': True}
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
share_type_id=cls.share_type_id)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@ -247,6 +251,7 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
@ddt.data('shares_client', 'shares_v2_client')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_create_access_rule_user_to_snapshot(self, client_name):
self.assertRaises(lib_exc.NotFound,
getattr(self, client_name).create_access_rule,
@ -294,14 +299,16 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
raise cls.skipException(msg)
# create share type
extra_specs = None
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
extra_specs = {'snapshot_support': True}
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
share_type_id=cls.share_type_id)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@ -336,6 +343,7 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_cert_to_snapshot(self, client_name):
self.assertRaises(lib_exc.NotFound,
@ -483,13 +491,15 @@ class ShareRulesNegativeTest(base.BaseSharesMixedTest):
super(ShareRulesNegativeTest, cls).resource_setup()
# create share type
extra_specs = None
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
extra_specs = {'snapshot_support': True}
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@ -514,6 +524,7 @@ class ShareRulesNegativeTest(base.BaseSharesMixedTest):
@ddt.data('shares_client', 'shares_v2_client')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_create_access_rule_ip_to_snapshot(self, client_name):
self.assertRaises(lib_exc.NotFound,
getattr(self, client_name).create_access_rule,

View File

@ -48,9 +48,11 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
# Create a share type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -95,7 +97,8 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
])
# Create share group snapshots
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
cls.sg_snap_name = data_utils.rand_name("tempest-sg-snap-name")
cls.sg_snap_desc = data_utils.rand_name("tempest-sg-snap-desc")
@ -267,6 +270,7 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
LATEST_MICROVERSION]))
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_get_share_group_snapshot(self, version):
utils.check_skip_if_microversion_not_supported(version)
@ -297,6 +301,7 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_get_share_group_snapshot_members_min(self):
sg_snapshot = self.shares_v2_client.get_share_group_snapshot(
self.sg_snapshot['id'],
@ -331,6 +336,7 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Tests creating shares from snapshots are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_create_share_group_from_populated_share_group_snapshot(self,
version):
utils.check_skip_if_microversion_not_supported(version)

View File

@ -47,9 +47,11 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
super(ShareGroupsTest, cls).resource_setup()
# create share type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -107,6 +109,7 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_create_delete_empty_share_group_snapshot_min(self):
# Create base share group
share_group = self.create_share_group(
@ -150,6 +153,7 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_create_share_group_from_empty_share_group_snapshot_min(self):
# Create base share group
share_group = self.create_share_group(

View File

@ -44,7 +44,8 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
super(ShareGroupsNegativeTest, cls).resource_setup()
# Create a share type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -73,7 +74,8 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
share_type_id=cls.share_type_id,
share_group_id=cls.share_group['id'],
)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# Create a share group snapshot of the share group
cls.sg_snap_name = data_utils.rand_name("tempest-sg-snap-name")
cls.sg_snap_desc = data_utils.rand_name(
@ -213,6 +215,7 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_delete_sg_in_use_by_sg_snapshot_min(self):
self.assertRaises(
lib_exc.Conflict,
@ -224,6 +227,7 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_delete_share_in_use_by_sg_snapshot_min(self):
params = {'share_group_id': self.share['share_group_id']}
self.assertRaises(

View File

@ -153,6 +153,7 @@ class ShareNetworkSubnetsNegativeTest(base.BaseSharesAdminTest):
'creation. Skipping.')
@testtools.skipIf(not CONF.share.run_manage_unmanage_tests,
'Can run only with manage/unmanage tests enabled.')
@utils.features('manage_share')
def test_delete_contains_unmanaged_share_servers(self):
# Get a compatible availability zone
az = self.get_availability_zones_matching_share_type(

View File

@ -126,6 +126,7 @@ class SharesNFSTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_create_delete_snapshot(self):
extra_specs = {'snapshot_support': True}
share_type = self.create_share_type(extra_specs=extra_specs,
@ -177,6 +178,7 @@ class SharesNFSTest(base.BaseSharesMixedTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_create_share_from_snapshot(self):
# If multitenant driver used, share_network will be provided by default
extra_specs = {
@ -220,6 +222,7 @@ class SharesNFSTest(base.BaseSharesMixedTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_create_share_from_snapshot_share_network_not_provided(self):
# We expect usage of share network from parent's share
# when creating share from snapshot using a driver that supports

View File

@ -41,9 +41,11 @@ class SharesActionsTest(base.BaseSharesMixedTest):
# create share_type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -62,7 +64,8 @@ class SharesActionsTest(base.BaseSharesMixedTest):
share_type_id=cls.share_type_id,
))
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(
@ -70,7 +73,8 @@ class SharesActionsTest(base.BaseSharesMixedTest):
cls.snap = cls.create_snapshot_wait_for_active(
cls.shares[0]["id"], cls.snap_name, cls.snap_desc)
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
# create second share from snapshot for purposes of sorting and
# snapshot filtering
@ -312,7 +316,8 @@ class SharesActionsTest(base.BaseSharesMixedTest):
for share in shares:
self.assertDictContainsSubset(
filters['metadata'], share['metadata'])
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
@decorators.idempotent_id('685286c7-1df6-48c3-839d-8162737446b8')
@ -341,6 +346,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_list_shares_with_detail_filter_by_snapshot_id(self):
filters = {'snapshot_id': self.snap['id']}
@ -451,6 +457,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
@ddt.data(None, '2.16', LATEST_MICROVERSION)
def test_get_snapshot(self, version):
@ -511,6 +518,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_list_snapshots(self):
# list share snapshots
@ -529,6 +537,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
@ddt.data(None, '2.16', '2.36', LATEST_MICROVERSION)
def test_list_snapshots_with_detail(self, version):
params = None
@ -567,6 +576,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_list_snapshots_with_detail_use_limit(self):
for limit, offset in [('1', '1'), ('0', '1')]:
filters = {
@ -594,6 +604,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_list_snapshots_with_detail_filter_by_status_and_name(self):
filters = {'status': 'available', 'name': self.snap_name}
@ -611,6 +622,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
@utils.skip_if_microversion_not_supported("2.35")
def test_list_snapshots_with_detail_filter_by_description(self):
filters = {'description': self.snap_desc}
@ -628,6 +640,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_list_snapshots_with_detail_and_asc_sorting(self):
filters = {'sort_key': 'share_id', 'sort_dir': 'asc'}
@ -748,7 +761,8 @@ class SharesRenameTest(base.BaseSharesMixedTest):
# create share_type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -761,7 +775,8 @@ class SharesRenameTest(base.BaseSharesMixedTest):
description=cls.share_desc,
share_type_id=cls.share_type_id)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(
@ -797,6 +812,7 @@ class SharesRenameTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_rename_snapshot(self):
# get snapshot

View File

@ -39,7 +39,8 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
cls.share_desc = data_utils.rand_name("tempest-share-description")
# create share_type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -48,7 +49,8 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
name=cls.share_name,
description=cls.share_desc,
share_type_id=cls.share_type_id)
if CONF.share.run_snapshot_tests:
if (CONF.share_feature_enabled.snapshot or
CONF.share.run_snapshot_tests):
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(

View File

@ -60,7 +60,8 @@ class SharesFromSnapshotAcrossPools(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
super(SharesFromSnapshotAcrossPools, cls).skip_checks()
if not CONF.share.capability_create_share_from_snapshot_support:
if not (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
raise cls.skipException(
'Create share from snapshot tests are disabled.')
if (not CONF.share

View File

@ -33,9 +33,11 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
super(SharesNegativeTest, cls).resource_setup()
# create share_type
extra_specs = {}
if CONF.share.capability_snapshot_support:
if (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support):
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
if (CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support):
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@ -44,6 +46,7 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_try_delete_share_with_existing_snapshot(self):
# share can not be deleted while snapshot exists
@ -64,6 +67,7 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_create_share_from_snap_with_less_size(self):
# requires minimum 5Gb available space
skip_msg = "Check disc space for this test"
@ -105,9 +109,7 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
"Only for multitenancy.")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('snapshot', 'share_from_snapshot')
def test_create_share_from_snap_with_different_share_network(self):
# We can't create a share from a snapshot whose base share does not
# have 'create_share_from_snapshot_support'.
@ -224,6 +226,7 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_delete_snapshot_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_snapshot,
@ -233,6 +236,7 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_create_snapshot_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_snapshot,

View File

@ -74,7 +74,8 @@ class ShareSnapshotIpRulesForNFSTest(BaseShareSnapshotRulesTest):
@classmethod
def skip_checks(cls):
super(ShareSnapshotIpRulesForNFSTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot
or 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.')

View File

@ -35,7 +35,8 @@ class SnapshotIpRulesForNFSNegativeTest(
@classmethod
def skip_checks(cls):
super(SnapshotIpRulesForNFSNegativeTest, cls).skip_checks()
if not CONF.share.run_snapshot_tests:
if not (CONF.share_feature_enabled.snapshot or
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.')

View File

@ -248,6 +248,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Create share from snapshot tests are disabled.")
@utils.features('share_from_snapshot')
def test_write_data_to_share_created_from_snapshot(self):
# 1 - Create UVM, ok, created
instance = self.boot_instance(wait_until="BUILD")
@ -349,6 +350,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
'Mountable snapshots tests are disabled.')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@utils.features('snapshot')
def test_read_mountable_snapshot(self):
# 1 - Create UVM, ok, created
instance = self.boot_instance(wait_until="BUILD")

View File

@ -69,6 +69,7 @@ class ShareManageUnmanageBase(manager.ShareScenarioTest):
@testtools.skipIf(
CONF.share.multitenancy_enabled,
"Manage/unmanage tests are skipped when DHSS is enabled")
@utils.features('manage_share')
def test_create_manage_and_write(self):
share_size = CONF.share.share_size

View File

@ -14,14 +14,17 @@
# under the License.
from collections import OrderedDict
import functools
import random
import re
from netaddr import ip
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
import testtools
from manila_tempest_tests import share_exceptions
from manila_tempest_tests import utils
CONF = config.CONF
@ -208,21 +211,25 @@ def get_configured_extra_specs(variation=None):
extra_specs['driver_handles_share_servers'] = (
not CONF.share.multitenancy_enabled)
extra_specs['snapshot_support'] = (
not CONF.share.capability_snapshot_support)
not (CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support))
elif variation == 'opposite_driver_modes':
extra_specs['driver_handles_share_servers'] = (
not CONF.share.multitenancy_enabled)
extra_specs['snapshot_support'] = (
CONF.share.capability_snapshot_support)
(CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support))
else:
extra_specs['driver_handles_share_servers'] = (
CONF.share.multitenancy_enabled)
extra_specs['snapshot_support'] = (
CONF.share.capability_snapshot_support)
(CONF.share_feature_enabled.snapshot or
CONF.share.capability_snapshot_support))
extra_specs['create_share_from_snapshot_support'] = (
CONF.share.capability_create_share_from_snapshot_support)
(CONF.share_feature_enabled.share_from_snapshot or
CONF.share.capability_create_share_from_snapshot_support))
return extra_specs
@ -289,3 +296,35 @@ def get_extra_headers(request_version, graduation_version):
headers = EXPERIMENTAL
extra_headers = True
return headers, extra_headers
share_features = ['snapshot', 'share_from_snapshot', 'revert_to_snapshot',
'manage_share', 'manage_snapshot']
def features(*args):
"""A decorator used to set an attr for each share feature
This decorator applies a testtools attr for each share feature.
The test will be skipped in case the environment does not support the
feature by verifying it in the tempest.conf under 'share_feature_enabled'
section.
"""
def decorator(f):
for feature in args:
if feature not in share_features:
raise share_exceptions.ShareFeatureEnabled(
'%s is not supported' % feature)
decorators.attr(type=list(args))(f)
@functools.wraps(f)
def wrapper(*func_args, **func_kwargs):
for feature in args:
if not getattr(CONF.share_feature_enabled, feature):
msg = 'Skipped because the %s feature is not available' % (
feature)
raise testtools.TestCase.skipException(msg)
return f(*func_args, **func_kwargs)
return wrapper
return decorator

View File

@ -0,0 +1,13 @@
---
upgrade:
- |
Add a new section option in tempest.conf for manila features called
'share-feature-enabled'. Under this cofiguration section will be indicated
the features that are supported by the environment.
For example an environment that supports snapshot creation:
[share-feature-enabled]
snapshot=true
From now on there will be one configuration option that will skip the tests
that test unsupported features.

View File

@ -144,8 +144,6 @@
run_driver_assisted_migration_tests: true
run_host_assisted_migration_tests: true
run_replication_tests: true
run_manage_unmanage_snapshot_tests: true
run_manage_unmanage_tests: true
run_multiple_share_replicas_tests: false
run_create_share_from_snapshot_in_another_pool_or_az_tests: true
backend_replication_type: readable
@ -158,6 +156,11 @@
multi_backend: true
image_password: manila
dd_input_file: /dev/urandom
share_feature_enabled:
snapshot: true
share_from_snapshot: true
manage_share: true
manage_snapshot: true
- job:
name: manila-tempest-plugin-zfsonlinux
@ -231,6 +234,9 @@
backend_names: LONDON,PARIS
multi_backend: true
image_password: manila
share_feature_enabled:
snapshot: true
share_from_snapshot: true
- job:
name: manila-tempest-plugin-lvm
@ -280,7 +286,6 @@
enable_ip_rules_for_protocols: ""
run_share_group_tests: false
run_manage_unmanage_tests: true
run_snapshot_tests: false
run_shrink_tests: false
enable_user_rules_for_protocols: cifs
enable_protocols: cifs
@ -332,6 +337,9 @@
backend_names: LONDON,PARIS
multi_backend: true
image_password: manila
share_feature_enabled:
snapshot: true
share_from_snapshot: true
- job:
name: manila-tempest-plugin-generic
@ -401,6 +409,8 @@
capability_storage_protocol: CEPHFS
enable_protocols: cephfs
image_password: manila
share_feature_enabled:
snapshot: true
- job:
name: manila-tempest-plugin-cephfs-native
@ -480,6 +490,8 @@
enable_protocols: nfs
capability_storage_protocol: NFS
image_password: manila
share_feature_enabled:
snapshot: true
- job:
name: manila-tempest-plugin-cephfs-nfs
@ -643,14 +655,17 @@
multitenancy_enabled: false
run_driver_assisted_backup_tests: true
run_driver_assisted_migration_tests: true
run_manage_unmanage_snapshot_tests: true
run_manage_unmanage_tests: true
run_migration_with_preserve_snapshots_tests: true
run_mount_snapshot_tests: true
run_replication_tests: true
run_revert_to_snapshot_tests: true
# for migration test case "test_migration_opposite_driver_modes"
create_networks_when_multitenancy_enabled: false
share_feature_enabled:
snapshot: true
share_from_snapshot: true
manage_share: true
manage_snapshot: true
- job:
name: manila-tempest-plugin-dummy-dhss
@ -709,8 +724,6 @@
multi_backend: true
multitenancy_enabled: true
run_driver_assisted_migration_tests: true
run_manage_unmanage_snapshot_tests: true
run_manage_unmanage_tests: true
run_migration_with_preserve_snapshots_tests: true
run_mount_snapshot_tests: true
run_replication_tests: true
@ -718,6 +731,11 @@
run_share_server_migration_tests: true
run_share_server_multiple_subnet_tests: true
run_network_allocation_update_tests: true
share_feature_enabled:
snapshot: true
share_from_snapshot: true
manage_share: true
manage_snapshot: true
- job:
name: manila-tempest-plugin-glusterfs-native
@ -739,7 +757,6 @@
$TEMPEST_CONFIG:
share:
run_share_group_tests: false
run_snapshot_tests: false
multitenancy_enabled: false
run_shrink_tests: false
run_extend_tests: false
@ -771,7 +788,6 @@
$TEMPEST_CONFIG:
share:
run_share_group_tests: false
run_snapshot_tests: false
multitenancy_enabled: False
run_shrink_tests: true
multi_backend: false