Conditionallly skip manage snapshot tests

The cinder manage snapshots commands are not supported by all drivers,
so the RBAC tests should be conditional to the driver supporting it.

The unmanage snapshot RBAC tests can still be run, because the failure
should happen at the API level, so it doesn't matter if the driver
supports it or not.

Change-Id: I2a65f8655a7418a9099e8d7593bd7d7009f22d9d
This commit is contained in:
Gorka Eguileor 2024-07-10 15:50:03 +02:00 committed by Brian Rosmaita
parent 79a776036b
commit 68347e7d76

View File

@ -17,6 +17,8 @@ from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions
import testtools
from cinder_tempest_plugin.rbac.v3 import base as rbac_base
CONF = config.CONF
@ -309,10 +311,15 @@ class ProjectReaderTests(VolumeV3RbacSnapshotsTests):
def test_force_delete_snapshot(self):
self._force_delete_snapshot(expected_status=exceptions.Forbidden)
# We don't need to skip the unmanage because the failure should happen at
# the API level, so it should fail regardless of the driver support for
# unmanaging snapshots.
@decorators.idempotent_id('35495666-b663-4c68-ba44-0695e30a6838')
def test_unmanage_snapshot(self):
self._unmanage_snapshot(expected_status=exceptions.Forbidden)
@testtools.skipUnless(CONF.volume_feature_enabled.manage_snapshot,
'manage snapshots are disabled')
@decorators.idempotent_id('d2d1326d-fb47-4448-a1e1-2d1219d30fd5')
def test_manage_snapshot(self):
self._manage_snapshot(
@ -362,10 +369,15 @@ class ProjectMemberTests(VolumeV3RbacSnapshotsTests):
def test_force_delete_snapshot(self):
self._force_delete_snapshot(expected_status=exceptions.Forbidden)
# We don't need to skip the unmanage because the failure should happen at
# the API level, so it should fail regardless of the driver support for
# unmanaging snapshots.
@decorators.idempotent_id('dd7da3da-68ef-42f5-af1d-29803a4a04fd')
def test_unmanage_snapshot(self):
self._unmanage_snapshot(expected_status=exceptions.Forbidden)
@testtools.skipUnless(CONF.volume_feature_enabled.manage_snapshot,
'manage snapshots are disabled')
@decorators.idempotent_id('c2501d05-9bca-42d7-9ab5-c0d9133e762f')
def test_manage_snapshot(self):
self._manage_snapshot(