From 96bacd7d8ffb9c05672c0a1fc6e68d19e4a6793a Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 8 Apr 2017 13:38:45 +0200 Subject: Modify TestCase constructor attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every feature/testcase now allows receiving the data defined in testcases.yaml as args (name is renamed to case_name). From the time being, only project and case names are handled. Next pending patches will add criteria, cmd and repo to this list. It keeps the default values for case names except for features which will be aggregated into Feature. Change-Id: Id742d100b8183d7f10894c24ae6879d1b2b60ac9 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/openstack/rally/rally.py | 16 +++++---- .../openstack/refstack_client/refstack_client.py | 6 ++-- functest/opnfv_tests/openstack/snaps/api_check.py | 6 ++-- .../openstack/snaps/connection_check.py | 6 ++-- .../opnfv_tests/openstack/snaps/health_check.py | 6 ++-- functest/opnfv_tests/openstack/snaps/smoke.py | 6 ++-- .../openstack/snaps/snaps_test_runner.py | 4 +-- functest/opnfv_tests/openstack/tempest/tempest.py | 40 ++++++++++++++-------- functest/opnfv_tests/openstack/vping/vping_base.py | 4 +-- functest/opnfv_tests/openstack/vping/vping_ssh.py | 6 ++-- .../opnfv_tests/openstack/vping/vping_userdata.py | 6 ++-- 11 files changed, 68 insertions(+), 38 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 e7411c51d..ad8745c70 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -56,8 +56,8 @@ class RallyBase(testcase.TestCase): RALLY_PRIVATE_SUBNET_CIDR = CONST.rally_subnet_cidr RALLY_ROUTER_NAME = CONST.rally_router_name - def __init__(self, case_name=''): - super(RallyBase, self).__init__(case_name) + def __init__(self, **kwargs): + super(RallyBase, self).__init__(**kwargs) self.mode = '' self.summary = [] self.scenario_dir = '' @@ -536,8 +536,10 @@ class RallyBase(testcase.TestCase): class RallySanity(RallyBase): - def __init__(self, case_name="rally_sanity"): - super(RallySanity, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "rally_sanity" + super(RallySanity, self).__init__(**kwargs) self.mode = 'sanity' self.test_name = 'all' self.smoke = True @@ -545,8 +547,10 @@ class RallySanity(RallyBase): class RallyFull(RallyBase): - def __init__(self, case_name="rally_full"): - super(RallyFull, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "rally_full" + super(RallyFull, self).__init__(**kwargs) self.mode = 'full' self.test_name = 'all' self.smoke = False diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 441abfee3..c708a2230 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -25,8 +25,10 @@ logger = ft_logger.Logger("refstack_defcore").getLogger() class RefstackClient(testcase.TestCase): - def __init__(self, case_name="refstack_defcore"): - super(RefstackClient, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "refstack_defcore" + super(RefstackClient, self).__init__(**kwargs) self.FUNCTEST_TEST = CONST.dir_functest_test self.CONF_PATH = CONST.refstack_tempest_conf_path self.DEFCORE_LIST = CONST.refstack_defcore_list diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py index dea1ca759..bceb7c1d3 100644 --- a/functest/opnfv_tests/openstack/snaps/api_check.py +++ b/functest/opnfv_tests/openstack/snaps/api_check.py @@ -20,8 +20,10 @@ class ApiCheck(SnapsTestRunner): that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, and Nova """ - def __init__(self, case_name="api_check"): - super(ApiCheck, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "api_check" + super(ApiCheck, self).__init__(**kwargs) self.suite = unittest.TestSuite() diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py index 57b74d4c2..0607beb32 100644 --- a/functest/opnfv_tests/openstack/snaps/connection_check.py +++ b/functest/opnfv_tests/openstack/snaps/connection_check.py @@ -20,8 +20,10 @@ class ConnectionCheck(SnapsTestRunner): that simply obtain the different OpenStack clients and may perform simple queries """ - def __init__(self, case_name="connection_check"): - super(ConnectionCheck, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "connection_check" + super(ConnectionCheck, self).__init__(**kwargs) self.suite = unittest.TestSuite() diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py index 6b3cfdd0d..245f50525 100644 --- a/functest/opnfv_tests/openstack/snaps/health_check.py +++ b/functest/opnfv_tests/openstack/snaps/health_check.py @@ -21,8 +21,10 @@ class HealthCheck(SnapsTestRunner): creates a VM with a single port with an IPv4 address that is assigned by DHCP. This test then validates the expected IP with the actual """ - def __init__(self, case_name="snaps_health_check"): - super(HealthCheck, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "snaps_health_check" + super(HealthCheck, self).__init__(**kwargs) self.suite = unittest.TestSuite() diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py index 63d5c1223..ceead6bb1 100644 --- a/functest/opnfv_tests/openstack/snaps/smoke.py +++ b/functest/opnfv_tests/openstack/snaps/smoke.py @@ -21,8 +21,10 @@ class SnapsSmoke(SnapsTestRunner): that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, and Nova """ - def __init__(self, case_name="snaps_smoke"): - super(SnapsSmoke, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "snaps_smoke" + super(SnapsSmoke, self).__init__(**kwargs) self.suite = unittest.TestSuite() use_fip = CONST.snaps_use_floating_ips diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 044a0bb04..2068852e3 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -19,8 +19,8 @@ class SnapsTestRunner(PyTestSuiteRunner): creates a VM with a single port with an IPv4 address that is assigned by DHCP. This test then validates the expected IP with the actual """ - def __init__(self, case_name=''): - super(SnapsTestRunner, self).__init__(case_name) + def __init__(self, **kwargs): + super(SnapsTestRunner, self).__init__(**kwargs) self.ext_net_name = snaps_utils.get_ext_net_name() self.logger = ft_logger.Logger(self.project_name).getLogger() diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index c3184e352..8b175c250 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -28,8 +28,8 @@ logger = ft_logger.Logger("Tempest").getLogger() class TempestCommon(testcase.TestCase): - def __init__(self, case_name=''): - super(TempestCommon, self).__init__(case_name) + def __init__(self, **kwargs): + super(TempestCommon, self).__init__(**kwargs) self.MODE = "" self.OPTION = "" self.VERIFIER_ID = conf_utils.get_verifier_id() @@ -234,31 +234,39 @@ class TempestCommon(testcase.TestCase): class TempestSmokeSerial(TempestCommon): - def __init__(self, case_name='tempest_smoke_serial'): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest_smoke_serial' + TempestCommon.__init__(self, **kwargs) self.MODE = "smoke" self.OPTION = "--concurrency 1" class TempestSmokeParallel(TempestCommon): - def __init__(self, case_name='tempest_smoke_parallel'): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest_smoke_parallel' + TempestCommon.__init__(self, **kwargs) self.MODE = "smoke" self.OPTION = "" class TempestFullParallel(TempestCommon): - def __init__(self, case_name="tempest_full_parallel"): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest_full_parallel' + TempestCommon.__init__(self, **kwargs) self.MODE = "full" class TempestMultisite(TempestCommon): - def __init__(self, case_name="multisite"): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'multisite' + TempestCommon.__init__(self, **kwargs) self.MODE = "feature_multisite" self.OPTION = "--concurrency 1" conf_utils.install_verifier_ext(CONST.dir_repo_kingbird) @@ -266,15 +274,19 @@ class TempestMultisite(TempestCommon): class TempestCustom(TempestCommon): - def __init__(self, case_name="tempest_custom"): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest_custom' + TempestCommon.__init__(self, **kwargs) self.MODE = "custom" self.OPTION = "--concurrency 1" class TempestDefcore(TempestCommon): - def __init__(self, case_name="tempest_defcore"): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest_defcore' + TempestCommon.__init__(self, **kwargs) self.MODE = "defcore" self.OPTION = "--concurrency 1" diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 64cb0004d..8f7cc1d22 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -18,8 +18,8 @@ from functest.utils.constants import CONST class VPingBase(testcase.TestCase): - def __init__(self, case_name=''): - super(VPingBase, self).__init__(case_name) + def __init__(self, **kwargs): + super(VPingBase, self).__init__(**kwargs) self.logger = None self.functest_repo = CONST.dir_repo_functest self.repo = CONST.dir_vping diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index a68b0ff75..c26c4e0c0 100755 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -24,8 +24,10 @@ import functest.core.testcase as testcase class VPingSSH(vping_base.VPingBase): - def __init__(self, case_name='vping_ssh'): - super(VPingSSH, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "vping_ssh" + super(VPingSSH, self).__init__(**kwargs) self.logger = ft_logger.Logger(self.case_name).getLogger() def do_vping(self, vm, test_ip): diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py index e9b869983..1b00ca23a 100755 --- a/functest/opnfv_tests/openstack/vping/vping_userdata.py +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -18,8 +18,10 @@ import vping_base class VPingUserdata(vping_base.VPingBase): - def __init__(self, case_name='vping_userdata'): - super(VPingUserdata, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "vping_userdata" + super(VPingUserdata, self).__init__(**kwargs) self.logger = ft_logger.Logger(self.case_name).getLogger() def boot_vm_preparation(self, config, vmname, test_ip): -- cgit 1.2.3-korg