コード例 #1
0
ファイル: newvm.py プロジェクト: panenlei/virt-manager
    def testNewVMURL(self):
        """
        New VM with URL and distro detection, plus having fun with
        the storage browser and network selection.
        """
        self.app.uri = tests.utils.uri_kvm
        newvm = self._open_create_wizard()

        uiutils.find_fuzzy(newvm, "Network Install", "radio").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        uiutils.find_pattern(
            newvm, None, "text",
            "URL").text = ("http://vault.centos.org/5.5/os/x86_64/")

        version = uiutils.find_pattern(newvm, "install-os-version-label")
        time.sleep(1)
        uiutils.check_in_loop(lambda: "Detecting" not in version.text)
        self.assertEqual(version.text, "Red Hat Enterprise Linux 5.5")

        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()
        time.sleep(.5)

        progress = uiutils.find_fuzzy(self.app.root,
                                      "Creating Virtual Machine", "frame")
        uiutils.check_in_loop(lambda: not progress.showing)
        time.sleep(.5)

        uiutils.find_fuzzy(self.app.root, "rhel5.5 on", "frame")
        self.assertFalse(newvm.showing)
        self.app.quit()
コード例 #2
0
ファイル: newvm.py プロジェクト: CyberShadow/virt-manager
    def testNewVMPXEDefault(self):
        """
        Click through the New VM wizard with default values + PXE, then
        delete the VM
        """
        newvm = self._open_create_wizard()

        # Create default PXE VM
        uiutils.find_fuzzy(newvm, "PXE", "radio").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()

        # Delete it from the VM window
        vmwindow = uiutils.find_fuzzy(self.app.root, "generic on", "frame")
        uiutils.find_pattern(vmwindow, "Virtual Machine", "menu").click()
        uiutils.find_pattern(vmwindow, "Delete", "menu item").click()

        delete = uiutils.find_fuzzy(self.app.root, "Delete", "frame")
        uiutils.find_fuzzy(delete, "Delete", "button").click()
        alert = uiutils.find_pattern(self.app.root, "Warning", "alert")
        uiutils.find_fuzzy(alert, "Yes", "push button").click()
        time.sleep(1)

        # Verify delete dialog and VM dialog are now gone
        self.assertFalse(vmwindow.showing)

        self.app.quit()
コード例 #3
0
ファイル: cli.py プロジェクト: niklaushirt/virt-manager
    def testShowNewVM(self):
        self.app.open(extra_opts=["--show-domain-creator"])
        time.sleep(.5)

        uiutils.find_pattern(self.app.root, "Virtual Machine Manager", "frame")
        uiutils.find_pattern(self.app.root, "New VM", "frame")
        self.app.quit()
コード例 #4
0
ファイル: newvm.py プロジェクト: CyberShadow/virt-manager
    def testNewVMURL(self):
        """
        New VM with URL and distro detection, plus having fun with
        the storage browser and network selection.
        """
        self.app.uri = tests.utils.uri_kvm
        newvm = self._open_create_wizard()

        uiutils.find_fuzzy(newvm, "Network Install", "radio").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        uiutils.find_pattern(newvm, None, "text", "URL").text = (
            "http://vault.centos.org/5.5/os/x86_64/")

        version = uiutils.find_pattern(newvm, "install-os-version-label")
        time.sleep(1)
        uiutils.check_in_loop(lambda: "Detecting" not in version.text)
        self.assertEquals(version.text, "Red Hat Enterprise Linux 5.5")

        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()
        time.sleep(.5)

        progress = uiutils.find_fuzzy(self.app.root,
            "Creating Virtual Machine", "frame")
        uiutils.check_in_loop(lambda: not progress.showing)
        time.sleep(.5)

        uiutils.find_fuzzy(self.app.root, "rhel5.5 on", "frame")
        self.assertFalse(newvm.showing)
        self.app.quit()
