Merge "Fixes variables in Tempest generated config file"

This commit is contained in:
Jenkins 2015-09-06 09:24:42 +00:00 committed by Gerrit Code Review
commit 024d4b5598
3 changed files with 39 additions and 45 deletions

View File

@ -3,49 +3,50 @@ debug = True
log_file = tempest.log log_file = tempest.log
use_stderr = False use_stderr = False
[auth]
allow_tenant_isolation = False
[boto] [boto]
ssh_user = cirros
instance_type = m1.nano instance_type = m1.nano
http_socket_timeout = 30 http_socket_timeout = 30
build_interval = 1 build_interval = 1
build_timeout = 196 build_timeout = 196
[cli]
cli_dir = /usr/local/bin
[compute] [compute]
ssh_connect_method = floating ssh_connect_method = floating
use_block_migration_for_live_migration = False
live_migration_available = False
image_alt_ssh_user = cirros
image_ssh_user = cirros image_ssh_user = cirros
ssh_timeout = 196 image_alt_ssh_user = cirros
ip_version_for_ssh = 4
network_for_ssh = private network_for_ssh = private
ssh_user = cirros ssh_user = cirros
allow_tenant_isolation = False
change_password_available = False
build_interval = 1 build_interval = 1
build_timeout = 196 build_timeout = 196
[compute-admin] [compute-feature-enabled]
change_password = False
live_migration = False
block_migration_for_live_migration = False
[identity] [identity]
[network] [network]
default_network = 10.0.0.0/24 tenant_networks_reachable = False
tenant_networks_reachable = false
api_version = 2.0
[network-feature-enabled] [network-feature-enabled]
api_extensions = all api_extensions = all
ipv6 = True ipv6 = True
[oslo_concurrency]
[scenario] [scenario]
large_ops_number = 0 large_ops_number = 0
ssh_user = cirros
[service_available] [service_available]
[validation]
ssh_timeout = 196
ip_version_for_ssh = 4
[volume] [volume]
build_interval = 1 build_interval = 1
build_timeout = 196 build_timeout = 196

View File

@ -114,11 +114,15 @@ class TempestConf(object):
return service["endpoints"][0]["publicURL"] return service["endpoints"][0]["publicURL"]
def _set_default(self): 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_path = os.path.join(self.data_path,
"lock_files_%s" % self.deployment) "lock_files_%s" % self.deployment)
if not os.path.exists(lock_path): if not os.path.exists(lock_path):
os.makedirs(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"): def _set_boto(self, section_name="boto"):
self.conf.set(section_name, "ec2_url", self._get_url("ec2")) self.conf.set(section_name, "ec2_url", self._get_url("ec2"))
@ -176,12 +180,6 @@ class TempestConf(object):
else: else:
self.conf.set(section_name, "ssh_connect_method", "fixed") 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"): def _set_identity(self, section_name="identity"):
self.conf.set(section_name, "username", self.endpoint["username"]) self.conf.set(section_name, "username", self.endpoint["username"])
self.conf.set(section_name, "password", self.endpoint["password"]) self.conf.set(section_name, "password", self.endpoint["password"])
@ -229,10 +227,10 @@ class TempestConf(object):
else: else:
# TODO(akurilin): create subnet # TODO(akurilin): create subnet
LOG.warn("No subnet is found.") 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: else:
network = self.clients.nova().networks.list()[0] 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"): def _set_service_available(self, section_name="service_available"):
services = ["neutron", "heat", "ceilometer", "swift", services = ["neutron", "heat", "ceilometer", "swift",

View File

@ -106,7 +106,6 @@ class ConfigTestCase(test.TestCase):
("build_timeout", "196"), ("build_timeout", "196"),
("http_socket_timeout", "30"), ("http_socket_timeout", "30"),
("instance_type", "m1.nano"), ("instance_type", "m1.nano"),
("ssh_user", "cirros"),
("s3_materials_path", ("s3_materials_path",
os.path.join(self.conf_generator.data_path, os.path.join(self.conf_generator.data_path,
"s3materials"))) "s3materials")))
@ -114,15 +113,6 @@ class ConfigTestCase(test.TestCase):
self.conf_generator.conf.items("boto")) self.conf_generator.conf.items("boto"))
self.assertEqual(sorted(expected), sorted(results)) 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): def test__set_compute_flavors(self):
mock_novaclient = mock.MagicMock() mock_novaclient = mock.MagicMock()
mock_novaclient.flavors.list.return_value = [ mock_novaclient.flavors.list.return_value = [
@ -217,18 +207,24 @@ class ConfigTestCase(test.TestCase):
self.conf_generator.conf.get("compute", self.conf_generator.conf.get("compute",
"ssh_connect_method")) "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", @mock.patch("rally.verification.tempest.config.os.path.exists",
return_value=False) return_value=False)
@mock.patch("rally.verification.tempest.config.os.makedirs") @mock.patch("rally.verification.tempest.config.os.makedirs")
def test__set_default(self, mock_makedirs, mock_exists): def test__set_oslo_concurrency(self, mock_makedirs, mock_exists):
self.conf_generator._set_default() self.conf_generator._set_oslo_concurrency()
lock_path = os.path.join(self.conf_generator.data_path, "lock_files_%s" lock_path = os.path.join(self.conf_generator.data_path, "lock_files_%s"
% self.deployment) % self.deployment)
mock_makedirs.assert_called_once_with(lock_path) mock_makedirs.assert_called_once_with(lock_path)
expected = (("debug", "True"), ("log_file", "tempest.log"), expected = (("lock_path", lock_path),)
("use_stderr", "False"), results = self._remove_default_section(
("lock_path", lock_path)) self.conf_generator.conf.items("oslo_concurrency"))
results = self.conf_generator.conf.items("DEFAULT")
self.assertEqual(sorted(expected), sorted(results)) self.assertEqual(sorted(expected), sorted(results))
def test__set_identity(self): def test__set_identity(self):
@ -268,9 +264,8 @@ class ConfigTestCase(test.TestCase):
mock_neutron}): mock_neutron}):
self.conf_generator.available_services = ["neutron"] self.conf_generator.available_services = ["neutron"]
self.conf_generator._set_network() self.conf_generator._set_network()
expected = (("default_network", "10.0.0.0/24"), expected = (("tenant_network_cidr", "10.0.0.0/24"),
("tenant_networks_reachable", "false"), ("tenant_networks_reachable", "False"),
("api_version", "2.0"),
("public_network_id", "test_id"), ("public_network_id", "test_id"),
("public_router_id", "test_router")) ("public_router_id", "test_router"))
results = self._remove_default_section( results = self._remove_default_section(
@ -288,8 +283,8 @@ class ConfigTestCase(test.TestCase):
with mock.patch.dict("sys.modules", {"novaclient": mock_nova}): with mock.patch.dict("sys.modules", {"novaclient": mock_nova}):
self.conf_generator._set_network() self.conf_generator._set_network()
self.assertEqual(network, self.assertEqual(network,
self.conf_generator.conf.get("network", self.conf_generator.conf.get(
"default_network")) "network", "tenant_network_cidr"))
@mock.patch("rally.verification.tempest.config.requests") @mock.patch("rally.verification.tempest.config.requests")
def test__set_service_available(self, mock_requests): def test__set_service_available(self, mock_requests):