From a7bb1619d43b413eb8d5849eb6df8d0dee260660 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 17 Jul 2019 15:34:46 +0200 Subject: [PATCH] Add possibility to disable running stadium projects tests This patch adds possibility to disable running of tests related to: * networking-bgpvpn, * neutron-fwaas, * networking-sfc which were moved to neutron-tempest-plugin repo recently. This will be useful when tests will be run for one of stable branches up to Stein, in which those tests are still in project's repo. Change-Id: I61dc252920154e7e0998eb2c7c1f026814796cdf --- neutron_tempest_plugin/bgpvpn/base.py | 5 +++ neutron_tempest_plugin/config.py | 42 +++++++++++++++++++ .../fwaas/api/fwaas_v2_base.py | 14 ++++++- .../fwaas/scenario/fwaas_v2_manager.py | 10 +++++ neutron_tempest_plugin/sfc/tests/api/base.py | 14 +++++++ .../sfc/tests/scenario/base.py | 11 +++++ 6 files changed, 95 insertions(+), 1 deletion(-) diff --git a/neutron_tempest_plugin/bgpvpn/base.py b/neutron_tempest_plugin/bgpvpn/base.py index aeecbfc6..b436a5d7 100644 --- a/neutron_tempest_plugin/bgpvpn/base.py +++ b/neutron_tempest_plugin/bgpvpn/base.py @@ -72,8 +72,13 @@ class BaseBgpvpnTest(test.BaseNetworkTest): @classmethod def skip_checks(cls): super(BaseBgpvpnTest, cls).skip_checks() + msg = None if not utils.is_extension_enabled('bgpvpn', 'network'): msg = "Bgpvpn extension not enabled." + elif not CONF.bgpvpn.run_bgpvpn_tests: + msg = ("Running of bgpvpn related tests is disabled in " + "plugin configuration.") + if msg: raise cls.skipException(msg) def create_bgpvpn(self, client, **kwargs): diff --git a/neutron_tempest_plugin/config.py b/neutron_tempest_plugin/config.py index e07c92a9..7581f3c3 100644 --- a/neutron_tempest_plugin/config.py +++ b/neutron_tempest_plugin/config.py @@ -116,7 +116,16 @@ NeutronPluginOptions = [ for opt in NeutronPluginOptions: CONF.register_opt(opt, 'neutron_plugin_options') +# TODO(slaweq): This config option is added to avoid running bgpvpn tests twice +# on stable branches till stable/stein. We need to remove this config option +# once stable/stein is EOL. Bgpvpn tempest plugin has been merged into +# neutron-tempest-plugin from Train. Train onwards bgpvpn tests will run from +# neutron-tempest-plugins. BgpvpnGroup = [ + cfg.BoolOpt('run_bgpvpn_tests', + default=True, + help=("If it is set to False bgpvpn api and scenario tests " + "will be skipped")), cfg.IntOpt('min_asn', default=100, help=("Minimum number for the range of " @@ -140,6 +149,39 @@ bgpvpn_group = cfg.OptGroup(name="bgpvpn", title=("Networking-Bgpvpn Service " CONF.register_group(bgpvpn_group) CONF.register_opts(BgpvpnGroup, group="bgpvpn") +# TODO(slaweq): This config option is added to avoid running fwaas tests twice +# on stable branches till stable/stein. We need to remove this config option +# once stable/stein is EOL. Fwaas tempest plugin has been merged into +# neutron-tempest-plugin from Train. Train onwards fwaas tests will run from +# neutron-tempest-plugins. +FwaasGroup = [ + cfg.BoolOpt('run_fwaas_tests', + default=True, + help=("If it is set to False fwaas api and scenario tests " + "will be skipped")), +] + +fwaas_group = cfg.OptGroup( + name="fwaas", title=("Neutron-fwaas Service Options")) +CONF.register_group(fwaas_group) +CONF.register_opts(FwaasGroup, group="fwaas") + +# TODO(slaweq): This config option is added to avoid running SFC tests twice +# on stable branches till stable/stein. We need to remove this config option +# once stable/stein is EOL. SFC tempest plugin has been merged into +# neutron-tempest-plugin from Train. Train onwards SFC tests will run from +# neutron-tempest-plugins. +SfcGroup = [ + cfg.BoolOpt('run_sfc_tests', + default=True, + help=("If it is set to False SFC api and scenario tests " + "will be skipped")), +] + +sfc_group = cfg.OptGroup(name="sfc", title=("Networking-sfc Service Options")) +CONF.register_group(sfc_group) +CONF.register_opts(SfcGroup, group="sfc") + config_opts_translator = { 'project_network_cidr': 'tenant_network_cidr', 'project_network_v6_cidr': 'tenant_network_v6_cidr', diff --git a/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py b/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py index 7a399783..f4f63eca 100644 --- a/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py +++ b/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py @@ -13,9 +13,21 @@ # under the License. from tempest.api.network import base +from tempest import config from neutron_tempest_plugin.fwaas.common import fwaas_v2_client +CONF = config.CONF + class BaseFWaaSTest(fwaas_v2_client.FWaaSClientMixin, base.BaseNetworkTest): - pass + + @classmethod + def skip_checks(cls): + super(BaseFWaaSTest, cls).skip_checks() + msg = None + if not CONF.fwaas.run_fwaas_tests: + msg = ("Running of fwaas related tests is disabled in " + "plugin configuration.") + if msg: + raise cls.skipException(msg) diff --git a/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py b/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py index 01ca8c54..5ead2a79 100644 --- a/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py +++ b/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py @@ -40,6 +40,16 @@ class ScenarioTest(tempest.test.BaseTestCase): credentials = ['primary'] + @classmethod + def skip_checks(cls): + super(ScenarioTest, cls).skip_checks() + msg = None + if not CONF.fwaas.run_fwaas_tests: + msg = ("Running of fwaas related tests is disabled in " + "plugin configuration.") + if msg: + raise cls.skipException(msg) + @classmethod def setup_clients(cls): super(ScenarioTest, cls).setup_clients() diff --git a/neutron_tempest_plugin/sfc/tests/api/base.py b/neutron_tempest_plugin/sfc/tests/api/base.py index 732e2dcb..606aed6b 100644 --- a/neutron_tempest_plugin/sfc/tests/api/base.py +++ b/neutron_tempest_plugin/sfc/tests/api/base.py @@ -18,17 +18,31 @@ import socket import netaddr from tempest.api.network import base from tempest.common import utils +from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import exceptions as lib_exc from neutron_tempest_plugin.sfc.tests import flowclassifier_client from neutron_tempest_plugin.sfc.tests import sfc_client +CONF = config.CONF + class BaseFlowClassifierTest( flowclassifier_client.FlowClassifierClientMixin, base.BaseAdminNetworkTest ): + + @classmethod + def skip_checks(cls): + super(BaseFlowClassifierTest, cls).skip_checks() + msg = None + if not CONF.sfc.run_sfc_tests: + msg = ("Running of SFC related tests is disabled in " + "plugin configuration.") + if msg: + raise cls.skipException(msg) + @classmethod def resource_setup(cls): super(BaseFlowClassifierTest, cls).resource_setup() diff --git a/neutron_tempest_plugin/sfc/tests/scenario/base.py b/neutron_tempest_plugin/sfc/tests/scenario/base.py index d4cff187..44b5cd29 100644 --- a/neutron_tempest_plugin/sfc/tests/scenario/base.py +++ b/neutron_tempest_plugin/sfc/tests/scenario/base.py @@ -30,6 +30,17 @@ class SfcScenarioTest( sfc_client.SfcClientMixin, manager.NetworkScenarioTest ): + + @classmethod + def skip_checks(cls): + super(SfcScenarioTest, cls).skip_checks() + msg = None + if not CONF.sfc.run_sfc_tests: + msg = ("Running of SFC related tests is disabled in " + "plugin configuration.") + if msg: + raise cls.skipException(msg) + def _check_connectivity( self, source_ip, destination_ip, routes=None, username=None, private_key=None