コード例 #5
0
ファイル: newvm.py プロジェクト: panenlei/virt-manager
    def testNewVMPXEDefault(self):
        """
        Click through the New VM wizard with default values + PXE, then
        delete the VM
        """
        newvm = self._open_create_wizard()

        # Create default PXE VM
        uiutils.find_fuzzy(newvm, "PXE", "radio").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()

        # Delete it from the VM window
        vmwindow = uiutils.find_fuzzy(self.app.root, "generic on", "frame")
        uiutils.find_pattern(vmwindow, "Virtual Machine", "menu").click()
        uiutils.find_pattern(vmwindow, "Delete", "menu item").click()

        delete = uiutils.find_fuzzy(self.app.root, "Delete", "frame")
        uiutils.find_fuzzy(delete, "Delete", "button").click()
        alert = uiutils.find_pattern(self.app.root, "Warning", "alert")
        uiutils.find_fuzzy(alert, "Yes", "push button").click()
        time.sleep(1)

        # Verify delete dialog and VM dialog are now gone
        self.assertFalse(vmwindow.showing)

        self.app.quit()
コード例 #6
0
ファイル: cli.py プロジェクト: CyberShadow/virt-manager
    def testShowNewVM(self):
        self.app.open(extra_opts=["--show-domain-creator"])
        time.sleep(.5)

        uiutils.find_pattern(self.app.root,
            "Virtual Machine Manager", "frame")
        uiutils.find_pattern(self.app.root, "New VM", "frame")
        self.app.quit()
コード例 #7
0
    def testClone(self):
        """
        Clone test-clone, which is meant to hit many clone code paths
        """
        win = self._open_window("test-clone")
        uiutils.find_pattern(win, "Clone", "push button").click()
        time.sleep(1)

        # Verify the new VM popped up
        uiutils.find_pattern(self.app.root, "test-clone1", "table cell")
コード例 #8
0
    def testDetailsRenameNVRAM(self):
        """
        Rename a VM that will trigger the nvram behavior
        """
        origname = "test-many-devices"
        # Shutdown the VM
        uiutils.find_fuzzy(self.app.root, origname, "table cell").click()
        uiutils.find_pattern(self.app.root, "Shut Down", "push button").click()

        self._testRename(origname, "test-new-name")
コード例 #9
0
    def testCloneSimple(self):
        """
        Clone test-clone-simple
        """
        win = self._open_window("test-clone-simple")
        uiutils.find_pattern(win, "Clone", "push button").click()
        time.sleep(1)

        # Verify the new VM popped up
        uiutils.find_pattern(self.app.root, "test-clone-simple-clone",
                             "table cell")
コード例 #10
0
    def testFullClone(self):
        """
        Clone test-full-clone, which should error due to lack of space
        """
        win = self._open_window("test-clone-full")
        uiutils.find_pattern(win, "Clone", "push button").click()
        time.sleep(1)

        # Verify error dialog popped up
        uiutils.find_pattern(self.app.root,
                             ".*There is not enough free space.*", "label")
