Use skip_checks instead of skipUnless in TestShelveInstance
All testcases in TestShelveInstance should be skipped if CONF.compute_feature_enabled.shelve is false, so this is to use skip_checks to avoid adding skipUnless decorator for each testcase individually. Change-Id: I41f57fc92cf0294e922b87667b84d4aa3ac87663
This commit is contained in:
parent
ad37b61be6
commit
8ed23d2645
|
@ -13,8 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import testtools
|
||||
|
||||
from tempest.common import compute
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
|
@ -35,6 +33,12 @@ class TestShelveInstance(manager.ScenarioTest):
|
|||
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestShelveInstance, cls).skip_checks()
|
||||
if not CONF.compute_feature_enabled.shelve:
|
||||
raise cls.skipException("Shelve is not available.")
|
||||
|
||||
def _shelve_then_unshelve_server(self, server):
|
||||
compute.shelve_server(self.servers_client, server['id'],
|
||||
force_shelve_offload=True)
|
||||
|
@ -83,15 +87,11 @@ class TestShelveInstance(manager.ScenarioTest):
|
|||
self.assertEqual(timestamp, timestamp2)
|
||||
|
||||
@test.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
|
||||
'Shelve is not available.')
|
||||
@test.services('compute', 'network', 'image')
|
||||
def test_shelve_instance(self):
|
||||
self._create_server_then_shelve_and_unshelve()
|
||||
|
||||
@test.idempotent_id('c1b6318c-b9da-490b-9c67-9339b627271f')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
|
||||
'Shelve is not available.')
|
||||
@test.services('compute', 'volume', 'network', 'image')
|
||||
def test_shelve_volume_backed_instance(self):
|
||||
self._create_server_then_shelve_and_unshelve(boot_from_volume=True)
|
||||
|
|
Loading…
Reference in New Issue