From 0d22e5c1e1d6b49a99f0ca5be722fdc50ed105a4 Mon Sep 17 00:00:00 2001 From: spisarski Date: Wed, 31 May 2017 12:46:36 -0600 Subject: SNAPS tests now support offline testing. Images by type (cirros, centos, ubuntu) can now have the download URL be overridden, told to leverage a local file, or have custom configuration when using the snaps.openstack.tests.openstack_tests.py image settings helper functions. JIRA: FUNCTEST-809 Change-Id: I790094a7a26eb5a55f53d6e875c658dc5e7ac2f9 Signed-off-by: spisarski --- functest/opnfv_tests/openstack/snaps/api_check.py | 3 ++- functest/opnfv_tests/openstack/snaps/health_check.py | 11 +++-------- functest/opnfv_tests/openstack/snaps/smoke.py | 19 +++---------------- .../opnfv_tests/openstack/snaps/snaps_test_runner.py | 4 ++++ functest/opnfv_tests/openstack/vping/vping_base.py | 2 +- 5 files changed, 13 insertions(+), 26 deletions(-) (limited to 'functest/opnfv_tests/openstack') 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/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 71460676..d3405ab1 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -25,7 +25,7 @@ from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils, nova_utils -class VPingBase(testcase.OSGCTestCase): +class VPingBase(testcase.TestCase): """ Base class for vPing tests that check connectivity between two VMs shared -- cgit 1.2.3-korg