summaryrefslogtreecommitdiff
path: root/novaclient/tests/functional/base.py
diff options
context:
space:
mode:
authorAnna Babich <ababich@mirantis.com>2016-02-15 12:33:22 +0200
committerAnna Babich <ababich@mirantis.com>2016-02-22 18:58:21 +0200
commitf5a25fe997b19ff71a335ece755c8904dc8136c8 (patch)
tree8e56c993de8938c70274345da40e454d155d3a33 /novaclient/tests/functional/base.py
parent079923864855cc7e8856c33c523d07f32eaa1f08 (diff)
downloadpython-novaclient-f5a25fe997b19ff71a335ece755c8904dc8136c8.tar.gz
Functional tests for trigger-crash-dump (microversion 2.17)
It's a resource-consuming task to implement full-flow (up to getting and reading a dump file) functional test for trigger-crash-dump. We need to upload Ubuntu image for booting an instance based on it, and to install kdump with its further configuring on this instance. Here, the "light" version of functional test is proposed. It's based on knowledge that trigger-crash-dump uses a NMI injection, and when the 'trigger-crash-dump' operation is executed, instance's kernel receives the MNI signal, and an appropriate message will appear in the instance's log. Wait_for_server_os_boot() method has been added to ClientTestBase to check if instance's operating system is completely booted. The _create_server() method has been removed since the change which puts this method to the base test class has been merged. Change-Id: I2313c5d37a7cf87a8d75e37c93aab136cf028ec1
Diffstat (limited to 'novaclient/tests/functional/base.py')
-rw-r--r--novaclient/tests/functional/base.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py
index 16e5f378..45d6c27d 100644
--- a/novaclient/tests/functional/base.py
+++ b/novaclient/tests/functional/base.py
@@ -24,6 +24,9 @@ import novaclient
import novaclient.api_versions
import novaclient.client
+BOOT_IS_COMPLETE = ("login as 'cirros' user. default password: "
+ "'cubswin:)'. use 'sudo' for root.")
+
# The following are simple filter functions that filter our available
# image / flavor list so that they can be used in standard testing.
@@ -202,6 +205,23 @@ class ClientTestBase(testtools.TestCase):
self.fail("Volume %s did not reach status %s after %d s"
% (volume.id, status, timeout))
+ def wait_for_server_os_boot(self, server_id, timeout=60,
+ poll_interval=1):
+ """Wait until instance's operating system is completely booted.
+
+ :param server_id: uuid4 id of given instance
+ :param timeout: timeout in seconds
+ :param poll_interval: poll interval in seconds
+ """
+ start_time = time.time()
+ while time.time() - start_time < timeout:
+ if BOOT_IS_COMPLETE in self.nova('console-log %s ' % server_id):
+ break
+ time.sleep(poll_interval)
+ else:
+ self.fail("Server %s did not boot after %d s"
+ % (server_id, timeout))
+
def wait_for_resource_delete(self, resource, manager,
timeout=60, poll_interval=1):
"""Wait until getting the resource raises NotFound exception.