Add new config option to globally trigger resource validation

This commit adds a new config option to the config group to trigger
all the validation code. It also deprecates the run_ssh option in the
compute group since this will eventually be used globally. The intent
of this option is so that it will trigger both the creation of any
validation resources as well as used as run_ssh was originally
intended, to trigger ssh into nodes when needed.

Closes-Bug: #1453936
Partially-Implements: bp ssh-auth-strategy
Change-Id: I7d04f81457fc564ed82872e602746c8162fef24c
This commit is contained in:
Matthew Treinish 2015-05-11 15:36:50 -04:00
parent 4a5fce2deb
commit e5cca002ef
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
7 changed files with 22 additions and 14 deletions

View File

@ -240,9 +240,6 @@
# value) # value)
#build_timeout = 300 #build_timeout = 300
# Should the tests ssh to instances? (boolean value)
#run_ssh = false
# Auth method used for authenticate to the instance. Valid choices # Auth method used for authenticate to the instance. Valid choices
# are: keypair, configured, adminpass and disabled. Keypair: start the # are: keypair, configured, adminpass and disabled. Keypair: start the
# servers with a ssh keypair. Configured: use the configured user and # servers with a ssh keypair. Configured: use the configured user and
@ -289,7 +286,7 @@
#fixed_network_name = <None> #fixed_network_name = <None>
# Network used for SSH connections. Ignored if # Network used for SSH connections. Ignored if
# use_floatingip_for_ssh=true or run_ssh=false. (string value) # use_floatingip_for_ssh=true or run_validation=false. (string value)
#network_for_ssh = public #network_for_ssh = public
# IP version used for SSH connections. (integer value) # IP version used for SSH connections. (integer value)
@ -1071,6 +1068,11 @@
# From tempest.config # From tempest.config
# #
# Enable ssh on created servers and creation of additional validation
# resources to enable remote access (boolean value)
# Deprecated group/name - [compute]/run_ssh
#run_validation = false
# Default IP type used for validation: -fixed: uses the first IP # Default IP type used for validation: -fixed: uses the first IP
# belonging to the fixed network -floating: creates and uses a # belonging to the fixed network -floating: creates and uses a
# floating IP (string value) # floating IP (string value)

View File

@ -95,7 +95,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
self.assertTrue(found) self.assertTrue(found)
@test.idempotent_id('cbc0f52f-05aa-492b-bdc1-84b575ca294b') @test.idempotent_id('cbc0f52f-05aa-492b-bdc1-84b575ca294b')
@testtools.skipUnless(CONF.compute.run_ssh, @testtools.skipUnless(CONF.validation.run_validation,
'Instance validation tests are disabled.') 'Instance validation tests are disabled.')
def test_verify_created_server_vcpus(self): def test_verify_created_server_vcpus(self):
# Verify that the number of vcpus reported by the instance matches # Verify that the number of vcpus reported by the instance matches
@ -106,7 +106,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus()) self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus())
@test.idempotent_id('ac1ad47f-984b-4441-9274-c9079b7a0666') @test.idempotent_id('ac1ad47f-984b-4441-9274-c9079b7a0666')
@testtools.skipUnless(CONF.compute.run_ssh, @testtools.skipUnless(CONF.validation.run_validation,
'Instance validation tests are disabled.') 'Instance validation tests are disabled.')
def test_host_name_is_same_as_server_name(self): def test_host_name_is_same_as_server_name(self):
# Verify the instance host name is the same as the server name # Verify the instance host name is the same as the server name
@ -206,7 +206,7 @@ class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
cls.client = cls.servers_client cls.client = cls.servers_client
@test.idempotent_id('b3c7bcfc-bb5b-4e22-b517-c7f686b802ca') @test.idempotent_id('b3c7bcfc-bb5b-4e22-b517-c7f686b802ca')
@testtools.skipUnless(CONF.compute.run_ssh, @testtools.skipUnless(CONF.validation.run_validation,
'Instance validation tests are disabled.') 'Instance validation tests are disabled.')
def test_verify_created_server_ephemeral_disk(self): def test_verify_created_server_ephemeral_disk(self):
# Verify that the ephemeral disk is created when creating server # Verify that the ephemeral disk is created when creating server

View File

