From 5a94beb62293151ef6f4e94ed500579de1f3673e Mon Sep 17 00:00:00 2001 From: Panagiotis Karalis Date: Thu, 7 Jun 2018 16:11:33 +0300 Subject: SNAPS via functest with flavor metadata configurable The required data for the SNAPS flavors are sent through the config_functest yaml file in order for the SNAPS scenarios to be configured accordingly. If the config_functest yaml file includes empty flavor_extra_specs or there is not included this parameter, the SNAPS scenarios will be executed using the hardcoded value. Change-Id: I4ef46d1fe93497d658414170a72c4520d8f37808 Signed-off-by: Panagiotis Karalis --- functest/ci/config_functest.yaml | 1 + .../openstack/snaps/snaps_test_runner.py | 3 ++- functest/tests/unit/openstack/snaps/test_snaps.py | 27 ++++++++++++---------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 3e49d612a..67ecc3424 100644 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -44,6 +44,7 @@ general: snaps: use_keystone: 'True' use_floating_ips: 'True' + flavor_extra_specs: {} images: glance_tests: disk_file: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 7b111ed1b..70327ff89 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -44,7 +44,8 @@ class SnapsTestRunner(unit.Suite): self.use_keystone = ( getattr(config.CONF, 'snaps_use_keystone') == 'True') - self.flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None) + self.flavor_metadata = getattr(config.CONF, 'snaps_flavor_extra_specs', + None) self.logger.info("Using flavor metadata '%s'", self.flavor_metadata) self.image_metadata = None diff --git a/functest/tests/unit/openstack/snaps/test_snaps.py b/functest/tests/unit/openstack/snaps/test_snaps.py index 8bbf70f4a..9da4f2ac8 100644 --- a/functest/tests/unit/openstack/snaps/test_snaps.py +++ b/functest/tests/unit/openstack/snaps/test_snaps.py @@ -176,7 +176,7 @@ class HealthCheckTesting(unittest.TestCase): testcase.TestCase.EX_OK, self.health_check.is_successful()) args[0].assert_called_with(mock.ANY) args[1].assert_called_with( - mock.ANY, ext_net_name='foo', flavor_metadata=None, + mock.ANY, ext_net_name='foo', flavor_metadata=mock.ANY, image_metadata=mock.ANY, netconf_override=None, os_creds=self.os_creds, use_keystone=True) @@ -194,7 +194,7 @@ class HealthCheckTesting(unittest.TestCase): self.health_check.is_successful()) args[0].assert_called_with(mock.ANY) args[1].assert_called_with( - mock.ANY, ext_net_name='foo', flavor_metadata=None, + mock.ANY, ext_net_name='foo', flavor_metadata=mock.ANY, image_metadata=mock.ANY, netconf_override=None, os_creds=self.os_creds, use_keystone=True) @@ -212,7 +212,7 @@ class HealthCheckTesting(unittest.TestCase): testcase.TestCase.EX_OK, self.health_check.is_successful()) args[0].assert_called_with(mock.ANY) args[1].assert_called_with( - mock.ANY, ext_net_name='foo', flavor_metadata=None, + mock.ANY, ext_net_name='foo', flavor_metadata=mock.ANY, image_metadata=mock.ANY, netconf_override=None, os_creds=self.os_creds, use_keystone=True) @@ -243,9 +243,10 @@ class SmokeTesting(unittest.TestCase): self.assertEquals(testcase.TestCase.EX_OK, self.smoke.is_successful()) args[0].assert_called_with(mock.ANY) args[1].assert_called_with( - ext_net_name='foo', flavor_metadata=None, image_metadata=mock.ANY, - netconf_override=None, os_creds=self.os_creds, - suite=mock.ANY, use_floating_ips=True, use_keystone=True) + ext_net_name='foo', flavor_metadata=mock.ANY, + image_metadata=mock.ANY, netconf_override=None, + os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True, + use_keystone=True) @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' 'add_openstack_integration_tests') @@ -260,9 +261,10 @@ class SmokeTesting(unittest.TestCase): testcase.TestCase.EX_TESTCASE_FAILED, self.smoke.is_successful()) args[0].assert_called_with(mock.ANY) args[1].assert_called_with( - ext_net_name='foo', flavor_metadata=None, image_metadata=mock.ANY, - netconf_override=mock.ANY, os_creds=self.os_creds, - suite=mock.ANY, use_floating_ips=True, use_keystone=True) + ext_net_name='foo', flavor_metadata=mock.ANY, + image_metadata=mock.ANY, netconf_override=mock.ANY, + os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True, + use_keystone=True) @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' 'add_openstack_integration_tests') @@ -278,9 +280,10 @@ class SmokeTesting(unittest.TestCase): testcase.TestCase.EX_OK, self.smoke.is_successful()) args[0].assert_called_with(mock.ANY) args[1].assert_called_with( - ext_net_name='foo', flavor_metadata=None, image_metadata=mock.ANY, - netconf_override=None, os_creds=self.os_creds, - suite=mock.ANY, use_floating_ips=True, use_keystone=True) + ext_net_name='foo', flavor_metadata=mock.ANY, + image_metadata=mock.ANY, netconf_override=None, + os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True, + use_keystone=True) if __name__ == "__main__": -- cgit 1.2.3-korg