コード例 #11
0
ファイル: newvm.py プロジェクト: CyberShadow/virt-manager
    def testNewArmKernel(self):
        """
        New arm VM that requires kernel/initrd/dtb
        """
        self.app.uri = tests.utils.uri_kvm_armv7l
        newvm = self._open_create_wizard()

        uiutils.find_fuzzy(newvm, "Architecture options", "toggle").click()
        uiutils.find_fuzzy(newvm, None, "combo", "Virt Type").click()
        KVM = uiutils.find_fuzzy(newvm, "KVM", "menu item")
        TCG = uiutils.find_fuzzy(newvm, "TCG", "menu item")
        self.assertTrue(KVM.focused)
        self.assertTrue(TCG.showing)
        uiutils.find_fuzzy(newvm, None, "combo", "Virt Type").click()

        # Validate some initial defaults
        self.assertFalse(
            uiutils.find_fuzzy(newvm, "PXE", "radio").sensitive)
        uiutils.find_fuzzy(newvm, "vexpress-a15", "menu item")
        uiutils.find_pattern(newvm, "virt", "menu item")
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Set the import media details
        uiutils.find_fuzzy(newvm, None,
            "text", "existing storage").text = "/dev/default-pool/default-vol"
        uiutils.find_fuzzy(newvm, None,
            "text", "Kernel path").text = "/tmp/kernel"
        uiutils.find_fuzzy(newvm, None,
            "text", "Initrd").text = "/tmp/initrd"
        uiutils.find_fuzzy(newvm, None,
            "text", "DTB").text = "/tmp/dtb"
        uiutils.find_fuzzy(newvm, None,
            "text", "Kernel args").text = "console=ttyS0"
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Disk collision box pops up, hit ok
        alert = uiutils.find_pattern(self.app.root, "Warning", "alert")
        uiutils.find_fuzzy(alert, "Yes", "push button").click()

        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()

        time.sleep(1)
        uiutils.find_fuzzy(self.app.root, "generic on", "frame")
        self.assertFalse(newvm.showing)
        self.app.quit()
コード例 #12
0
    def testNewArmKernel(self):
        """
        New arm VM that requires kernel/initrd/dtb
        """
        self.app.uri = tests.utils.uri_kvm_armv7l
        newvm = self._open_create_wizard()

        uiutils.find_fuzzy(newvm, "Architecture options", "toggle").click()
        uiutils.find_fuzzy(newvm, None, "combo", "Virt Type").click()
        KVM = uiutils.find_fuzzy(newvm, "KVM", "menu item")
        TCG = uiutils.find_fuzzy(newvm, "TCG", "menu item")
        self.assertTrue(KVM.focused)
        self.assertTrue(TCG.showing)
        uiutils.find_fuzzy(newvm, None, "combo", "Virt Type").click()

        # Validate some initial defaults
        self.assertFalse(
            uiutils.find_fuzzy(newvm, "PXE", "radio").sensitive)
        uiutils.find_fuzzy(newvm, "vexpress-a15", "menu item")
        uiutils.find_pattern(newvm, "virt", "menu item")
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Set the import media details
        uiutils.find_fuzzy(newvm, None,
            "text", "existing storage").text = "/dev/default-pool/default-vol"
        uiutils.find_fuzzy(newvm, None,
            "text", "Kernel path").text = "/tmp/kernel"
        uiutils.find_fuzzy(newvm, None,
            "text", "Initrd").text = "/tmp/initrd"
        uiutils.find_fuzzy(newvm, None,
            "text", "DTB").text = "/tmp/dtb"
        uiutils.find_fuzzy(newvm, None,
            "text", "Kernel args").text = "console=ttyS0"
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Disk collision box pops up, hit ok
        alert = uiutils.find_pattern(self.app.root, "Warning", "alert")
        uiutils.find_fuzzy(alert, "Yes", "push button").click()

        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()

        time.sleep(1)
        uiutils.find_fuzzy(self.app.root, "generic on", "frame")
        self.assertFalse(newvm.showing)
        self.app.quit()
コード例 #13
0
ファイル: cli.py プロジェクト: shundhammer/virt-manager
    def testShowHost(self):
        self.app.open(extra_opts=["--show-host-summary"])
        time.sleep(.5)

        win = uiutils.find_pattern(self.app.root,
            "test testdriver.xml Connection Details", "frame")
        self.assertEquals(
            uiutils.find_fuzzy(win, None, "text", "Name:").text,
            "test testdriver.xml")
        self.app.quit()
