summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-06-17 08:57:30 -0400
committerCole Robinson <crobinso@redhat.com>2016-06-17 12:13:21 -0400
commit0e8d4007cfab178f6370b4d78c11e9ead865d077 (patch)
tree2b50a5809b790e27287892d030f3c9defcbee00a
parent59edd87e9ffcfba96d33f2824d48e6f00d622441 (diff)
downloadvirt-manager-0e8d4007cfab178f6370b4d78c11e9ead865d077.tar.gz
tests: Add some virt-install autoconsole tests
-rw-r--r--tests/clitest.py4
-rw-r--r--virtinst/cli.py12
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/clitest.py b/tests/clitest.py
index 43373e8f..d5563d96 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -793,6 +793,10 @@ c.add_valid("--file %(EXISTIMG1)s") # Existing file, no opts
c.add_valid("--file %(EXISTIMG1)s --file %(EXISTIMG1)s") # Multiple existing files
c.add_valid("--file %(NEWIMG1)s --file-size .00001 --nonsparse") # Nonexistent file
+c = vinst.add_category("console-tests", "--pxe --nodisks")
+c.add_valid("--nographics") # mock virsh console waiting
+c.add_valid("--graphics vnc --noreboot") # mock virt-viewer waiting, with noreboot magic
+c.add_valid("--nographics --wait 1")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index cd1f18f7..432640b1 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -410,8 +410,14 @@ def validate_disk(dev, warn_overwrite=False):
check_path_search(dev)
-def _run_console(args):
+def _run_console(guest, args):
logging.debug("Running: %s", " ".join(args))
+ if "VIRTINST_TEST_SUITE" in os.environ:
+ # Add this destroy() in here to trigger more virt-install code
+ # for the test suite
+ guest.domain.destroy()
+ return None
+
child = os.fork()
if child:
return child
@@ -432,7 +438,7 @@ def _gfx_console(guest):
logging.debug("Launching virt-viewer for graphics type '%s'",
guest.get_devices("graphics")[0].type)
- return _run_console(args)
+ return _run_console(guest, args)
def _txt_console(guest):
@@ -441,7 +447,7 @@ def _txt_console(guest):
"console", guest.name]
logging.debug("Connecting to text console")
- return _run_console(args)
+ return _run_console(guest, args)
def connect_console(guest, consolecb, wait):