[gnome-boxes/wip/automated-tests: 16/29] Add system-broker tests
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/automated-tests: 16/29] Add system-broker tests
- Date: Sat, 31 Jan 2015 10:43:30 +0000 (UTC)
commit f38daa4bb1b92074d34468f36e3db4cdad6d0509
Author: Vladimir Benes <vbenes redhat com>
Date: Tue Jan 6 10:10:30 2015 -0500
Add system-broker tests
These tests do have a few prerequsites:
passwordless access to system-broker (see README for more details)
virt-install binary
running libvirtd
When prerequsites are not met tests are skipped (via exit code 77)
Coverage:
* connect to system broker (SB)
* delete/undo machine from SB
* reflect delete/addition in SB
* pause/resume SB box
* force shutdown in SB
* restart persistence
https://bugzilla.gnome.org/review?bug=736288
Makefile.am | 1 +
tests/README | 17 +++++++++
tests/environment.py | 14 +++++++
tests/steps/system-broker.py | 22 +++++++++++
tests/system-broker.feature | 83 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 137 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7212b97..d17a0f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ INSTALLED_TESTS= \
multi-windows.feature \
snapshots.feature \
spice.feature \
+ system-broker.feature \
$(NULL)
INSTALLED_TESTS_TYPE=session-exclusive
-include $(top_srcdir)/git.mk
diff --git a/tests/README b/tests/README
index 8838548..1f6f586 100644
--- a/tests/README
+++ b/tests/README
@@ -33,6 +33,13 @@ Structure
* spice.feature
* connect to spice box
* restart persistence
+ * system-broker.feature
+ * connect to system broker (SB)
+ * delete/undo machine from SB
+ * reflect delete/addition in SB
+ * pause/resume SB box
+ * force shutdown in SB
+ * restart persistence
* Environment file
* everything for setting/cleaning up the environment
* Steps
@@ -46,6 +53,16 @@ Requirements
* behave (python-behave in Fedora)
* dogtail
+* for system-broker test execution
+ * virt-install
+ * passwordless access to virtualization to wheel group
+ * run this as root to create the polkit rule:
+ echo "polkit.addRule(function(action, subject) {
+ if(action.id == \"org.libvirt.unix.manage\" && subject.isInGroup(\"wheel\")) {
+ return polkit.Result.YES;
+ }
+ });" > /etc/polkit-1/rules.d/51-virtmgr.rules
+
Execution
=========
diff --git a/tests/environment.py b/tests/environment.py
index e61bab5..368fe25 100644
--- a/tests/environment.py
+++ b/tests/environment.py
@@ -68,6 +68,13 @@ def before_scenario(context, scenario):
pass
def before_tag(context, tag):
+ if 'system_broker' in tag:
+ if call('pkcheck -a org.libvirt.unix.manage --process $BASHPID', shell=True) != 0 \
+ or not os.path.isfile('/usr/bin/virt-install') \
+ or call('systemctl status libvirtd > /dev/null 2>&1', shell=True) != 0:
+
+ sys.exit(77)
+
if 'help' in tag:
os.system('pkill -9 yelp')
@@ -89,6 +96,13 @@ def after_tag(context, tag):
if 'help' in tag:
os.system('pkill -9 yelp')
+ if 'system_broker' in tag:
+ if tag == 'pause_system_broker_box' or tag == 'resume_system_broker_box':
+ os.system('virsh -q -c qemu:///system start Core-5.3 > /dev/null 2>&1')
+
+ os.system('virsh -q -c qemu:///system destroy Core-5.3 > /dev/null 2>&1')
+ os.system('virsh -q -c qemu:///system undefine Core-5.3 > /dev/null 2>&1')
+
def after_scenario(context, scenario):
"""Teardown for each scenario
Kill gnome-boxes (in order to make this reliable we send sigkill)
diff --git a/tests/steps/system-broker.py b/tests/steps/system-broker.py
new file mode 100644
index 0000000..f32625a
--- /dev/null
+++ b/tests/steps/system-broker.py
@@ -0,0 +1,22 @@
+# -*- coding: UTF-8 -*-
+
+from behave import step
+
+ step(u'Connect to system broker')
+def connect_to_filled_system_broker(context):
+ context.execute_steps(u"""
+ * Wait for "virt-install -q -r 128 --name Core-5.3 --nodisks --cdrom /tmp/Core-5.3.iso --os-type
linux --accelerate --connect qemu:///system --wait 0" end
+ * Wait for "sleep 10" end
+ * Create new box from url "qemu:///system"
+ * Wait for "sleep 1" end
+ * Press "Create"
+ * Save IP for machine "Core-5.3"
+ """)
+
+ step(u'Connect to empty system broker')
+def connect_to_empty_system_broker(context):
+ context.execute_steps(u"""
+ * Create new box from url "qemu:///system"
+ * Wait for "sleep 2" end
+ * Press "Create"
+ """)
diff --git a/tests/system-broker.feature b/tests/system-broker.feature
new file mode 100644
index 0000000..78fa538
--- /dev/null
+++ b/tests/system-broker.feature
@@ -0,0 +1,83 @@
+Feature: System Broker
+
+ Background:
+ * Make sure that gnome-boxes is running
+ * Wait until overview is loaded
+
+ @connect_to_system_broker_machine
+ Scenario: Connect to system broker
+ * Connect to system broker
+ Then Box "Core-5.3" "does" exist
+ Then Go into "Core-5.3" box
+ Then Press "back" in vm
+ Then Box "Core-5.3" "does" exist
+
+ @delete_system_broker_machine
+ Scenario: Delete system broker machine
+ * Connect to system broker
+ * Select "Core-5.3" box
+ * Press "Delete"
+ * Close warning
+ Then Box "Core-5.3" "does not" exist
+ Then "Core-5.3" is not visible with command "virsh -c qemu:///system list"
+
+ @reflect_delete_from_system_broker
+ Scenario: System broker machine deleted from outside
+ * Connect to system broker
+ * Wait for "virsh -c qemu:///system destroy Core-5.3; virsh -c qemu:///system undefine Core-5.3" end
+ Then Box "Core-5.3" "does not" exist
+
+ @reflect_addition_from_system_broker
+ Scenario: System broker machine added from outside
+ * Connect to empty system broker
+ * Wait for "virt-install -r 128 --name Core-5.3 --nodisks --cdrom /tmp/Core-5.3.iso --os-type linux
--accelerate --connect qemu:///system --wait 0" end
+ Then Box "Core-5.3" "does" exist
+ Then Go into "Core-5.3" box
+ Then Press "back" in vm
+ Then Box "Core-5.3" "does" exist
+
+ @undo_delete_system_broker_machine
+ Scenario: Undo system broker machine delete
+ * Connect to system broker
+ * Select "Core-5.3" box
+ * Press "Delete"
+ * Press "Undo"
+ Then Box "Core-5.3" "does" exist
+ Then "Core-5.3" is visible with command "virsh -c qemu:///system list"
+
+ @pause_system_broker_box
+ Scenario: Pause system broker box
+ * Connect to system broker
+ When Ping "Core-5.3"
+ * Select "Core-5.3" box
+ * Press "Pause"
+ * Wait for "sleep 5" end
+ Then Cannot ping "Core-5.3"
+
+ @resume_system_broker_box
+ Scenario: Resume system broker box
+ * Connect to system broker
+ * Select "Core-5.3" box
+ * Press "Pause"
+ * Wait for "sleep 10" end
+ * Go into "Core-5.3" box
+ * Wait for "sleep 10" end
+ Then Ping "Core-5.3"
+ Then Press "back" in vm
+
+ @force_shutdown_system_broker_machine
+ Scenario: Force off system broker box
+ * Connect to system broker
+ * Select "Core-5.3" box
+ * Press "Properties"
+ * Press "Force Shutdown"
+ * Press "Shutdown" in alert
+ Then Box "Core-5.3" "does" exist
+ Then Cannot ping "Core-5.3"
+
+ @system_broker_restart_persistence
+ Scenario: System broker restart persistence
+ * Connect to system broker
+ * Quit Boxes
+ * Start Boxes
+ Then Box "Core-5.3" "does" exist
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]