Skip volume snapshot tests if feature is not enabled

Not all cinder volume backends support volume snapshot. For instance,
the default NFS backend doesn't. This patch adds a new entry to
CONF.volume_feature_enabled to add the possibility to skip volume
snapshot tests.

Change-Id: I40ce17924bbe4eb6f1c941df974bfa832ec2a999
This commit is contained in:
JordanP 2014-03-19 12:10:32 +01:00
parent 50f9d91ea4
commit bce555323c
7 changed files with 35 additions and 0 deletions

View File

@ -954,6 +954,9 @@
# Runs Cinder volumes backup test (boolean value)
#backup=true
# Runs Cinder volume snapshot test (boolean value)
#snapshot=true
# A list of enabled volume extensions with a special entry all
# which indicates every extension is enabled (list value)
#api_extensions=all

View File

@ -29,6 +29,9 @@ class VolumesSnapshotTest(base.BaseVolumeV1Test):
super(VolumesSnapshotTest, cls).setUpClass()
cls.volume_origin = cls.create_volume()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
@classmethod
def tearDownClass(cls):
super(VolumesSnapshotTest, cls).tearDownClass()

View File

@ -14,13 +14,23 @@ import uuid
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest import test
CONF = config.CONF
class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test):
_interface = "json"
@classmethod
def setUpClass(cls):
super(VolumesSnapshotNegativeTest, cls).setUpClass()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
@test.attr(type=['negative', 'gate'])
def test_create_snapshot_with_nonexistent_volume_id(self):
# Create a snapshot with nonexistent volume id

View File

@ -16,6 +16,7 @@
import logging
import re
import subprocess
import testtools
import tempest.cli
from tempest import config
@ -86,6 +87,8 @@ class SimpleReadOnlyCinderClientTest(tempest.cli.ClientTestBase):
def test_cinder_rate_limits(self):
self.cinder('rate-limits')
@testtools.skipUnless(CONF.volume_feature_enabled.snapshot,
'Volume snapshot not available.')
def test_cinder_snapshot_list(self):
self.cinder('snapshot-list')

View File

@ -453,6 +453,9 @@ VolumeFeaturesGroup = [
cfg.BoolOpt('backup',
default=True,
help='Runs Cinder volumes backup test'),
cfg.BoolOpt('snapshot',
default=True,
help='Runs Cinder volume snapshot test'),
cfg.ListOpt('api_extensions',
default=['all'],
help='A list of enabled volume extensions with a special '

View File

@ -50,6 +50,13 @@ class TestStampPattern(manager.OfficialClientTest):
14. Check the existence of a file which created at 6. in volume2
"""
@classmethod
def setUpClass(cls):
super(TestStampPattern, cls).setUpClass()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
def _wait_for_volume_snapshot_status(self, volume_snapshot, status):
self.status_timeout(self.volume_client.volume_snapshots,
volume_snapshot.id, status)

View File

@ -35,6 +35,12 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
* Boot an additional instance from the new snapshot based volume
* Check written content in the instance booted from snapshot
"""
@classmethod
def setUpClass(cls):
super(TestVolumeBootPattern, cls).setUpClass()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
def _create_volume_from_image(self):
img_uuid = CONF.compute.image_ref