Merge "Add reboot_server() helper"

This commit is contained in:
Zuul 2021-08-26 00:35:20 +00:00 committed by Gerrit Code Review
commit 8e76271b5c
4 changed files with 10 additions and 10 deletions

View File

@ -454,6 +454,12 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
server = self.servers_client.show_server(server_id)['server']
self.assert_flavor_equal(new_flavor_id, server['flavor'])
def reboot_server(self, server_id, type):
"""Reboot a server and wait for it to be ACTIVE."""
self.servers_client.reboot_server(server_id, type=type)
waiters.wait_for_server_status(
self.servers_client, server_id, 'ACTIVE')
@classmethod
def delete_volume(cls, volume_id):
"""Deletes the given volume and waits for it to be gone."""

View File

@ -109,9 +109,7 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
sg['id'])
# Reboot and add the other security group
self.servers_client.reboot_server(server_id, type='HARD')
waiters.wait_for_server_status(self.servers_client, server_id,
'ACTIVE')
self.reboot_server(server_id, type='HARD')
self.servers_client.add_security_group(server_id, name=sg2['name'])
# Check that we are not able to delete the other security

View File

@ -37,9 +37,7 @@ class InstanceActionsTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
"""Test listing actions of the provided server"""
self.client.reboot_server(self.server['id'], type='HARD')
waiters.wait_for_server_status(self.client,
self.server['id'], 'ACTIVE')
self.reboot_server(self.server['id'], type='HARD')
body = (self.client.list_instance_actions(self.server['id'])
['instanceActions'])

View File

@ -136,8 +136,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
# in a server
linux_client.exec_command("sync")
self.client.reboot_server(self.server_id, type=reboot_type)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
self.reboot_server(self.server_id, type=reboot_type)
if CONF.validation.run_validation:
# Log in and verify the boot time has changed
@ -607,8 +606,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
self.client.reboot_server(self.server_id, type='HARD')
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
self.reboot_server(self.server_id, type='HARD')
self.wait_for(self._get_output)
@decorators.idempotent_id('89104062-69d8-4b19-a71b-f47b7af093d7')