summaryrefslogtreecommitdiff
path: root/tempest/api/compute
diff options
context:
space:
mode:
authorAndrea Frittoli <andrea.frittoli@gmail.com>2017-03-24 14:44:19 +0000
committerJens Rosenboom <j.rosenboom@x-ion.de>2017-03-24 18:50:34 +0000
commitcec4494d973498197a3a3ed5a347a866bd81f79b (patch)
tree0b61f450fd6b439eda259b28a8da67c338a8f052 /tempest/api/compute
parentb70e641d6ddf04dba84f563a4ebd54090f035a11 (diff)
downloadtempest-cec4494d973498197a3a3ed5a347a866bd81f79b.tar.gz
Fix race in test_attach_detach_volume
The test boots a server, attaches a volume and then power cycles the server, to check that the volume is still attached. When ssh validation is on, we must wait for the ssh key to be injected in the guest authorized keys file, before power cycling, otherwise ssh will fail later in the test. Change-Id: I506085b4efd2501e41e91530b3fedcfad286ef0e
Diffstat (limited to 'tempest/api/compute')
-rw-r--r--tempest/api/compute/volumes/test_attach_volume.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 73c7614a5..054877e15 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -65,6 +65,20 @@ class AttachVolumeTestJSON(base.BaseV2ComputeTest):
# Stop and Start a server with an attached volume, ensuring that
# the volume remains attached.
server = self._create_server()
+
+ # NOTE(andreaf) Create one remote client used throughout the test.
+ if CONF.validation.run_validation:
+ linux_client = remote_client.RemoteClient(
+ self.get_server_ip(server),
+ self.image_ssh_user,
+ self.image_ssh_password,
+ self.validation_resources['keypair']['private_key'],
+ server=server,
+ servers_client=self.servers_client)
+ # NOTE(andreaf) We need to ensure the ssh key has been
+ # injected in the guest before we power cycle
+ linux_client.validate_authentication()
+
volume = self.create_volume()
attachment = self.attach_volume(server, volume,
device=('/dev/%s' % self.device))
@@ -78,14 +92,6 @@ class AttachVolumeTestJSON(base.BaseV2ComputeTest):
'ACTIVE')
if CONF.validation.run_validation:
- linux_client = remote_client.RemoteClient(
- self.get_server_ip(server),
- self.image_ssh_user,
- self.image_ssh_password,
- self.validation_resources['keypair']['private_key'],
- server=server,
- servers_client=self.servers_client)
-
disks = linux_client.get_disks()
device_name_to_match = '\n' + self.device + ' '
self.assertIn(device_name_to_match, disks)
@@ -103,14 +109,6 @@ class AttachVolumeTestJSON(base.BaseV2ComputeTest):
'ACTIVE')
if CONF.validation.run_validation:
- linux_client = remote_client.RemoteClient(
- self.get_server_ip(server),
- self.image_ssh_user,
- self.image_ssh_password,
- self.validation_resources['keypair']['private_key'],
- server=server,
- servers_client=self.servers_client)
-
disks = linux_client.get_disks()
self.assertNotIn(device_name_to_match, disks)