From a0085b8f9da63c84fcf10000b1bb24791099013f Mon Sep 17 00:00:00 2001 From: "Castulo J. Martinez" Date: Wed, 2 Sep 2015 11:18:56 -0700 Subject: [PATCH] Fixes variables in Tempest generated config file The tempest configuration file generated by Rally when creating a deployment is being created with multiple errors. Some config values are being generated in the incorrect section and a few other values are being created wih an incorrect name. Also a few values and sections were removed from Tempest config file but are still added to the config file generated by Rally. Change-Id: I2731323e22abd6ef439f44ce0dfa427d1ee5c934 Closes-Bug: 1489636 --- rally/verification/tempest/config.ini | 31 ++++++++++----------- rally/verification/tempest/config.py | 16 +++++------ tests/unit/verification/test_config.py | 37 +++++++++++--------------- 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/rally/verification/tempest/config.ini b/rally/verification/tempest/config.ini index b9eb06f632..f6eaf3186e 100644 --- a/rally/verification/tempest/config.ini +++ b/rally/verification/tempest/config.ini @@ -3,49 +3,50 @@ debug = True log_file = tempest.log use_stderr = False +[auth] +allow_tenant_isolation = False + [boto] -ssh_user = cirros instance_type = m1.nano http_socket_timeout = 30 build_interval = 1 build_timeout = 196 -[cli] -cli_dir = /usr/local/bin - [compute] ssh_connect_method = floating -use_block_migration_for_live_migration = False -live_migration_available = False -image_alt_ssh_user = cirros image_ssh_user = cirros -ssh_timeout = 196 -ip_version_for_ssh = 4 +image_alt_ssh_user = cirros network_for_ssh = private ssh_user = cirros -allow_tenant_isolation = False -change_password_available = False build_interval = 1 build_timeout = 196 -[compute-admin] +[compute-feature-enabled] +change_password = False +live_migration = False +block_migration_for_live_migration = False [identity] [network] -default_network = 10.0.0.0/24 -tenant_networks_reachable = false -api_version = 2.0 +tenant_networks_reachable = False [network-feature-enabled] api_extensions = all ipv6 = True +[oslo_concurrency] + [scenario] large_ops_number = 0 +ssh_user = cirros [service_available] +[validation] +ssh_timeout = 196 +ip_version_for_ssh = 4 + [volume] build_interval = 1 build_timeout = 196 diff --git a/rally/verification/tempest/config.py b/rally/verification/tempest/config.py index b6f07ca41e..d1f9caade3 100644 --- a/rally/verification/tempest/config.py +++ b/rally/verification/tempest/config.py @@ -114,11 +114,15 @@ class TempestConf(object): return service["endpoints"][0]["publicURL"] def _set_default(self): + # Nothing to set up in this section for now + pass + + def _set_oslo_concurrency(self, section_name="oslo_concurrency"): lock_path = os.path.join(self.data_path, "lock_files_%s" % self.deployment) if not os.path.exists(lock_path): os.makedirs(lock_path) - self.conf.set("DEFAULT", "lock_path", lock_path) + self.conf.set(section_name, "lock_path", lock_path) def _set_boto(self, section_name="boto"): self.conf.set(section_name, "ec2_url", self._get_url("ec2")) @@ -176,12 +180,6 @@ class TempestConf(object): else: self.conf.set(section_name, "ssh_connect_method", "fixed") - def _set_compute_admin(self, section_name="compute-admin"): - self.conf.set(section_name, "username", self.endpoint["username"]) - self.conf.set(section_name, "password", self.endpoint["password"]) - self.conf.set(section_name, "tenant_name", - self.endpoint["tenant_name"]) - def _set_identity(self, section_name="identity"): self.conf.set(section_name, "username", self.endpoint["username"]) self.conf.set(section_name, "password", self.endpoint["password"]) @@ -229,10 +227,10 @@ class TempestConf(object): else: # TODO(akurilin): create subnet LOG.warn("No subnet is found.") - self.conf.set(section_name, "default_network", subnet["cidr"]) + self.conf.set(section_name, "tenant_network_cidr", subnet["cidr"]) else: network = self.clients.nova().networks.list()[0] - self.conf.set(section_name, "default_network", network.cidr) + self.conf.set(section_name, "tenant_network_cidr", network.cidr) def _set_service_available(self, section_name="service_available"): services = ["neutron", "heat", "ceilometer", "swift", diff --git a/tests/unit/verification/test_config.py b/tests/unit/verification/test_config.py index 51f67b7651..2a649712fb 100644 --- a/tests/unit/verification/test_config.py +++ b/tests/unit/verification/test_config.py @@ -106,7 +106,6 @@ class ConfigTestCase(test.TestCase): ("build_timeout", "196"), ("http_socket_timeout", "30"), ("instance_type", "m1.nano"), - ("ssh_user", "cirros"), ("s3_materials_path", os.path.join(self.conf_generator.data_path, "s3materials"))) @@ -114,15 +113,6 @@ class ConfigTestCase(test.TestCase): self.conf_generator.conf.items("boto")) self.assertEqual(sorted(expected), sorted(results)) - def test__set_compute_admin(self): - self.conf_generator._set_compute_admin() - expected = [("username", self.endpoint["username"]), - ("password", self.endpoint["password"]), - ("tenant_name", self.endpoint["tenant_name"])] - results = self._remove_default_section( - self.conf_generator.conf.items("compute-admin")) - self.assertEqual(sorted(expected), sorted(results)) - def test__set_compute_flavors(self): mock_novaclient = mock.MagicMock() mock_novaclient.flavors.list.return_value = [ @@ -217,18 +207,24 @@ class ConfigTestCase(test.TestCase): self.conf_generator.conf.get("compute", "ssh_connect_method")) + def test__set_default(self): + self.conf_generator._set_default() + expected = (("debug", "True"), ("log_file", "tempest.log"), + ("use_stderr", "False")) + results = self.conf_generator.conf.items("DEFAULT") + self.assertEqual(sorted(expected), sorted(results)) + @mock.patch("rally.verification.tempest.config.os.path.exists", return_value=False) @mock.patch("rally.verification.tempest.config.os.makedirs") - def test__set_default(self, mock_makedirs, mock_exists): - self.conf_generator._set_default() + def test__set_oslo_concurrency(self, mock_makedirs, mock_exists): + self.conf_generator._set_oslo_concurrency() lock_path = os.path.join(self.conf_generator.data_path, "lock_files_%s" % self.deployment) mock_makedirs.assert_called_once_with(lock_path) - expected = (("debug", "True"), ("log_file", "tempest.log"), - ("use_stderr", "False"), - ("lock_path", lock_path)) - results = self.conf_generator.conf.items("DEFAULT") + expected = (("lock_path", lock_path),) + results = self._remove_default_section( + self.conf_generator.conf.items("oslo_concurrency")) self.assertEqual(sorted(expected), sorted(results)) def test__set_identity(self): @@ -268,9 +264,8 @@ class ConfigTestCase(test.TestCase): mock_neutron}): self.conf_generator.available_services = ["neutron"] self.conf_generator._set_network() - expected = (("default_network", "10.0.0.0/24"), - ("tenant_networks_reachable", "false"), - ("api_version", "2.0"), + expected = (("tenant_network_cidr", "10.0.0.0/24"), + ("tenant_networks_reachable", "False"), ("public_network_id", "test_id"), ("public_router_id", "test_router")) results = self._remove_default_section( @@ -288,8 +283,8 @@ class ConfigTestCase(test.TestCase): with mock.patch.dict("sys.modules", {"novaclient": mock_nova}): self.conf_generator._set_network() self.assertEqual(network, - self.conf_generator.conf.get("network", - "default_network")) + self.conf_generator.conf.get( + "network", "tenant_network_cidr")) @mock.patch("rally.verification.tempest.config.requests") def test__set_service_available(self, mock_requests):