@ -33,7 +33,7 @@ LOG = logging.getLogger(__name__)
class ServerActionsTestJSON(base.BaseV2ComputeTest): class ServerActionsTestJSON(base.BaseV2ComputeTest):
run_ssh = CONF.compute.run_ssh run_ssh = CONF.validation.run_validation
def setUp(self): def setUp(self):
# NOTE(afazekas): Normally we use the same server with all test cases, # NOTE(afazekas): Normally we use the same server with all test cases,

View File

@ -85,7 +85,8 @@ class AttachVolumeTestJSON(base.BaseV2ComputeTest):
self.addCleanup(self._detach, self.server['id'], self.volume['id']) self.addCleanup(self._detach, self.server['id'], self.volume['id'])
@test.idempotent_id('52e9045a-e90d-4c0d-9087-79d657faffff') @test.idempotent_id('52e9045a-e90d-4c0d-9087-79d657faffff')
@testtools.skipUnless(CONF.compute.run_ssh, 'SSH required for this test') @testtools.skipUnless(CONF.validation.run_validation,
'SSH required for this test')
def test_attach_detach_volume(self): def test_attach_detach_volume(self):
# Stop and Start a server with an attached volume, ensuring that # Stop and Start a server with an attached volume, ensuring that
# the volume remains attached. # the volume remains attached.

View File

@ -195,9 +195,6 @@ ComputeGroup = [
help="Timeout in seconds to wait for an instance to build. " help="Timeout in seconds to wait for an instance to build. "
"Other services that do not define build_timeout will " "Other services that do not define build_timeout will "
"inherit this value."), "inherit this value."),
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
cfg.StrOpt('ssh_auth_method', cfg.StrOpt('ssh_auth_method',
default='keypair', default='keypair',
help="Auth method used for authenticate to the instance. " help="Auth method used for authenticate to the instance. "
@ -249,7 +246,7 @@ ComputeGroup = [
cfg.StrOpt('network_for_ssh', cfg.StrOpt('network_for_ssh',
default='public', default='public',
help="Network used for SSH connections. Ignored if " help="Network used for SSH connections. Ignored if "
"use_floatingip_for_ssh=true or run_ssh=false."), "use_floatingip_for_ssh=true or run_validation=false."),
cfg.IntOpt('ip_version_for_ssh', cfg.IntOpt('ip_version_for_ssh',
default=4, default=4,
help="IP version used for SSH connections."), help="IP version used for SSH connections."),
@ -558,6 +555,12 @@ validation_group = cfg.OptGroup(name='validation',
title='SSH Validation options') title='SSH Validation options')
ValidationGroup = [ ValidationGroup = [
cfg.BoolOpt('run_validation',
default=False,
help='Enable ssh on created servers and creation of additional'
' validation resources to enable remote access',
deprecated_opts=[cfg.DeprecatedOpt('run_ssh',
group='compute')]),
cfg.StrOpt('connect_method', cfg.StrOpt('connect_method',
default='floating', default='floating',
choices=['fixed', 'floating'], choices=['fixed', 'floating'],

View File

@ -56,7 +56,7 @@ class TestServerBasicOps(manager.ScenarioTest):
image=self.image_ref, flavor=self.flavor_ref image=self.image_ref, flavor=self.flavor_ref
) )
) )
self.run_ssh = CONF.compute.run_ssh and \ self.run_ssh = CONF.validation.run_validation and \
self.image_utils.is_sshable_image(self.image_ref) self.image_utils.is_sshable_image(self.image_ref)
self.ssh_user = self.image_utils.ssh_user(self.image_ref) self.ssh_user = self.image_utils.ssh_user(self.image_ref)
LOG.debug('Starting test for i:{image}, f:{flavor}. ' LOG.debug('Starting test for i:{image}, f:{flavor}. '

View File

@ -464,6 +464,8 @@ class BaseTestCase(testtools.testcase.WithAttributes,
@param security_group_rules @param security_group_rules
@param floating_ip @param floating_ip
""" """
if not CONF.validation.run_validation:
return
if keypair is None: if keypair is None:
if CONF.validation.auth_method.lower() == "keypair": if CONF.validation.auth_method.lower() == "keypair":
keypair = True keypair = True