Fix tempest.conf generation

[service_available] isn't being generated. This patch fixes it.
It also introduces a switch to disable the ec2api tempest tests via
the [service_available]ec2api parameter.

Closes-Bug: #1613542
Change-Id: I79e2bc26f86b3be6a45a2ee8ea33c50977d44838
This commit is contained in:
Thomas Bechtold 2016-08-19 12:51:01 +02:00 committed by Andrey Pavlov
parent 368eaba3fc
commit 5f6b14353d
3 changed files with 22 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import traceback
import botocore.exceptions
from oslo_log import log
import six
from tempest import config as tempest_config
from tempest.lib import base
from tempest.lib import exceptions
import testtools
@ -30,6 +31,7 @@ from ec2api.tests.functional import botocoreclient
from ec2api.tests.functional import config as cfg
CONF = cfg.CONF
CONF_TEMPEST = tempest_config.CONF
LOG = log.getLogger(__name__)
logging.getLogger('botocore').setLevel(logging.INFO)
@ -253,6 +255,9 @@ class EC2TestCase(base.BaseTestCase):
@safe_setup
def setUpClass(cls):
super(EC2TestCase, cls).setUpClass()
if not CONF_TEMPEST.service_available.ec2api:
raise cls.skipException("ec2api is disabled")
cls.client = botocoreclient.get_ec2_client(
CONF.aws.ec2_url, CONF.aws.aws_region,
CONF.aws.aws_access, CONF.aws.aws_secret,

View File

@ -15,6 +15,15 @@
from oslo_config import cfg
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
ServiceAvailableGroup = [
cfg.BoolOpt("ec2api",
default=True,
help="Whether or not ec2-api is expected to be available"),
]
aws_group = cfg.OptGroup(name='aws',
title='AWS options')

View File

@ -30,9 +30,16 @@ class AWSTempestPlugin(plugins.TempestPlugin):
return full_test_dir, base_path
def register_opts(self, conf):
config.register_opt_group(
conf, aws_config.service_available_group,
aws_config.ServiceAvailableGroup)
if aws_config.aws_group.name not in conf:
config.register_opt_group(conf, aws_config.aws_group,
aws_config.AWSGroup)
def get_opt_lists(self):
return [(aws_config.aws_group.name, aws_config.AWSGroup)]
return [
('service_available', aws_config.ServiceAvailableGroup),
(aws_config.aws_group.name, aws_config.AWSGroup)
]