Correct _get_console() to get console of correct server
_get_console() method always try to get the console
for the self.server which is created in setup but
test test_get_console_output_server_id_in_shutoff_status
create its own server and use _get_console method.
This way test create its own server but try to get
console of different server
Due to above issue test_get_console_output_server_id_in_shutoff_status
was always wrong which used to get the console for the server
created in the setup method and is in active state. This test
never tried to get the console of the shutoff server. After
correcting this tests, it fail 100% because Nova return 404
for shutoff server console. It is still under discussion that
what should be the expected behaviour in this case. Meanwhile
we figure that out, skipping this test to unblock the gate.
Related-Bug: #2028851
Change-Id: I86759f6b998f916b22d9ae0321b656598266be24
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index b1bfac7..2700cd9 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -326,18 +326,18 @@
body['id'])
return body
- def wait_for(self, condition):
+ def wait_for(self, condition, *args):
"""Repeatedly calls condition() until a timeout."""
start_time = int(time.time())
while True:
try:
- condition()
+ condition(*args)
except Exception:
pass
else:
return
if int(time.time()) - start_time >= self.build_timeout:
- condition()
+ condition(*args)
return
time.sleep(self.build_interval)
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f181a99..7afd9c2 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -207,9 +207,9 @@
# NOTE(mriedem): tearDown requires the server to be started.
self.client.start_server(server_id)
- def _get_output(self):
+ def _get_output(self, server_id):
output = self.client.get_console_output(
- self.server_id, length=3)['output']
+ server_id, length=3)['output']
self.assertTrue(output, "Console output was empty.")
lines = len(output.split('\n'))
self.assertEqual(lines, 3)
@@ -335,7 +335,7 @@
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
self.reboot_server(self.server_id, type='HARD')
- self.wait_for(self._get_output)
+ self.wait_for(self._get_output, self.server_id)
@decorators.idempotent_id('bd61a9fd-062f-4670-972b-2d6c3e3b9e73')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -707,6 +707,7 @@
self.wait_for(_check_full_length_console_log)
+ @decorators.skip_because(bug='2028851')
@decorators.idempotent_id('5b65d4e7-4ecd-437c-83c0-d6b79d927568')
@testtools.skipUnless(CONF.compute_feature_enabled.console_output,
'Console output not supported.')
@@ -725,7 +726,7 @@
self.client.stop_server(temp_server_id)
waiters.wait_for_server_status(self.client, temp_server_id, 'SHUTOFF')
- self.wait_for(self._get_output)
+ self.wait_for(self._get_output, temp_server_id)
@decorators.idempotent_id('77eba8e0-036e-4635-944b-f7a8f3b78dc9')
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,