Validate instances are accessible before messing with their disks

This should help to isolate failures that are generic from specific test
failures related to barbican. If a test can't pass simple connectivity
check, it's probably broken, and there is no point to attach disks,
because it won't work.

Related-Bug: #1742936
Change-Id: I96cd35392f638c0e5b668f4f3b15cf4cd6114b71
This commit is contained in:
Ihar Hrachyshka 2018-01-18 13:40:09 -08:00
parent 5db05b85a2
commit 2d0cf0a500
2 changed files with 14 additions and 8 deletions

View File

@ -32,7 +32,9 @@ CONF = config.CONF
LOG = log.getLogger(__name__)
class ScenarioTest(manager.ScenarioTest):
# we inherit from NetworkScenarioTest since some test cases need access to
# check_*_connectivity methods to validate instances are up and accessible
class ScenarioTest(manager.NetworkScenarioTest):
"""Base class for scenario tests. Uses tempest own clients. """
credentials = ['primary']

View File

@ -55,17 +55,11 @@ class VolumeEncryptionTest(barbican_manager.BarbicanScenarioTest):
return self.create_volume(volume_type=volume_type['name'])
def attach_detach_volume(self, server, volume, keypair):
# test if server is accessible
server_ip = self.get_server_ip(server)
self.get_remote_client(
server_ip,
private_key=keypair['private_key']
)
# Attach volume
attached_volume = self.nova_volume_attach(server, volume)
# Write a timestamp to volume
server_ip = self.get_server_ip(server)
timestamp = self.create_timestamp(
server_ip,
dev_name=CONF.compute.volume_device_name,
@ -95,6 +89,11 @@ class VolumeEncryptionTest(barbican_manager.BarbicanScenarioTest):
security_groups=[{'name': security_group['name']}],
wait_until='ACTIVE'
)
# check that instance is accessible before messing with its disks
self.check_tenant_network_connectivity(
server, CONF.validation.image_ssh_user, keypair['private_key'])
volume = self.create_encrypted_volume('nova.volume.encryptors.'
'luks.LuksEncryptor',
volume_type='luks')
@ -115,6 +114,11 @@ class VolumeEncryptionTest(barbican_manager.BarbicanScenarioTest):
security_groups=[{'name': security_group['name']}],
wait_until='ACTIVE'
)
# check that instance is accessible before messing with its disks
self.check_tenant_network_connectivity(
server, CONF.validation.image_ssh_user, keypair['private_key'])
volume = self.create_encrypted_volume('nova.volume.encryptors.'
'cryptsetup.CryptsetupEncryptor',
volume_type='cryptsetup')