summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-06-17 12:09:45 -0400
committerCole Robinson <crobinso@redhat.com>2016-06-17 12:13:21 -0400
commit81231530e5c80c79d6d9b96c763e03f002497f66 (patch)
tree8211f3fc88a55bc33b174e112f268098d88f159c
parent116fabb37a557363f4c19349fd3ca0135dfb8de1 (diff)
downloadvirt-manager-81231530e5c80c79d6d9b96c763e03f002497f66.tar.gz
tests: Add virt-install --wait test, and tweak the logic a bit
-rw-r--r--tests/clitest.py2
-rwxr-xr-xvirt-install16
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/clitest.py b/tests/clitest.py
index d5563d96..0ecffccd 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -796,7 +796,7 @@ c.add_valid("--file %(NEWIMG1)s --file-size .00001 --nonsparse") # Nonexistent
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")
+c.add_invalid("--noautoconsole --wait 1") # --wait 1 is converted to 1 second if we are in the test suite, so this should actually touch the wait machinery. however in this case it exits with failure
diff --git a/virt-install b/virt-install
index dbceb0c0..6e5495b7 100755
--- a/virt-install
+++ b/virt-install
@@ -19,6 +19,7 @@
import argparse
import logging
+import os
import re
import sys
import time
@@ -687,6 +688,9 @@ def start_install(guest, options):
if options.wait:
wait_on_install = True
wait_time = options.wait * 60
+ if "VIRTINST_TEST_SUITE" in os.environ and wait_time:
+ # Convert wait time to 1 second, for the test suite
+ wait_time = 1
else:
wait_on_install = False
wait_time = -1
@@ -815,11 +819,6 @@ def check_domain(guest, conscb, wait_for_install, wait_time, start_time):
# Wait loop
while True:
- if domain_is_shutdown(guest.domain):
- print_stdout(_("Domain has shutdown. Continuing."))
- dom = guest.domain
- break
-
time_elapsed = (time.time() - start_time)
if not wait_forever and time_elapsed >= wait_time:
print_stdout(
@@ -827,7 +826,12 @@ def check_domain(guest, conscb, wait_for_install, wait_time, start_time):
"Exiting application."))
sys.exit(1)
- time.sleep(2)
+ time.sleep(1)
+
+ if domain_is_shutdown(guest.domain):
+ print_stdout(_("Domain has shutdown. Continuing."))
+ dom = guest.domain
+ break
########################