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
This commit is contained in:
Slawek Kaplonski 2019-07-17 15:34:46 +02:00
parent 5cec35e997
commit a7bb1619d4
6 changed files with 95 additions and 1 deletions

View File

@ -72,8 +72,13 @@ class BaseBgpvpnTest(test.BaseNetworkTest):
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
super(BaseBgpvpnTest, cls).skip_checks() super(BaseBgpvpnTest, cls).skip_checks()
msg = None
if not utils.is_extension_enabled('bgpvpn', 'network'): if not utils.is_extension_enabled('bgpvpn', 'network'):
msg = "Bgpvpn extension not enabled." 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) raise cls.skipException(msg)
def create_bgpvpn(self, client, **kwargs): def create_bgpvpn(self, client, **kwargs):

View File

@ -116,7 +116,16 @@ NeutronPluginOptions = [
for opt in NeutronPluginOptions: for opt in NeutronPluginOptions:
CONF.register_opt(opt, 'neutron_plugin_options') 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 = [ 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', cfg.IntOpt('min_asn',
default=100, default=100,
help=("Minimum number for the range of " 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_group(bgpvpn_group)
CONF.register_opts(BgpvpnGroup, group="bgpvpn") 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 = { config_opts_translator = {
'project_network_cidr': 'tenant_network_cidr', 'project_network_cidr': 'tenant_network_cidr',
'project_network_v6_cidr': 'tenant_network_v6_cidr', 'project_network_v6_cidr': 'tenant_network_v6_cidr',

View File

@ -13,9 +13,21 @@
# under the License. # under the License.
from tempest.api.network import base from tempest.api.network import base
from tempest import config
from neutron_tempest_plugin.fwaas.common import fwaas_v2_client from neutron_tempest_plugin.fwaas.common import fwaas_v2_client
CONF = config.CONF
class BaseFWaaSTest(fwaas_v2_client.FWaaSClientMixin, base.BaseNetworkTest): 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)

View File

@ -40,6 +40,16 @@ class ScenarioTest(tempest.test.BaseTestCase):
credentials = ['primary'] 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 @classmethod
def setup_clients(cls): def setup_clients(cls):
super(ScenarioTest, cls).setup_clients() super(ScenarioTest, cls).setup_clients()

View File

@ -18,17 +18,31 @@ import socket
import netaddr import netaddr
from tempest.api.network import base from tempest.api.network import base
from tempest.common import utils from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
from neutron_tempest_plugin.sfc.tests import flowclassifier_client from neutron_tempest_plugin.sfc.tests import flowclassifier_client
from neutron_tempest_plugin.sfc.tests import sfc_client from neutron_tempest_plugin.sfc.tests import sfc_client
CONF = config.CONF
class BaseFlowClassifierTest( class BaseFlowClassifierTest(
flowclassifier_client.FlowClassifierClientMixin, flowclassifier_client.FlowClassifierClientMixin,
base.BaseAdminNetworkTest 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 @classmethod
def resource_setup(cls): def resource_setup(cls):
super(BaseFlowClassifierTest, cls).resource_setup() super(BaseFlowClassifierTest, cls).resource_setup()

View File

@ -30,6 +30,17 @@ class SfcScenarioTest(
sfc_client.SfcClientMixin, sfc_client.SfcClientMixin,
manager.NetworkScenarioTest 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( def _check_connectivity(
self, source_ip, destination_ip, routes=None, self, source_ip, destination_ip, routes=None,
username=None, private_key=None username=None, private_key=None