Move CONF.service_available.ironic to our plugin

This is unwanted in tempest's plugin, bring it here instead.

Also add skip checks for our tests to skip the tests if ironic is not
enabled. This allows the plugin to be installed in a tempest
environment, without breaking if ironic isn't present.

Last, drop 'baremetal' from the test.services decorators used, as it is
no longer in tempest's service list, and we use the skip check mentioned
above instead.

Change-Id: I0b7e32dfad2ed63f9dd4d7cad130da39bc869a8a
Depends-On: Idede322190d57491d4f7e18090aa8c29b5b87353
(cherry picked from commit 8ad0a424b3)
This commit is contained in:
Jim Rollenhagen 2016-11-29 16:57:30 -05:00
parent 8d65611030
commit 6bf63a06ef
7 changed files with 20 additions and 3 deletions

View File

@ -1498,6 +1498,8 @@ function cleanup_baremetal_basic_ops {
}
function ironic_configure_tempest {
iniset $TEMPEST_CONFIG service_available ironic True
local bm_flavor_id
bm_flavor_id=$(openstack flavor show baremetal -f value -c id)
die_if_not_set $LINENO bm_flavor_id "Failed to get id of baremetal flavor"
@ -1518,7 +1520,6 @@ function ironic_configure_tempest {
# tree, but not from our tree. This is a bit inconsistent, we should
# fix it.
iniset $TEMPEST_CONFIG network shared_physical_network True
iniset $TEMPEST_CONFIG network-feature-enabled port_admin_state_change False
}
# Restore xtrace + pipefail

View File

@ -18,6 +18,12 @@ from oslo_config import cfg
from tempest import config # noqa
service_option = cfg.BoolOpt('ironic',
default=False,
help='Whether or not Ironic is expected to be '
'available')
baremetal_group = cfg.OptGroup(name='baremetal',
title='Baremetal provisioning service options',
help='When enabling baremetal tests, Nova '

View File

@ -31,6 +31,8 @@ class IronicTempestPlugin(plugins.TempestPlugin):
return full_test_dir, base_path
def register_opts(self, conf):
conf.register_opt(project_config.service_option,
group='service_available')
config.register_opt_group(conf, project_config.baremetal_group,
project_config.BaremetalGroup)

View File

@ -61,6 +61,8 @@ class BaseBaremetalTest(api_version_utils.BaseMicroversionTest,
@classmethod
def skip_checks(cls):
super(BaseBaremetalTest, cls).skip_checks()
if not CONF.service_available.ironic:
raise cls.skipException('Ironic is not enabled.')
if CONF.baremetal.driver not in SUPPORTED_DRIVERS:
skip_msg = ('%s skipped as Ironic driver %s is not supported for '
'testing.' %

View File

@ -55,6 +55,12 @@ class BaremetalScenarioTest(manager.ScenarioTest):
credentials = ['primary', 'admin']
@classmethod
def skip_checks(cls):
super(BaremetalScenarioTest, cls).skip_checks()
if not CONF.service_available.ironic:
raise cls.skipException('Ironic is not enabled.')
@classmethod
def setup_clients(cls):
super(BaremetalScenarioTest, cls).setup_clients()

View File

@ -105,7 +105,7 @@ class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest):
self.assertEqual(n_port['mac_address'], port['address'])
@test.idempotent_id('549173a5-38ec-42bb-b0e2-c8b9f4a08943')
@test.services('baremetal', 'compute', 'image', 'network')
@test.services('compute', 'image', 'network')
def test_baremetal_server_ops(self):
self.add_keypair()
self.instance, self.node = self.boot_instance()

View File

@ -80,7 +80,7 @@ class BaremetalMultitenancy(baremetal_manager.BaremetalScenarioTest,
self.assertNotIn(success_substring, output)
@test.idempotent_id('26e2f145-2a8e-4dc7-8457-7f2eb2c6749d')
@test.services('baremetal', 'compute', 'image', 'network')
@test.services('compute', 'image', 'network')
def test_baremetal_multitenancy(self):
tenant_cidr = '10.0.100.0/24'