From 273ced7ee6c32d01fe0a91f41f25dfc2083b2cb3 Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Fri, 10 Nov 2017 08:35:19 +0000 Subject: Select the subset of snaps test cases Change-Id: I03e422d5dae0ced9cd7a5477c31359ffc7795c42 Signed-off-by: Linda Wang --- functest/opnfv_tests/openstack/snaps/api_check.py | 5 +- .../openstack/snaps/connection_check.py | 5 +- functest/opnfv_tests/openstack/snaps/smoke.py | 5 +- .../openstack/snaps/snaps_suite_builder.py | 428 +++++++++++++++++++++ functest/tests/unit/openstack/snaps/test_snaps.py | 36 +- 5 files changed, 458 insertions(+), 21 deletions(-) create mode 100644 functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py (limited to 'functest') diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py index c3cd9063..e708b4de 100644 --- a/functest/opnfv_tests/openstack/snaps/api_check.py +++ b/functest/opnfv_tests/openstack/snaps/api_check.py @@ -8,8 +8,7 @@ import unittest -from snaps import test_suite_builder - +from functest.opnfv_tests.openstack.snaps import snaps_suite_builder from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ SnapsTestRunner @@ -33,7 +32,7 @@ class ApiCheck(SnapsTestRunner): :param kwargs: the arguments to pass on :return: """ - test_suite_builder.add_openstack_api_tests( + snaps_suite_builder.add_openstack_api_tests( suite=self.suite, os_creds=self.os_creds, ext_net_name=self.ext_net_name, diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py index 494f74b4..1fc49349 100644 --- a/functest/opnfv_tests/openstack/snaps/connection_check.py +++ b/functest/opnfv_tests/openstack/snaps/connection_check.py @@ -8,8 +8,7 @@ import unittest -from snaps import test_suite_builder - +from functest.opnfv_tests.openstack.snaps import snaps_suite_builder from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ SnapsTestRunner @@ -33,7 +32,7 @@ class ConnectionCheck(SnapsTestRunner): :param kwargs: the arguments to pass on :return: """ - test_suite_builder.add_openstack_client_tests( + snaps_suite_builder.add_openstack_client_tests( suite=self.suite, os_creds=self.os_creds, ext_net_name=self.ext_net_name, diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py index 7a3eb2f8..537315e7 100644 --- a/functest/opnfv_tests/openstack/snaps/smoke.py +++ b/functest/opnfv_tests/openstack/snaps/smoke.py @@ -8,8 +8,7 @@ import unittest -from snaps import test_suite_builder - +from functest.opnfv_tests.openstack.snaps import snaps_suite_builder from functest.opnfv_tests.openstack.snaps.snaps_test_runner import ( SnapsTestRunner) @@ -33,7 +32,7 @@ class SnapsSmoke(SnapsTestRunner): :param kwargs: the arguments to pass on :return: """ - test_suite_builder.add_openstack_integration_tests( + snaps_suite_builder.add_openstack_integration_tests( suite=self.suite, os_creds=self.os_creds, ext_net_name=self.ext_net_name, diff --git a/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py b/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py new file mode 100644 index 00000000..b83967d3 --- /dev/null +++ b/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py @@ -0,0 +1,428 @@ +# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. +# +# 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 + +import logging + +from snaps.openstack.tests.create_flavor_tests import ( + CreateFlavorTests) +from snaps.openstack.tests.create_image_tests import ( + CreateImageSuccessTests, CreateImageNegativeTests, + CreateMultiPartImageTests) +from snaps.openstack.tests.create_instance_tests import ( + CreateInstanceSingleNetworkTests, CreateInstanceOnComputeHost, + CreateInstanceSimpleTests, InstanceSecurityGroupTests, + CreateInstancePortManipulationTests, SimpleHealthCheck, + CreateInstanceFromThreePartImage, CreateInstanceTwoNetTests, + CreateInstanceVolumeTests) +from snaps.openstack.tests.create_keypairs_tests import ( + CreateKeypairsTests, CreateKeypairsCleanupTests) +from snaps.openstack.tests.create_network_tests import ( + CreateNetworkSuccessTests) +from snaps.openstack.tests.create_project_tests import ( + CreateProjectSuccessTests, CreateProjectUserTests) +from snaps.openstack.tests.create_qos_tests import ( + CreateQoSTests) +from snaps.openstack.tests.create_router_tests import ( + CreateRouterSuccessTests, CreateRouterNegativeTests) +from snaps.openstack.tests.create_security_group_tests import ( + CreateSecurityGroupTests) +from snaps.openstack.tests.create_stack_tests import ( + CreateStackSuccessTests, CreateStackNegativeTests, + CreateStackFlavorTests, CreateStackFloatingIpTests, + CreateStackKeypairTests, CreateStackVolumeTests, + CreateStackSecurityGroupTests) +from snaps.openstack.tests.create_user_tests import ( + CreateUserSuccessTests) +from snaps.openstack.tests.create_volume_tests import ( + CreateSimpleVolumeSuccessTests, + CreateVolumeWithTypeTests, CreateVolumeWithImageTests, + CreateSimpleVolumeFailureTests) +from snaps.openstack.tests.create_volume_type_tests import ( + CreateSimpleVolumeTypeSuccessTests, + CreateVolumeTypeComplexTests) +from snaps.openstack.tests.os_source_file_test import ( + OSComponentTestCase, OSIntegrationTestCase) +from snaps.openstack.utils.tests.cinder_utils_tests import ( + CinderSmokeTests, CinderUtilsQoSTests, CinderUtilsSimpleVolumeTypeTests, + CinderUtilsAddEncryptionTests, CinderUtilsVolumeTypeCompleteTests, + CinderUtilsVolumeTests) +from snaps.openstack.utils.tests.glance_utils_tests import ( + GlanceSmokeTests, GlanceUtilsTests) +from snaps.openstack.utils.tests.heat_utils_tests import ( + HeatSmokeTests, HeatUtilsCreateSimpleStackTests, + HeatUtilsCreateComplexStackTests, HeatUtilsFlavorTests, + HeatUtilsKeypairTests, HeatUtilsSecurityGroupTests) +from snaps.openstack.utils.tests.keystone_utils_tests import ( + KeystoneSmokeTests, KeystoneUtilsTests) +from snaps.openstack.utils.tests.neutron_utils_tests import ( + NeutronSmokeTests, NeutronUtilsNetworkTests, NeutronUtilsSubnetTests, + NeutronUtilsRouterTests, NeutronUtilsSecurityGroupTests, + NeutronUtilsFloatingIpTests) +from snaps.openstack.utils.tests.nova_utils_tests import ( + NovaSmokeTests, NovaUtilsKeypairTests, NovaUtilsFlavorTests, + NovaUtilsInstanceTests, NovaUtilsInstanceVolumeTests) +from snaps.provisioning.tests.ansible_utils_tests import ( + AnsibleProvisioningTests) + + +def add_openstack_client_tests(suite, os_creds, ext_net_name, + use_keystone=True, log_level=logging.INFO): + """ + Adds tests written to exercise OpenStack client retrieval + :param suite: the unittest.TestSuite object to which to add the tests + :param os_creds: and instance of OSCreds that holds the credentials + required by OpenStack + :param ext_net_name: the name of an external network on the cloud under + test + :param use_keystone: when True, tests requiring direct access to Keystone + are added as these need to be running on a host that + has access to the cloud's private network + :param log_level: the logging level + :return: None as the tests will be adding to the 'suite' parameter object + """ + # Basic connection tests + suite.addTest( + OSComponentTestCase.parameterize( + GlanceSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + + if use_keystone: + suite.addTest( + OSComponentTestCase.parameterize( + KeystoneSmokeTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level)) + + suite.addTest( + OSComponentTestCase.parameterize( + NeutronSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest( + OSComponentTestCase.parameterize( + NovaSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest( + OSComponentTestCase.parameterize( + HeatSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest( + OSComponentTestCase.parameterize( + CinderSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + + +def add_openstack_api_tests(suite, os_creds, ext_net_name, use_keystone=True, + image_metadata=None, log_level=logging.INFO): + """ + Adds tests written to exercise all existing OpenStack APIs + :param suite: the unittest.TestSuite object to which to add the tests + :param os_creds: Instance of OSCreds that holds the credentials + required by OpenStack + :param ext_net_name: the name of an external network on the cloud under + test + :param use_keystone: when True, tests requiring direct access to Keystone + are added as these need to be running on a host that + has access to the cloud's private network + :param image_metadata: dict() object containing metadata for creating an + image with custom config + (see YAML files in examples/image-metadata) + :param log_level: the logging level + :return: None as the tests will be adding to the 'suite' parameter object + """ + # Tests the OpenStack API calls + if use_keystone: + suite.addTest(OSComponentTestCase.parameterize( + KeystoneUtilsTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateUserSuccessTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateProjectSuccessTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateProjectUserTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level)) + + suite.addTest(OSComponentTestCase.parameterize( + GlanceUtilsTests, os_creds=os_creds, ext_net_name=ext_net_name, + image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsNetworkTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsSubnetTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsRouterTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsSecurityGroupTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsFloatingIpTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NovaUtilsKeypairTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NovaUtilsFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NovaUtilsInstanceTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level, image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + NovaUtilsInstanceVolumeTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + CreateFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + HeatUtilsCreateSimpleStackTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + HeatUtilsCreateComplexStackTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + HeatUtilsFlavorTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + HeatUtilsKeypairTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + HeatUtilsSecurityGroupTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + CinderUtilsQoSTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + CinderUtilsVolumeTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + CinderUtilsSimpleVolumeTypeTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + CinderUtilsAddEncryptionTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + suite.addTest(OSComponentTestCase.parameterize( + CinderUtilsVolumeTypeCompleteTests, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level, + image_metadata=image_metadata)) + + +def add_openstack_integration_tests(suite, os_creds, ext_net_name, + use_keystone=True, flavor_metadata=None, + image_metadata=None, use_floating_ips=True, + log_level=logging.INFO): + """ + Adds tests written to exercise all long-running OpenStack integration tests + meaning they will be creating VM instances and potentially performing some + SSH functions through floatingIPs + :param suite: the unittest.TestSuite object to which to add the tests + :param os_creds: and instance of OSCreds that holds the credentials + required by OpenStack + :param ext_net_name: the name of an external network on the cloud under + test + :param use_keystone: when True, tests requiring direct access to Keystone + are added as these need to be running on a host that + has access to the cloud's private network + :param image_metadata: dict() object containing metadata for creating an + image with custom config + (see YAML files in examples/image-metadata) + :param flavor_metadata: dict() object containing the metadata required by + your flavor based on your configuration: + (i.e. {'hw:mem_page_size': 'large'}) + :param use_floating_ips: when true, all tests requiring Floating IPs will + be added to the suite + :param log_level: the logging level + :return: None as the tests will be adding to the 'suite' parameter object + """ + # Tests the OpenStack API calls via a creator. If use_keystone, objects + # will be created with a custom user and project + + # Creator Object tests + suite.addTest(OSIntegrationTestCase.parameterize( + CreateSecurityGroupTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateImageSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateImageNegativeTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateMultiPartImageTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateKeypairsTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateKeypairsCleanupTests, os_creds=os_creds, + ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateNetworkSuccessTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateRouterSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateRouterNegativeTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateQoSTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateSimpleVolumeTypeSuccessTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateVolumeTypeComplexTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateSimpleVolumeSuccessTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateSimpleVolumeFailureTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateVolumeWithTypeTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateVolumeWithImageTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + + # VM Instances + suite.addTest(OSIntegrationTestCase.parameterize( + SimpleHealthCheck, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceTwoNetTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceSimpleTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstancePortManipulationTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + InstanceSecurityGroupTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceOnComputeHost, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceFromThreePartImage, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceVolumeTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackVolumeTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackKeypairTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackSecurityGroupTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackNegativeTests, os_creds=os_creds, ext_net_name=ext_net_name, + use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + + if use_floating_ips: + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceSingleNetworkTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateStackFloatingIpTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + AnsibleProvisioningTests, os_creds=os_creds, + ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, + log_level=log_level)) diff --git a/functest/tests/unit/openstack/snaps/test_snaps.py b/functest/tests/unit/openstack/snaps/test_snaps.py index 7cf53b39..83d6341f 100644 --- a/functest/tests/unit/openstack/snaps/test_snaps.py +++ b/functest/tests/unit/openstack/snaps/test_snaps.py @@ -31,7 +31,8 @@ class ConnectionCheckTesting(unittest.TestCase): self.connection_check = connection_check.ConnectionCheck( os_creds=self.os_creds, ext_net_name='foo') - @mock.patch('snaps.test_suite_builder.add_openstack_client_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_client_tests') def test_run_success(self, add_os_client_tests): result = mock.MagicMock(name='unittest.TextTestResult') result.testsRun = 100 @@ -42,7 +43,8 @@ class ConnectionCheckTesting(unittest.TestCase): self.assertEquals(TestCase.EX_OK, self.connection_check.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_client_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_client_tests') def test_run_1_of_100_failures(self, add_os_client_tests): result = mock.MagicMock(name='unittest.TextTestResult') result.testsRun = 100 @@ -53,7 +55,8 @@ class ConnectionCheckTesting(unittest.TestCase): self.assertEquals(TestCase.EX_TESTCASE_FAILED, self.connection_check.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_client_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_client_tests') def test_run_1_of_100_failures_within_criteria(self, add_os_client_tests): self.connection_check.criteria = 90 result = mock.MagicMock(name='unittest.TextTestResult') @@ -80,7 +83,8 @@ class APICheckTesting(unittest.TestCase): self.api_check = api_check.ApiCheck( os_creds=self.os_creds, ext_net_name='foo') - @mock.patch('snaps.test_suite_builder.add_openstack_api_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_api_tests') def test_run_success(self, add_tests): result = mock.MagicMock(name='unittest.TextTestResult') result.testsRun = 100 @@ -91,7 +95,8 @@ class APICheckTesting(unittest.TestCase): self.assertEquals(TestCase.EX_OK, self.api_check.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_api_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_api_tests') def test_run_1_of_100_failures(self, add_tests): result = mock.MagicMock(name='unittest.TextTestResult') result.testsRun = 100 @@ -102,7 +107,8 @@ class APICheckTesting(unittest.TestCase): self.assertEquals(TestCase.EX_TESTCASE_FAILED, self.api_check.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_api_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_api_tests') def test_run_1_of_100_failures_within_criteria(self, add_tests): self.api_check.criteria = 90 result = mock.MagicMock(name='unittest.TextTestResult') @@ -129,7 +135,8 @@ class HealthCheckTesting(unittest.TestCase): self.health_check = health_check.HealthCheck( os_creds=self.os_creds, ext_net_name='foo') - @mock.patch('snaps.test_suite_builder.add_openstack_client_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_client_tests') def test_run_success(self, add_tests): result = mock.MagicMock(name='unittest.TextTestResult') result.testsRun = 100 @@ -140,7 +147,8 @@ class HealthCheckTesting(unittest.TestCase): self.assertEquals(TestCase.EX_OK, self.health_check.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_client_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_client_tests') def test_run_1_of_100_failures(self, add_tests): result = mock.MagicMock(name='unittest.TextTestResult') result.testsRun = 100 @@ -151,7 +159,8 @@ class HealthCheckTesting(unittest.TestCase): self.assertEquals(TestCase.EX_TESTCASE_FAILED, self.health_check.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_client_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_client_tests') def test_run_1_of_100_failures_within_criteria(self, add_tests): self.health_check.criteria = 90 result = mock.MagicMock(name='unittest.TextTestResult') @@ -178,7 +187,8 @@ class SmokeTesting(unittest.TestCase): self.smoke = smoke.SnapsSmoke( os_creds=self.os_creds, ext_net_name='foo') - @mock.patch('snaps.test_suite_builder.add_openstack_integration_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_integration_tests') @mock.patch('os.path.join', return_value=os.getcwd()) def test_run_success(self, add_tests, cwd): result = mock.MagicMock(name='unittest.TextTestResult') @@ -190,7 +200,8 @@ class SmokeTesting(unittest.TestCase): self.assertEquals(TestCase.EX_OK, self.smoke.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_integration_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_integration_tests') @mock.patch('os.path.join', return_value=os.getcwd()) def test_run_1_of_100_failures(self, add_tests, cwd): result = mock.MagicMock(name='unittest.TextTestResult') @@ -202,7 +213,8 @@ class SmokeTesting(unittest.TestCase): self.assertEquals(TestCase.EX_TESTCASE_FAILED, self.smoke.is_successful()) - @mock.patch('snaps.test_suite_builder.add_openstack_integration_tests') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' + 'add_openstack_integration_tests') @mock.patch('os.path.join', return_value=os.getcwd()) def test_run_1_of_100_failures_within_criteria(self, add_tests, cwd): self.smoke.criteria = 90 -- cgit 1.2.3-korg