Merge "Generate profile spec baed on tempest config"
This commit is contained in:
commit
4615a29a70
@ -20,11 +20,14 @@ from stevedore import extension
|
||||
import tempfile
|
||||
import tenacity
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions
|
||||
|
||||
from senlin_tempest_plugin.common import constants
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
def api_microversion(api_microversion):
|
||||
"""Decorator used to specify api_microversion for test."""
|
||||
@ -71,6 +74,16 @@ def prepare_and_cleanup_for_nova_server(base, cidr, spec=None):
|
||||
base.addCleanup(delete_a_subnet, base, subnet_id)
|
||||
|
||||
|
||||
def create_spec_from_config():
|
||||
"""Utility function that creates a spec object from tempest config"""
|
||||
spec = constants.spec_nova_server
|
||||
|
||||
spec['properties']['flavor'] = CONF.compute.flavor_ref
|
||||
spec['properties']['image'] = CONF.compute.image_ref
|
||||
|
||||
return spec
|
||||
|
||||
|
||||
def create_a_profile(base, spec=None, name=None, metadata=None):
|
||||
"""Utility function that generates a Senlin profile."""
|
||||
|
||||
|
@ -26,7 +26,7 @@ class TestHealthPolicy(base.BaseSenlinIntegrationTest):
|
||||
def setUp(self):
|
||||
super(TestHealthPolicy, self).setUp()
|
||||
|
||||
spec = constants.spec_nova_server
|
||||
spec = utils.create_spec_from_config()
|
||||
spec['properties']['networks'][0]['network'] = 'private-hp'
|
||||
utils.prepare_and_cleanup_for_nova_server(self, "192.168.199.0/24",
|
||||
spec)
|
||||
|
@ -23,6 +23,7 @@ class TestNovaServerCluster(base.BaseSenlinIntegrationNonAdminTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNovaServerCluster, self).setUp()
|
||||
self.spec = utils.create_spec_from_config()
|
||||
utils.prepare_and_cleanup_for_nova_server(self, "192.168.199.0/24")
|
||||
self.profile_id = utils.create_a_profile(self, self.spec)
|
||||
self.addCleanup(utils.delete_a_profile, self, self.profile_id)
|
||||
|
Loading…
Reference in New Issue
Block a user