Set image_alt_ssh_user during stack
At this moment, only image_ssh_user is present in the config of Tempest. It's set to cirros by default and used for SSH connections in tests. However, several tests build instances with image_ref_alt, but still use image_ssh_user to connect, which results in failure if image_ref_alt is set to a non-cirros image. They should use image_alt_ssh_user instead, which can be set to whichever user the image_ref_alt needs in either local.conf or during plugin installation. This change replaces image_ssh_user with image_alt_ssh_user and modifies Tempest's config to have access to said variable. It also adds a password variable in Tempest's config for the alternative image. Change-Id: Ibe81a068c6fdeb7cd1eedf1df76ce62737160a01 Closes-Bug: #1844535 Depends-On: https://review.opendev.org/682902/
This commit is contained in:
parent
f9bb8b8b21
commit
c54a911004
@ -0,0 +1,10 @@
|
||||
---
|
||||
features:
|
||||
- A new config option in the validation section, image_alt_ssh_user,
|
||||
to specify the user name used to authenticate to an alternative
|
||||
instance (instance using image_ref_alt) in tests. By default this
|
||||
is set to root.
|
||||
- A new config option in the validation section, image_alt_ssh_password,
|
||||
to specify the password used to authenticate to an alternative
|
||||
instance (instance using image_ref_alt) in tests. By default this
|
||||
is set to password.
|
@ -171,8 +171,11 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
cls.flavor_ref = CONF.compute.flavor_ref
|
||||
cls.flavor_ref_alt = CONF.compute.flavor_ref_alt
|
||||
cls.ssh_user = CONF.validation.image_ssh_user
|
||||
cls.ssh_alt_user = CONF.validation.image_alt_ssh_user
|
||||
cls.image_ssh_user = CONF.validation.image_ssh_user
|
||||
cls.image_alt_ssh_user = CONF.validation.image_alt_ssh_user
|
||||
cls.image_ssh_password = CONF.validation.image_ssh_password
|
||||
cls.image_alt_ssh_password = CONF.validation.image_alt_ssh_password
|
||||
|
||||
@classmethod
|
||||
def is_requested_microversion_compatible(cls, max_version):
|
||||
|
@ -228,7 +228,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
|
||||
# 4.Plain username/password auth, if a password was given.
|
||||
linux_client = remote_client.RemoteClient(
|
||||
self.get_server_ip(rebuilt_server, validation_resources),
|
||||
self.ssh_user,
|
||||
self.ssh_alt_user,
|
||||
password,
|
||||
validation_resources['keypair']['private_key'],
|
||||
server=rebuilt_server,
|
||||
@ -310,7 +310,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
|
||||
self.os_primary)
|
||||
linux_client = remote_client.RemoteClient(
|
||||
self.get_server_ip(server, validation_resources),
|
||||
self.ssh_user,
|
||||
self.ssh_alt_user,
|
||||
password=None,
|
||||
pkey=validation_resources['keypair']['private_key'],
|
||||
server=server,
|
||||
|
@ -865,10 +865,17 @@ ValidationGroup = [
|
||||
cfg.StrOpt('image_ssh_user',
|
||||
default="root",
|
||||
help="User name used to authenticate to an instance."),
|
||||
cfg.StrOpt('image_alt_ssh_user',
|
||||
default="root",
|
||||
help="User name used to authenticate to an alt instance."),
|
||||
cfg.StrOpt('image_ssh_password',
|
||||
default="password",
|
||||
help="Password used to authenticate to an instance.",
|
||||
secret=True),
|
||||
cfg.StrOpt('image_alt_ssh_password',
|
||||
default="password",
|
||||
help="Password used to authenticate to an alt instance.",
|
||||
secret=True),
|
||||
cfg.StrOpt('ssh_shell_prologue',
|
||||
default="set -eu -o pipefail; PATH=$$PATH:/sbin:/usr/sbin;",
|
||||
help="Shell fragments to use before executing a command "
|
||||
|
@ -80,8 +80,8 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
|
||||
return floating_ip
|
||||
|
||||
def _check_network_connectivity(self, server, keypair, floating_ip,
|
||||
should_connect=True):
|
||||
username = CONF.validation.image_ssh_user
|
||||
should_connect=True,
|
||||
username=CONF.validation.image_ssh_user):
|
||||
private_key = keypair['private_key']
|
||||
self.check_tenant_network_connectivity(
|
||||
server, username, private_key,
|
||||
@ -95,12 +95,13 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
|
||||
'Public network connectivity check failed',
|
||||
server)
|
||||
|
||||
def _wait_server_status_and_check_network_connectivity(self, server,
|
||||
keypair,
|
||||
floating_ip):
|
||||
def _wait_server_status_and_check_network_connectivity(
|
||||
self, server, keypair, floating_ip,
|
||||
username=CONF.validation.image_ssh_user):
|
||||
waiters.wait_for_server_status(self.servers_client, server['id'],
|
||||
'ACTIVE')
|
||||
self._check_network_connectivity(server, keypair, floating_ip)
|
||||
self._check_network_connectivity(server, keypair, floating_ip,
|
||||
username=username)
|
||||
|
||||
@decorators.idempotent_id('61f1aa9a-1573-410e-9054-afa557cab021')
|
||||
@decorators.attr(type='slow')
|
||||
@ -137,10 +138,11 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
|
||||
server = self._setup_server(keypair)
|
||||
floating_ip = self._setup_network(server, keypair)
|
||||
image_ref_alt = CONF.compute.image_ref_alt
|
||||
username_alt = CONF.validation.image_alt_ssh_user
|
||||
self.servers_client.rebuild_server(server['id'],
|
||||
image_ref=image_ref_alt)
|
||||
self._wait_server_status_and_check_network_connectivity(
|
||||
server, keypair, floating_ip)
|
||||
server, keypair, floating_ip, username_alt)
|
||||
|
||||
@decorators.idempotent_id('2b2642db-6568-4b35-b812-eceed3fa20ce')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
|
||||
|
Loading…
Reference in New Issue
Block a user