Make recreate_server() wait until SSHABLE
Continuing the work to bandaid any tests that involve volume
attachment/detachment, make the setUp() method of
ServerActionsTestJSON wait for the SSHABLE status. Some of its tests,
for example test_rebuild_server_with_volume_attached, use a
class-level server resource that is created by setUp(). We also need
to add the optional wait_until kwarg to recreate_server(), as the
latter is called by setUp() in some cases.
Change-Id: I3b7bcadbb7d608d705754b6ad7e2869e07b81b75
Related-Bug: 1960310
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index e16afaf..41e73ec 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -412,7 +412,8 @@
return image
@classmethod
- def recreate_server(cls, server_id, validatable=False, **kwargs):
+ def recreate_server(cls, server_id, validatable=False, wait_until='ACTIVE',
+ **kwargs):
"""Destroy an existing class level server and creates a new one
Some test classes use a test server that can be used by multiple
@@ -440,7 +441,7 @@
validatable,
validation_resources=cls.get_class_validation_resources(
cls.os_primary),
- wait_until='ACTIVE',
+ wait_until=wait_until,
adminPass=cls.password,
**kwargs)
return server['id']
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 870c6f5..bd4e0e8 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -65,12 +65,12 @@
server = self.create_test_server(
validatable=True,
validation_resources=validation_resources,
- wait_until='ACTIVE')
+ wait_until='SSHABLE')
self.__class__.server_id = server['id']
except Exception:
# Rebuild server if something happened to it during a test
self.__class__.server_id = self.recreate_server(
- self.server_id, validatable=True)
+ self.server_id, validatable=True, wait_until='SSHABLE')
def tearDown(self):
super(ServerActionsTestJSON, self).tearDown()