diff options
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml | 11 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/task.yaml | 4 | ||||
-rwxr-xr-x | functest/opnfv_tests/openstack/refstack_client/refstack_client.py | 25 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/api_check.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/health_check.py | 11 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/smoke.py | 19 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_test_runner.py | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | functest/opnfv_tests/sdn/odl/odl.py | 27 |
9 files changed, 33 insertions, 76 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 8970a5c0..24c9147c 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -30,7 +30,7 @@ logger = logging.getLogger(__name__) class RallyBase(testcase.OSGCTestCase): TESTS = ['authenticate', 'glance', 'cinder', 'heat', 'keystone', - 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all'] + 'neutron', 'nova', 'quotas', 'vm', 'all'] GLANCE_IMAGE_NAME = CONST.__getattribute__('openstack_image_name') GLANCE_IMAGE_FILENAME = CONST.__getattribute__('openstack_image_file_name') GLANCE_IMAGE_PATH = os.path.join( @@ -102,9 +102,6 @@ class RallyBase(testcase.OSGCTestCase): else: task_args['netid'] = '' - # get keystone auth endpoint - task_args['request_url'] = CONST.__getattribute__('OS_AUTH_URL') or '' - return task_args def _prepare_test_list(self, test_name): diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml deleted file mode 100644 index 16136978..00000000 --- a/functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml +++ /dev/null @@ -1,11 +0,0 @@ - HttpRequests.check_request: - - - args: - url: "{{ request_url }}" - method: "GET" - status_code: 200 - allow_redirects: True - runner: - {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} - sla: - {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/task.yaml b/functest/opnfv_tests/openstack/rally/task.yaml index c482f120..033edb83 100644 --- a/functest/opnfv_tests/openstack/rally/task.yaml +++ b/functest/opnfv_tests/openstack/rally/task.yaml @@ -35,10 +35,6 @@ {%- include "var/opnfv-quotas.yaml"-%} {% endif %} -{% if "requests" in service_list %} -{%- include "var/opnfv-requests.yaml"-%} -{% endif %} - {% if "heat" in service_list %} {%- include "var/opnfv-heat.yaml"-%} {% endif %} diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 30d1cf08..c4618894 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. # matthew.lijun@huawei.com wangwulin@huawei.com # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -45,31 +45,18 @@ class RefstackClient(testcase.OSGCTestCase): self.defcorelist = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt') - def source_venv(self): - - cmd = ("cd {0};" - ". .venv/bin/activate;" - "cd -;".format(CONST.__getattribute__('dir_refstack_client'))) - ft_utils.execute_command(cmd) - def run_defcore(self, conf, testlist): logger.debug("Generating test case list...") - cmd = ("cd {0};" - "./refstack-client test -c {1} -v --test-list {2};" - "cd -;".format(CONST.__getattribute__('dir_refstack_client'), - conf, - testlist)) + cmd = ("refstack-client test -c {0} -v --test-list {1}" + .format(conf, testlist)) ft_utils.execute_command(cmd) def run_defcore_default(self): logger.debug("Generating test case list...") - cmd = ("cd {0};" - "./refstack-client test -c {1} -v --test-list {2};" - "cd -;".format(CONST.__getattribute__('dir_refstack_client'), - self.confpath, - self.defcorelist)) + cmd = ("refstack-client test -c {0} -v --test-list {1}" + .format(self.confpath, self.defcorelist)) logger.info("Starting Refstack_defcore test case: '%s'." % cmd) header = ("Refstack environment:\n" @@ -159,7 +146,6 @@ class RefstackClient(testcase.OSGCTestCase): try: tempestconf = TempestConf() tempestconf.generate_tempestconf() - self.source_venv() self.run_defcore_default() self.parse_refstack_result() res = testcase.TestCase.EX_OK @@ -192,7 +178,6 @@ class RefstackClient(testcase.OSGCTestCase): "%s", e) return self.EX_RUN_ERROR try: - self.source_venv() self._prep_test() self.run_defcore(self.confpath, self.testlist) res = testcase.TestCase.EX_OK diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py index 43518cb4..c3cd9063 100644 --- a/functest/opnfv_tests/openstack/snaps/api_check.py +++ b/functest/opnfv_tests/openstack/snaps/api_check.py @@ -37,5 +37,6 @@ class ApiCheck(SnapsTestRunner): suite=self.suite, os_creds=self.os_creds, ext_net_name=self.ext_net_name, - use_keystone=self.use_keystone) + use_keystone=self.use_keystone, + image_metadata=self.image_metadata) return super(self.__class__, self).run() diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py index 4e94460c..1b8d0537 100644 --- a/functest/opnfv_tests/openstack/snaps/health_check.py +++ b/functest/opnfv_tests/openstack/snaps/health_check.py @@ -8,9 +8,8 @@ import unittest -from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ - SnapsTestRunner -from functest.utils.constants import CONST +from functest.opnfv_tests.openstack.snaps.snaps_test_runner import ( + SnapsTestRunner) from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck @@ -35,15 +34,11 @@ class HealthCheck(SnapsTestRunner): :param kwargs: the arguments to pass on :return: """ - image_custom_config = None - - if hasattr(CONST, 'snaps_images_cirros'): - image_custom_config = CONST.__getattribute__('snaps_images_cirros') self.suite.addTest( OSIntegrationTestCase.parameterize( SimpleHealthCheck, os_creds=self.os_creds, ext_net_name=self.ext_net_name, use_keystone=self.use_keystone, flavor_metadata=self.flavor_metadata, - image_metadata=image_custom_config)) + image_metadata=self.image_metadata)) return super(self.__class__, self).run() diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py index c3c55c7c..7a3eb2f8 100644 --- a/functest/opnfv_tests/openstack/snaps/smoke.py +++ b/functest/opnfv_tests/openstack/snaps/smoke.py @@ -6,14 +6,12 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -import os import unittest from snaps import test_suite_builder -from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ - SnapsTestRunner -from functest.utils.constants import CONST +from functest.opnfv_tests.openstack.snaps.snaps_test_runner import ( + SnapsTestRunner) class SnapsSmoke(SnapsTestRunner): @@ -35,23 +33,12 @@ class SnapsSmoke(SnapsTestRunner): :param kwargs: the arguments to pass on :return: """ - image_config = None - if hasattr(CONST, 'snaps_images_cirros'): - image_config = CONST.__getattribute__('snaps_images_cirros') - - # Tests requiring floating IPs leverage files contained within the - # SNAPS repository and are found relative to that path - if self.use_fip: - snaps_dir = os.path.join(CONST.__getattribute__('dir_repo_snaps'), - 'snaps') - os.chdir(snaps_dir) - test_suite_builder.add_openstack_integration_tests( suite=self.suite, os_creds=self.os_creds, ext_net_name=self.ext_net_name, use_keystone=self.use_keystone, flavor_metadata=self.flavor_metadata, - image_metadata=image_config, + image_metadata=self.image_metadata, use_floating_ips=self.use_fip) return super(self.__class__, self).run() diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index e8a42159..0b87440b 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -46,3 +46,7 @@ class SnapsTestRunner(unit.Suite): self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE self.logger.info("Using flavor metadata '%s'", self.flavor_metadata) + + self.image_metadata = None + if hasattr(CONST, 'snaps_images'): + self.image_metadata = CONST.__getattribute__('snaps_images') diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index fb5dcbc6..67bf66e3 100755..100644 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -117,7 +117,7 @@ class ODLTests(testcase.TestCase): self.details['description'] = result.suite.name self.details['tests'] = visitor.get_data() - def main(self, suites=None, **kwargs): + def run_suites(self, suites=None, **kwargs): """Run the test suites It has been designed to be called in any context. @@ -246,7 +246,7 @@ class ODLTests(testcase.TestCase): self.__logger.exception("Cannot run ODL testcases.") return self.EX_RUN_ERROR - return self.main(suites, **kwargs) + return self.run_suites(suites, **kwargs) class ODLParser(object): # pylint: disable=too-few-public-methods @@ -301,16 +301,19 @@ class ODLParser(object): # pylint: disable=too-few-public-methods return vars(self.parser.parse_args(argv)) -if __name__ == '__main__': +def main(): + """Entry point""" logging.basicConfig() - ODL = ODLTests() - PARSER = ODLParser() - ARGS = PARSER.parse_args(sys.argv[1:]) + odl = ODLTests() + parser = ODLParser() + args = parser.parse_args(sys.argv[1:]) try: - RESULT = ODL.main(ODLTests.default_suites, **ARGS) - if RESULT != testcase.TestCase.EX_OK: - sys.exit(RESULT) - if ARGS['pushtodb']: - sys.exit(ODL.push_to_db()) + result = odl.run_suites(ODLTests.default_suites, **args) + if result != testcase.TestCase.EX_OK: + return result + if args['pushtodb']: + return odl.push_to_db() + else: + return result except Exception: # pylint: disable=broad-except - sys.exit(testcase.TestCase.EX_RUN_ERROR) + return testcase.TestCase.EX_RUN_ERROR |