コード例 #14
0
ファイル: details.py プロジェクト: panenlei/virt-manager
    def _testRename(self, origname, newname):
        win = self._open_details_window(origname)

        # Ensure the Overview page is the first selected
        uiutils.find_pattern(win, "Hypervisor Details", "label")
        uiutils.find_pattern(win, "Overview", "table cell").click()

        uiutils.find_pattern(win, None, "text", "Name:").text = newname
        uiutils.find_pattern(win, "config-apply", "push button").click()

        # Confirm lists were updated
        uiutils.find_pattern(self.app.root, "%s on" % newname, "frame")
        uiutils.find_fuzzy(self.app.root, newname, "table cell")

        # Ensure old VM entry is gone
        try:
            uiutils.find_fuzzy(self.app.root,
                               origname,
                               "table cell",
                               retry=False)
            raise AssertionError("Still found manager row for %s" % origname)
        except dogtail.tree.SearchError:
            # We want this
            pass
コード例 #15
0
    def testDetailsHardwareSmokeTest(self):
        """
        Open the VM with all the crazy hardware and just verify that each
        HW panel shows itself without raising any error.
        """
        win = self._open_details_window()

        # Ensure the Overview page is the first selected
        uiutils.find_pattern(win, "Hypervisor Details", "label")
        uiutils.find_pattern(win, "Overview", "table cell").click()

        # After we hit this number of down presses, start checking for
        # widget focus to determine if we hit the end of the list. We
        # don't check for widget focus unconditionally because it's slow.
        # The seemingly arbitrary number here is because it matches the
        # number of devices in test-many-devices at the time of this writing.
        check_after = 88

        focused = None
        old_focused = None
        count = 0
        while True:
            count += 1
            dogtail.rawinput.pressKey("Down")

            if not win.getState().contains(pyatspi.STATE_ACTIVE):
                # Should mean an error dialog popped up
                uiutils.find_pattern(self.app.root, "Error", "alert")
                raise AssertionError(
                    "One of the hardware pages raised an error")

            if count < check_after:
                time.sleep(.1)
                continue

            # pylint: disable=not-an-iterable
            old_focused = focused
            focused = uiutils.focused_nodes(win)
            if old_focused is None:
                continue

            overlap = [w for w in old_focused if w in focused]
            if len(overlap) == len(old_focused):
                # Focus didn't change, meaning we hit the end of the HW list,
                # so our testing is done
                break

        self.app.quit()
        return
コード例 #16
0
ファイル: newvm.py プロジェクト: panenlei/virt-manager
 def _open_create_wizard(self):
     uiutils.find_pattern(self.app.root, "New", "push button").click()
     return uiutils.find_pattern(self.app.root, "New VM", "frame")
コード例 #17
0
ファイル: newvm.py プロジェクト: CyberShadow/virt-manager
 def _open_create_wizard(self):
     uiutils.find_pattern(self.app.root, "New", "push button").click()
     return uiutils.find_pattern(self.app.root, "New VM", "frame")
コード例 #18
0
 def _open_details_window(self, vmname="test-many-devices"):
     uiutils.find_fuzzy(
         self.app.root, vmname, "table cell").doubleClick()
     win = uiutils.find_pattern(self.app.root, "%s on" % vmname, "frame")
     uiutils.find_pattern(win, "Details", "radio button").click()
     return win
