diff --git a/base.py b/base.py index 1e7a44b..cfe3152 100644 --- a/base.py +++ b/base.py @@ -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, diff --git a/config_opts.py b/config_opts.py index c852572..30aadbe 100644 --- a/config_opts.py +++ b/config_opts.py @@ -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') diff --git a/plugin.py b/plugin.py index 31fcdc5..a8707fc 100644 --- a/plugin.py +++ b/plugin.py @@ -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) + ]