Add device name, ssh password to Tempest config

The following options have been added to the compute section of the
Tempest configuration:

- image_ssh_password
- image_alt_ssh_password
- volume_device_name

The "volume_device_name" is being added to rid the test_attach_volume
test of hardcoded data. In the effort to remove a hardcoded password
from the same test, we introduce the option "image_ssh_password" to
store the password instead. Then, the deprecated "ssh_user" in the
test is swapped out in favor of "image_ssh_user". Finally, we add an
"image_alt_ssh_password" so the option remains symmetrical to the
"image_ssh_password" option.

Closes-Bug: #1220514
Change-Id: If7816e534200c54826c1da0d0464f643163b8657
This commit is contained in:
Ryan Hsu
2013-09-03 21:44:49 -07:00
parent cfa91fbdb4
commit cb2e12505a
4 changed files with 31 additions and 6 deletions

View File

@@ -76,10 +76,18 @@ image_ref_alt = {$IMAGE_ID_ALT}
flavor_ref = 1
flavor_ref_alt = 2
# User names used to authenticate to an instance for a given image.
# User name used to authenticate to an instance
image_ssh_user = root
# Password used to authenticate to an instance
image_ssh_password = password
# User name used to authenticate to an instance using the alternate image
image_alt_ssh_user = root
# Password used to authenticate to an instance using the alternate image
image_alt_ssh_password = password
# Number of seconds to wait while looping to check the status of an
# instance that is building.
build_interval = 10
@@ -93,7 +101,7 @@ build_timeout = 600
# executing the tests
run_ssh = false
# Name of a user used to authenticated to an instance
# Name of a user used to authenticate to an instance.
ssh_user = cirros
# Visible fixed network name
@@ -150,6 +158,9 @@ disk_config_enabled = true
# When set to false, flavor extra data tests are forced to skip
flavor_extra_enabled = true
# Expected first device name when a volume is attached to an instance
volume_device_name = vdb
[whitebox]
# Whitebox options for compute. Whitebox options enable the
# whitebox test cases, which look at internal Nova database state,

View File

@@ -73,6 +73,8 @@ class BaseComputeTest(tempest.test.BaseTestCase):
cls.build_interval = cls.config.compute.build_interval
cls.build_timeout = cls.config.compute.build_timeout
cls.ssh_user = cls.config.compute.ssh_user
cls.image_ssh_user = cls.config.compute.image_ssh_user
cls.image_ssh_password = cls.config.compute.image_ssh_password
cls.image_ref = cls.config.compute.image_ref
cls.image_ref_alt = cls.config.compute.image_ref_alt
cls.flavor_ref = cls.config.compute.flavor_ref

View File

@@ -26,6 +26,7 @@ from tempest.test import attr
class AttachVolumeTestJSON(base.BaseComputeTest):
_interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh
device = tempest.config.TempestConfig().compute.volume_device_name
def __init__(self, *args, **kwargs):
super(AttachVolumeTestJSON, self).__init__(*args, **kwargs)
@@ -36,7 +37,7 @@ class AttachVolumeTestJSON(base.BaseComputeTest):
@classmethod
def setUpClass(cls):
super(AttachVolumeTestJSON, cls).setUpClass()
cls.device = 'vdb'
if not cls.config.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
@@ -54,7 +55,7 @@ class AttachVolumeTestJSON(base.BaseComputeTest):
def _create_and_attach(self):
# Start a server and wait for it to become ready
resp, server = self.create_server(wait_until='ACTIVE',
adminPass='password')
adminPass=self.image_ssh_password)
self.server = server
# Record addresses so that we can ssh later
@@ -92,7 +93,7 @@ class AttachVolumeTestJSON(base.BaseComputeTest):
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
linux_client = RemoteClient(server,
self.ssh_user, server['adminPass'])
self.image_ssh_user, server['adminPass'])
partitions = linux_client.get_partitions()
self.assertIn(self.device, partitions)
@@ -106,7 +107,7 @@ class AttachVolumeTestJSON(base.BaseComputeTest):
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
linux_client = RemoteClient(server,
self.ssh_user, server['adminPass'])
self.image_ssh_user, server['adminPass'])
partitions = linux_client.get_partitions()
self.assertNotIn(self.device, partitions)

View File

@@ -121,10 +121,17 @@ ComputeGroup = [
cfg.StrOpt('image_ssh_user',
default="root",
help="User name used to authenticate to an instance."),
cfg.StrOpt('image_ssh_password',
default="password",
help="Password used to authenticate to an instance."),
cfg.StrOpt('image_alt_ssh_user',
default="root",
help="User name used to authenticate to an instance using "
"the alternate image."),
cfg.StrOpt('image_alt_ssh_password',
default="password",
help="Password used to authenticate to an instance using "
"the alternate image."),
cfg.BoolOpt('resize_available',
default=False,
help="Does the test environment support resizing?"),
@@ -196,6 +203,10 @@ ComputeGroup = [
cfg.BoolOpt('flavor_extra_enabled',
default=True,
help="If false, skip flavor extra data test"),
cfg.StrOpt('volume_device_name',
default='vdb',
help="Expected device name when a volume is attached to "
"an instance")
]