[gnome-boxes] Add vmdk/qcow2 vm import tests



commit d875fed7c43a17bd331da22fbe95be233d8977c9
Author: Vladimir Benes <vbenes redhat com>
Date:   Tue Jan 6 09:05:46 2015 -0500

    Add vmdk/qcow2 vm import tests
    
    New tests for adding vmdk and qcow2 VM images. These images are the same
     Tiny Core Linux LiveCD but installed and conserved.
    
    Coverage:
     * import local vmdk/qcow2 images
     * restart persistence
    
    https://bugzilla.gnome.org/review?bug=736288

 Makefile.am              |    1 +
 tests/README             |    2 ++
 tests/import-vms.feature |   27 +++++++++++++++++++++++++++
 tests/steps/creation.py  |   20 ++++++++++++++++++++
 tests/steps/general.py   |    2 +-
 5 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1dc3ca6..b161b2f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,6 +76,7 @@ win-tools.iso:
 @BEHAVE_INSTALLED_TESTS_RULE@
 INSTALLED_TESTS=                               \
        general.feature                         \
+       import-vms.feature                      \
        $(NULL)
 INSTALLED_TESTS_TYPE=session-exclusive
 -include $(top_srcdir)/git.mk
diff --git a/tests/README b/tests/README
index a47ca42..7f6f5a6 100644
--- a/tests/README
+++ b/tests/README
@@ -16,6 +16,8 @@ Structure
     * customize machine memory
     * start box
     * search boxes
+  * import.feature
+    * import local qcow2 and vmdk images
 * Environment file
   * everything for setting/cleaning up the environment
 * Steps
diff --git a/tests/import-vms.feature b/tests/import-vms.feature
new file mode 100644
index 0000000..d38750b
--- /dev/null
+++ b/tests/import-vms.feature
@@ -0,0 +1,27 @@
+Feature: Import Images
+
+  Background:
+    * Make sure that gnome-boxes is running
+    * Wait until overview is loaded
+
+  @import_local_qcow2_image
+  Scenario: Import local qcow2 image
+    * Import machine "Core-5" from image "Downloads/Core-5.3.qcow2"
+    Then Box "Core-5" "does" exist
+    Then Ping "Core-5"
+
+  @import_local_vmdk_image
+  Scenario: Import local vmdk image
+    * Import machine "Core-5" from image "Downloads/Core-5.3.vmdk"
+    Then Box "Core-5" "does" exist
+    Then Ping "Core-5"
+
+  @restart_persistence
+  Scenario: Restart persistence
+    * Import machine "Core-5" from image "Downloads/Core-5.3.qcow2"
+    * Import machine "Core-5" from image "Downloads/Core-5.3.vmdk"
+    * Quit Boxes
+    * Start Boxes
+    Then Box "Core-5" "does" exist
+    Then Box "Core-5 2" "does" exist
+
diff --git a/tests/steps/creation.py b/tests/steps/creation.py
index c4db556..5cde6c7 100644
--- a/tests/steps/creation.py
+++ b/tests/steps/creation.py
@@ -19,6 +19,18 @@ def create_machine(context, name):
         * Press "back" in vm
         """ %(name, name))
 
+ step(u'Create new box from file "{location}"')
+def create_new_vm_via_file(context, location):
+    path = location.split('/')
+    context.app.child('New').click()
+    context.app.child('Continue').click()
+    context.app.child('Select a file').click()
+
+    selector = context.app.child('Select a device or ISO file')
+    for item in path:
+        selector.child(item).click()
+    selector.child('Open').click()
+
 @step(u'Create new box from url "{url}"')
 def create_new_vm_via_url(context, url):
     context.app.child('New').click()
@@ -45,6 +57,14 @@ def create_new_vm_from_menu(context, sys_name):
     context.app.child('Continue').click()
     get_showing_node_name(sys_name, context.app).click()
 
+ step(u'Import machine "{name}" from image "{location}"')
+def import_image(context, name, location):
+    context.execute_steps(u"""
+        * Create new box from file "%s"
+        * Press "Create"
+        * Save IP for machine "%s"
+        """ %(location, name))
+
 @step(u'Initiate new box "{name}" installation')
 def create_machine_no_wait(context, name):
     """
diff --git a/tests/steps/general.py b/tests/steps/general.py
index 8d20ceb..771d783 100644
--- a/tests/steps/general.py
+++ b/tests/steps/general.py
@@ -5,7 +5,7 @@ from dogtail.tree import root
 from dogtail.rawinput import typeText, pressKey, keyCombo
 from time import sleep
 from common_steps import wait_until
-from subprocess import call, check_output, Popen
+from subprocess import call, check_output, Popen, CalledProcessError
 
 @step(u'About is shown')
 def about_shown(context):


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