From: Cédric Ollivier Date: Sun, 15 Jul 2018 12:15:45 +0000 (+0200) Subject: Dynamically skip neutron_trunk and barbican X-Git-Tag: opnfv-7.0.0~193 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F59833%2F2;p=functest.git Dynamically skip neutron_trunk and barbican It avoids fasly testcases in failure for end users. It also removes the neutron_trunk class which is now useless (Queens). Change-Id: I3f5a1ac84a50e061da6eadcc5c9bafb2e99050db Signed-off-by: Cédric Ollivier --- diff --git a/docker/smoke/testcases.yaml b/docker/smoke/testcases.yaml index 207bfc96b..b59af41a7 100644 --- a/docker/smoke/testcases.yaml +++ b/docker/smoke/testcases.yaml @@ -125,13 +125,14 @@ tiers: OpenStack Tempest suite. The list of test cases is generated by Tempest having as input the relevant testcase list file. - dependencies: - - INSTALLER_TYPE: '(fuel)|(apex)|(compass)' run: - module: 'functest.opnfv_tests.openstack.trunk.trunk' - class: 'TempestNeutronTrunk' + module: 'functest.opnfv_tests.openstack.tempest.tempest' + class: 'TempestCommon' args: mode: 'neutron_tempest_plugin.(api|scenario).test_trunk' + neutron_extensions: + - trunk + - trunk_details - case_name: barbican @@ -141,10 +142,10 @@ tiers: description: >- It leverages on the tempest plugin containing tests used to verify the functionality of a barbican installation. - dependencies: - - INSTALLER_TYPE: '^((?!fuel|apex|compass|daisy|osa).)*$' run: module: 'functest.opnfv_tests.openstack.tempest.tempest' class: 'TempestCommon' args: mode: 'barbican_tempest_plugin.tests.(api|scenario)' + services: + - barbican diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 79190091c..a9e023e4c 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -316,13 +316,14 @@ tiers: OpenStack Tempest suite. The list of test cases is generated by Tempest having as input the relevant testcase list file. - dependencies: - - INSTALLER_TYPE: '(fuel)|(apex)|(compass)' run: - module: 'functest.opnfv_tests.openstack.trunk.trunk' - class: 'TempestNeutronTrunk' + module: 'functest.opnfv_tests.openstack.tempest.tempest' + class: 'TempestCommon' args: mode: 'neutron_tempest_plugin.(api|scenario).test_trunk' + neutron_extensions: + - trunk + - trunk_details - case_name: barbican @@ -332,13 +333,13 @@ tiers: description: >- It leverages on the tempest plugin containing tests used to verify the functionality of a barbican installation. - dependencies: - - INSTALLER_TYPE: '^((?!fuel|apex|compass|daisy|osa).)*$' run: module: 'functest.opnfv_tests.openstack.tempest.tempest' class: 'TempestCommon' args: mode: 'barbican_tempest_plugin.tests.(api|scenario)' + services: + - barbican - name: features diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index bf79eb21d..52cc31c4a 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -55,6 +55,40 @@ class TempestCommon(singlevm.VmReady1): self.conf_file = None self.image_alt = None self.flavor_alt = None + self.services = [] + try: + self.services = kwargs['run']['args']['services'] + except Exception: # pylint: disable=broad-except + pass + self.neutron_extensions = [] + try: + self.neutron_extensions = kwargs['run']['args'][ + 'neutron_extensions'] + except Exception: # pylint: disable=broad-except + pass + + def check_services(self): + """Check the mandatory services.""" + for service in self.services: + try: + self.cloud.search_services(service)[0] + except Exception: # pylint: disable=broad-except + self.is_skipped = True + break + + def check_extensions(self): + """Check the mandatory network extensions.""" + extensions = self.cloud.get_network_extensions() + for network_extension in self.neutron_extensions: + if network_extension not in extensions: + LOGGER.warning( + "Cannot find Neutron extension: %s", network_extension) + self.is_skipped = True + break + + def check_requirements(self): + self.check_services() + self.check_extensions() @staticmethod def read_file(filename): diff --git a/functest/opnfv_tests/openstack/trunk/__init__.py b/functest/opnfv_tests/openstack/trunk/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/functest/opnfv_tests/openstack/trunk/trunk.py b/functest/opnfv_tests/openstack/trunk/trunk.py deleted file mode 100644 index 8d177675b..000000000 --- a/functest/opnfv_tests/openstack/trunk/trunk.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2018 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -from six.moves import configparser - -from functest.opnfv_tests.openstack.tempest import tempest - - -class TempestNeutronTrunk(tempest.TempestCommon): - """Tempest neutron trunk testcase implementation.""" - - def configure(self, **kwargs): - super(TempestNeutronTrunk, self).configure(**kwargs) - rconfig = configparser.RawConfigParser() - rconfig.read(self.conf_file) - rconfig.set('network-feature-enabled', 'api_extensions', 'all') - with open(self.conf_file, 'wb') as config_file: - rconfig.write(config_file) - self.backup_tempest_config(self.conf_file, self.res_dir)