From 0208fc06f8873c341d8f3a070eff269025120af9 Mon Sep 17 00:00:00 2001 From: Ghanshyam Mann Date: Thu, 27 Jul 2023 11:57:31 -0700 Subject: [PATCH] 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 --- tempest/api/compute/base.py | 6 +++--- tempest/api/compute/servers/test_server_actions.py | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py index b1bfac7739..2700cd954d 100644 --- a/tempest/api/compute/base.py +++ b/tempest/api/compute/base.py @@ -326,18 +326,18 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest, 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 f181a99e6f..7afd9c21ac 100644 --- a/tempest/api/compute/servers/test_server_actions.py +++ b/tempest/api/compute/servers/test_server_actions.py @@ -207,9 +207,9 @@ class ServerActionsBase(base.BaseV2ComputeTest): # 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 @@ class ServerActionsTestJSON(ServerActionsBase): # "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 @@ class ServerActionsTestOtherB(ServerActionsBase): 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 @@ class ServerActionsTestOtherB(ServerActionsBase): 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,