[gnome-boxes] tests: Add "Installation finished check" step



commit 0f981d86802706edb78b7d76f6c4b68198876032
Author: Vladimir Benes <benesv email cz>
Date:   Wed Jun 10 13:28:25 2015 +0200

    tests: Add "Installation finished check" step
    
    Step that asks libvirt every minute if VM state is installed. Step
    fails after specified amount of time, if not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748006

 tests/steps/express-install.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/tests/steps/express-install.py b/tests/steps/express-install.py
index 2b135d5..9124f64 100644
--- a/tests/steps/express-install.py
+++ b/tests/steps/express-install.py
@@ -2,6 +2,7 @@
 
 from __future__ import unicode_literals
 import libvirt
+from time import sleep
 from general import libvirt_domain_get_val, libvirt_domain_get_context
 
 def libvirt_domain_get_install_state(title):
@@ -21,3 +22,16 @@ def libvirt_domain_get_install_state(title):
             return libvirt_domain_get_val(ctx, "/domain/metadata/*/os-state")
 
     return None
+
+ step('Installation of "{machine}" is finished in "{max_time}" minutes')
+def check_finished_installation(context, machine, max_time):
+    minutes = 0
+    state = None
+    while minutes < max_time:
+        state = libvirt_domain_get_install_state(machine)
+        if state == 'installed':
+            break
+        else:
+            sleep(60)
+
+    assert state == 'installed', "%s is not installed but still in %s after %s minutes" %(machine, state, 
max_time)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]