From 49a7e57f112d855b0609721b6082b15a94417380 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 23 May 2017 20:58:42 +0200 Subject: Define create_snapshot() and clean() in TestCase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They replace the former calls in run_tests which are not suitable for all test cases. Now any test case can define how to clean its resources. If the snapshot cannot be created, the test case is considered as failed. Only a message is printed if any failure during cleaning. It also defines a new class called OSGCTestCase useful for test cases which don't clean their OpenStack resources. All test cases located in opnfv_tests/openstack inherit from it to keep the global behavior unchanged. It also deletes exit instructions in openstack_clean and openstack_snapshot, removes clean flags in testcases.yaml and updates the related utils. All Docs are modified as well. JIRA: FUNCTEST-438 Change-Id: I8938e6255708012380389763a24059ace4ce45d8 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/openstack/rally/rally.py | 2 +- .../opnfv_tests/openstack/refstack_client/refstack_client.py | 2 +- functest/opnfv_tests/openstack/tempest/tempest.py | 2 +- functest/opnfv_tests/openstack/vping/vping_base.py | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'functest/opnfv_tests/openstack') diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 86ec3558..97e2444a 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -27,7 +27,7 @@ import functest.utils.openstack_utils as os_utils logger = logging.getLogger(__name__) -class RallyBase(testcase.TestCase): +class RallyBase(testcase.OSGCTestCase): TESTS = ['authenticate', 'glance', 'cinder', 'heat', 'keystone', 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all'] GLANCE_IMAGE_NAME = CONST.__getattribute__('openstack_image_name') diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 5f1f3a1d..b2a21533 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -27,7 +27,7 @@ from tempest_conf import TempestConf logger = logging.getLogger(__name__) -class RefstackClient(testcase.TestCase): +class RefstackClient(testcase.OSGCTestCase): def __init__(self, **kwargs): if "case_name" not in kwargs: diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index f5f194e6..99425af5 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -28,7 +28,7 @@ import functest.utils.functest_utils as ft_utils logger = logging.getLogger(__name__) -class TempestCommon(testcase.TestCase): +class TempestCommon(testcase.OSGCTestCase): def __init__(self, **kwargs): super(TempestCommon, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 8e71bf82..099f26b7 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -13,7 +13,7 @@ import os import time import uuid -from functest.core.testcase import TestCase +from functest.core import testcase from functest.utils import functest_utils from functest.utils.constants import CONST @@ -24,7 +24,7 @@ from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils, nova_utils -class VPingBase(TestCase): +class VPingBase(testcase.OSGCTestCase): """ Base class for vPing tests that check connectivity between two VMs shared @@ -152,12 +152,12 @@ class VPingBase(TestCase): else: raise Exception('VMs never became active') - if result == TestCase.EX_RUN_ERROR: - return TestCase.EX_RUN_ERROR + if result == testcase.TestCase.EX_RUN_ERROR: + return testcase.TestCase.EX_RUN_ERROR self.stop_time = time.time() self.result = 100 - return TestCase.EX_OK + return testcase.TestCase.EX_OK def _cleanup(self): """ -- cgit 1.2.3-korg