コード例 #19
0
ファイル: newvm.py プロジェクト: panenlei/virt-manager
    def testNewVMCDROM(self):
        """
        Create a new CDROM VM, choosing distro win8, and do some basic
        'Customize before install' before exiting
        """
        newvm = self._open_create_wizard()

        uiutils.find_fuzzy(newvm, "Local install media", "radio").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Select a fake iso
        uiutils.find_fuzzy(newvm, "Use ISO", "radio").click()
        uiutils.find_fuzzy(newvm, "install-iso-browse", "button").click()
        browser = uiutils.find_fuzzy(self.app.root, "Choose Storage", "frame")
        uiutils.find_fuzzy(browser, "default-pool", "table cell").click()
        uiutils.find_fuzzy(browser, "iso-vol", "table cell").click()
        uiutils.find_fuzzy(browser, "Choose Volume", "button").click()
        time.sleep(1)

        self.assertFalse(browser.showing)
        self.assertEqual(
            uiutils.find_fuzzy(newvm, "os-version-label", "label").text,
            "Unknown")

        # Change distro to win8
        uiutils.find_fuzzy(newvm, "Automatically detect", "check").click()
        version = uiutils.find_fuzzy(newvm, "install-os-version-entry", "text")
        self.assertEqual(version.text, "Generic")

        ostype = uiutils.find_fuzzy(newvm, "install-os-type", "combo")
        ostype.click()
        uiutils.find_fuzzy(ostype, "Show all", "menu item").click()
        uiutils.find_fuzzy(newvm, "install-os-type", "combo").click()
        uiutils.find_fuzzy(newvm, "Windows", "menu item").click()
        uiutils.find_fuzzy(newvm, "install-os-version-entry",
                           "text").typeText("Microsoft Windows 8")
        uiutils.find_fuzzy(newvm, "install-os-version-entry", "text").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Verify that CPU values are non-default
        cpus = uiutils.find_pattern(newvm, "cpus", "spin button")
        uiutils.check_in_loop(lambda: int(cpus.text) > 1, timeout=5)
        uiutils.find_fuzzy(newvm, "Forward", "button").click()
        uiutils.find_fuzzy(newvm, "Forward", "button").click()

        # Select customize wizard
        uiutils.find_fuzzy(newvm, "Customize", "check").click()
        uiutils.find_fuzzy(newvm, "Finish", "button").click()

        # Change to 'copy host CPU'
        vmwindow = uiutils.find_fuzzy(self.app.root, "win8 on", "frame")
        uiutils.find_fuzzy(vmwindow, "CPUs", "table cell").click()
        uiutils.find_fuzzy(vmwindow, "Copy host", "check").click()
        uiutils.find_fuzzy(vmwindow, "config-apply").click()

        # Start the install, close via the VM window
        uiutils.find_fuzzy(vmwindow, "Begin Installation", "button").click()
        time.sleep(1)
        vmwindow = uiutils.find_fuzzy(self.app.root, "win8 on", "frame")
        self.assertFalse(newvm.showing)
        uiutils.find_fuzzy(vmwindow, "File", "menu").click()
        uiutils.find_fuzzy(vmwindow, "Quit", "menu item").click()
        time.sleep(.5)
コード例 #20
0
    def testCloneTweaks(self):
        """
        Clone test-clone-simple, but tweak bits in the clone UI
        """
        win = self._open_window("test-clone-simple")
        uiutils.find_fuzzy(win, None, "text", "Name").text = "test-new-vm"

        uiutils.find_pattern(win, "Details...", "push button").click()
        macwin = uiutils.find_pattern(self.app.root, "Change MAC address",
                                      "dialog")
        uiutils.find_pattern(macwin, None, "text",
                             "New MAC:").text = "00:16:3e:cc:cf:05"
        uiutils.find_pattern(macwin, "OK", "push button").click()

        uiutils.find_fuzzy(win, "Clone this disk.*", "combo box").click()
        uiutils.find_fuzzy(win, "Details...", "menu item").click()
        stgwin = uiutils.find_pattern(self.app.root, "Change storage path",
                                      "dialog")
        uiutils.find_pattern(
            stgwin, None, "text",
            "New Path:").text = "/dev/default-pool/my-new-path"
        uiutils.find_pattern(stgwin, "OK", "push button").click()

        uiutils.find_pattern(win, "Clone", "push button").click()
        time.sleep(1)

        # Verify the new VM popped up
        uiutils.find_pattern(self.app.root, "test-new-vm", "table cell")
コード例 #21
0
 def _open_window(self, vmname):
     # Launch wizard via right click menu
     uiutils.find_fuzzy(self.app.root, vmname, "table cell").click(button=3)
     uiutils.find_pattern(self.app.root, "Clone...", "menu item").click()
     return uiutils.find_pattern(self.app.root, "Clone Virtual Machine",
                                 "frame")