Esempio n. 1
0
    def testMediaHotplug(self):
        """
        Test in the case of a running VM
        """
        win = self._open_details_window()
        hw = win.find("hw-list")
        entry = win.find("media-entry")
        appl = win.find("config-apply")

        # CDROM + physical
        hw.find("IDE CDROM 1", "table cell").click()
        self.assertTrue(not entry.text)
        entry.text = "/dev/sr0"
        appl.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("changes will take effect", "label")
        alert.find("OK", "push button").click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        self.assertTrue(not entry.text)

        # Shutdown the VM, verify change shows up
        win.find("Shut Down", "push button").click()
        run = win.find("Run", "push button")
        uiutils.check_in_loop(lambda: run.sensitive)
        self.assertTrue(entry.text == "Fedora12_media (/dev/sr0)")
Esempio n. 2
0
    def testAddCephDisk(self):
        """
        Add a disk with a ceph volume, ensure it maps correctly
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Select ceph volume for disk
        tab = self._select_hw(addhw, "Storage", "storage-tab")
        tab.find_fuzzy("Select or create", "radio").click()
        tab.find("storage-browse", "push button").click()
        browse = self.app.root.find("Choose Storage Volume", "frame")
        browse.find_fuzzy("rbd-ceph", "table cell").bring_on_screen().click()
        browse.find_fuzzy("some-rbd-vol", "table cell").click()
        browse.find("Choose Volume", "push button").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Check disk details, make sure it correctly selected volume
        details.find("IDE Disk 2", "table cell").click()
        tab = details.find("disk-tab")
        uiutils.check_in_loop(lambda: tab.showing)
        disk_path = tab.find("disk-source-path")
        self.assertTrue("rbd://" in disk_path.text)
Esempio n. 3
0
    def _testVMLifecycle(self):
        """
        Basic VM lifecycle test, shared between standard and --test-no-events
        testing
        """
        manager = self.app.topwin
        shutdown = manager.find("Shut Down", "push button")
        pause = manager.find("Pause", "toggle button")
        run = manager.find("Run", "push button")
        force = manager.find("Force Off", "menu item")
        smenu = manager.find("Menu", "toggle button")
        save = manager.find("Save", "menu item")

        c = manager.find("test-many-devices", "table cell")
        c.click()
        smenu.click()
        force.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find("Are you sure you want", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: run.sensitive, timeout=5)

        run.click()
        uiutils.check_in_loop(lambda: not run.sensitive, timeout=5)
        pause.click()
        uiutils.check_in_loop(lambda: pause.checked, timeout=5)
        smenu.click()
        save.click()
        uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
        self.assertTrue("Saved" in c.text)
        run.click()
        uiutils.check_in_loop(lambda: shutdown.sensitive, timeout=5)
Esempio n. 4
0
    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()
Esempio n. 5
0
    def testAddCornerCases(self):
        """
        Could random addhardware related tests
        """
        details = self._open_details_window("test-many-devices")
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Test cancel
        addhw.find("Cancel", "push button").click()

        # Test live adding, error dialog, click no
        self._open_addhw_window(details)
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find(
                "This device could not be attached to the running machine",
                "label")
        alert.find("Details", "toggle button").click_expander()
        alert.find("No", "push button").click()
        uiutils.check_in_loop(lambda: details.active)

        self._open_addhw_window(details)
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find(
                "This device could not be attached to the running machine",
                "label")
        alert.find("Details", "toggle button").click_expander()
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: alert.dead)
Esempio n. 6
0
 def _select_hw(self, win, hwname, tabname):
     c = win.find(hwname, "table cell")
     if not c.onscreen:
         hwlist = win.find("hw-list")
         hwlist.click()
         while not c.onscreen:
             self.pressKey("Down")
     c.click()
     tab = win.find(tabname, None)
     uiutils.check_in_loop(lambda: tab.showing)
     return tab
Esempio n. 7
0
    def testAbout(self):
        self.app.root.find("Help", "menu").click()
        self.app.root.find("About", "menu item").click()
        win = self.app.root.find_fuzzy("About", "dialog")
        l = win.find_fuzzy("Copyright", "label")

        curyear = datetime.datetime.today().strftime("%Y")
        if curyear not in l.text:
            print("Current year=%s not in about.ui dialog!" % curyear)

        win.keyCombo("<ESC>")
        uiutils.check_in_loop(lambda: win.visible is False)
Esempio n. 8
0
    def testDetailsRenameNVRAM(self):
        """
        Rename a VM that will trigger the nvram behavior
        """
        origname = "test-many-devices"
        # Shutdown the VM
        self.app.root.find_fuzzy(origname, "table cell").click()
        b = self.app.root.find("Shut Down", "push button")
        b.click()
        # This insures the VM finished shutting down
        uiutils.check_in_loop(lambda: b.sensitive is False)

        self._testRename(origname, "test-new-name")
Esempio n. 9
0
    def testAddChars(self):
        """
        Add a bunch of char devices
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add console device
        tab = self._select_hw(addhw, "Console", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("Pseudo TTY", "menu item").click()
        tab.find("Type:", "combo box").click()
        tab.find_fuzzy("Hypervisor default", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add serial+file
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Serial", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("Output to a file", "menu item").click()
        tab.find("Path:", "text").text = "/tmp/foo.log"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add udp serial
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Serial", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("UDP", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add parallel+device
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Parallel", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("Physical host character", "menu item").click()
        tab.find("Path:", "text").text = "/dev/parallel0"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add spicevmc channel
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Channel", "char-tab")
        # Ensures that this is selected by default
        tab.find("com.redhat.spice.0", "combo box")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 10
0
    def testShowRemoteConnect(self):
        """
        Test the remote app dbus connection
        """
        self.app.open()
        newapp = uiutils.VMMDogtailApp("test:///default")
        newapp.open()
        uiutils.check_in_loop(lambda: not newapp.is_running())
        import dogtail.tree
        vapps = [
            a for a in dogtail.tree.root.applications()
            if a.name == "virt-manager"
        ]
        self.assertEqual(len(vapps), 1)

        self.app.topwin.find("test default", "table cell")
Esempio n. 11
0
    def _testRename(self, origname, newname):
        win = self._open_details_window(origname)

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

        oldcell = self.app.root.find_fuzzy(origname, "table cell")
        win.find("Name:", "text").text = newname
        win.find("config-apply", "push button").click()

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

        # Make sure the old entry is gone
        uiutils.check_in_loop(lambda: origname not in oldcell.name)
Esempio n. 12
0
    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
        newvm.find_fuzzy("PXE", "radio").click()
        self.forward(newvm)
        osentry = newvm.find("oslist-entry")
        uiutils.check_in_loop(lambda: not osentry.text)

        # Make sure we throw an error if no OS selected
        self.forward(newvm, check=False)
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find("You must select", "label")
        alert.find("OK", "push button").click()

        # Test activating the osentry to grab the popover selection
        osentry.click()
        osentry.typeText("generic")
        newvm.find("oslist-popover")
        osentry.click()
        self.pressKey("Enter")
        uiutils.check_in_loop(lambda: osentry.text == "Generic default")

        # Verify back+forward still keeps Generic selected
        newvm.find_fuzzy("Back", "button").click()
        self.sleep(.2)
        self.forward(newvm)
        self.sleep(.2)
        uiutils.check_in_loop(lambda: "Generic" in osentry.text)

        # The sleeps shouldn't be required, but this test continues to be
        # flakey, so this is an attempt to fix it.
        self.forward(newvm)
        self.sleep(.5)
        self.forward(newvm)
        self.sleep(.5)
        self.forward(newvm)
        self.sleep(.5)
        newvm.find_fuzzy("Finish", "button").click()

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

        delete = self.app.root.find_fuzzy("Delete", "frame")
        delete.find_fuzzy("Delete", "button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Yes", "push button").click()

        # Verify delete dialog and VM dialog are now gone
        uiutils.check_in_loop(lambda: vmwindow.showing is False)
Esempio n. 13
0
    def _testRename(self, origname, newname):
        win = self._open_details_window(origname)

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

        oldcell = self.app.root.find_fuzzy(origname, "table cell")
        win.find("Name:", "text").text = newname
        win.find("config-apply", "push button").click()

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

        # Make sure the old entry is gone
        uiutils.check_in_loop(lambda: origname not in oldcell.name)
Esempio n. 14
0
    def testPrefs(self):
        self.app.root.find("Edit", "menu").click()
        self.app.root.find("Preferences", "menu item").click()

        win = self.app.root.find_fuzzy("Preferences", "frame")

        win.find_fuzzy("Enable system tray", "check").click()

        win.find("Polling", "page tab").click()
        win.find_fuzzy(None, "check box",
                           labeller_text="Poll CPU").click()

        win.find("New VM", "page tab").click()
        win.find("prefs-add-spice-usbredir",
                             "combo box").click()
        win.find("No", "menu item").click()

        win.find("Console", "page tab").click()
        win.find("Change...", "push button").click()
        keyframe = self.app.root.find_fuzzy("Configure grab", "dialog")

        # On certain environments pressing "Alt_L" and clicking a window starts
        # window drag operation. Work around by pushing both Control and Alt.
        self.holdKey("Control_L")
        self.holdKey("Alt_L")
        self.holdKey("Z")
        try:
            keyframe.find_fuzzy("OK", "push button").click()
        finally:
            self.releaseKey("Z")
            self.releaseKey("Alt_L")
            self.releaseKey("Control_L")

        win.find("Feedback", "page tab").click()
        win.find_fuzzy(None, "check box",
                           labeller_text="Force Poweroff").click()

        win.find("General", "page tab").click()
        win.find_fuzzy("Enable system tray", "check").click()

        win.find_fuzzy("Close", "push button").click()
        uiutils.check_in_loop(lambda: win.visible is False)
Esempio n. 15
0
    def testCreateVol(self):
        hostwin = self._open_host_window("Storage")
        poolcell = hostwin.find("default-pool", "table cell")
        poolcell.click()
        win = self._open_create_win(hostwin)

        # Create a default qcow2 volume
        finish = win.find("Finish", "push button")
        name = win.find("Name:", "text")
        self.assertEqual(name.text, "vol")
        newname = "a-newvol"
        name.text = newname
        win.find("Max Capacity:", "spin button").text = "10.5"
        finish.click()

        # Delete it
        vollist = hostwin.find("vol-list", "table")
        volcell = vollist.find(newname + ".qcow2")
        volcell.click()
        hostwin.find("vol-refresh", "push button").click()
        hostwin.find("vol-delete", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("permanently delete the volume", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: volcell.dead)

        # Create a raw volume too
        win = self._open_create_win(hostwin)
        newname = "a-newvol.raw"
        name.text = newname
        combo = win.find("Format:", "combo box")
        combo.click_combo_entry()
        combo.find("raw", "menu item").click()
        win.find("Allocation:", "spin button").text = "0.5"
        finish.click()
        vollist.find(newname)

        # Ensure host window closes fine
        hostwin.keyCombo("<ctrl>w")
        uiutils.check_in_loop(
            lambda: not hostwin.showing and not hostwin.active)
Esempio n. 16
0
    def _checkPassword(self):
        """
        Shared logic for password handling
        """
        win = self.app.topwin
        con = win.find("console-gfx-viewport")
        self.assertTrue(not con.showing)
        passwd = win.find("Password:"******"password text")
        uiutils.check_in_loop(lambda: passwd.showing)

        # Check wrong password handling
        passwd.typeText("xx")
        win.find("Login", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Viewer authentication error", "label")
        alert.find("OK", "push button").click()

        # Check proper password
        passwd.typeText("goodp")
        win.find("Login", "push button").click()
        uiutils.check_in_loop(lambda: con.showing)
Esempio n. 17
0
    def _checkPassword(self):
        """
        Shared logic for password handling
        """
        win = self.app.topwin
        con = win.find("console-gfx-viewport")
        self.assertTrue(not con.showing)
        passwd = win.find("Password:"******"password text")
        uiutils.check_in_loop(lambda: passwd.showing)

        # Check wrong password handling
        passwd.typeText("xx")
        win.find("Login", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Viewer authentication error", "label")
        alert.find("OK", "push button").click()

        # Check proper password
        passwd.typeText("goodp")
        win.find("Login", "push button").click()
        uiutils.check_in_loop(lambda: con.showing)
Esempio n. 18
0
    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()

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

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

        version = newvm.find("install-os-version-label")
        uiutils.check_in_loop(lambda: "Detecting" in version.text)
        uiutils.check_in_loop(
            lambda: version.text == "Red Hat Enterprise Linux 5.5", timeout=10)

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

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

        self.app.root.find_fuzzy("rhel5.5 on", "frame")
        self.assertFalse(newvm.showing)
Esempio n. 19
0
    def testCreateNetXMLEditor(self):
        self.app.open(xmleditor_enabled=True)
        hostwin = self._open_host_window("Virtual Networks")
        win = self._open_create_win(hostwin)
        name = win.find("Name:", "text")
        finish = win.find("Finish", "push button")

        # Create a new obj with XML edited name, verify it worked
        tmpname = "objtmpname"
        newname = "froofroo"
        name.text = tmpname
        win.find("XML", "page tab").click()
        xmleditor = win.find("XML editor")
        xmleditor.text = xmleditor.text.replace(">%s<" % tmpname,
                                                ">%s<" % newname)
        finish.click()
        uiutils.check_in_loop(lambda: hostwin.active)
        cell = hostwin.find(newname, "table cell")
        cell.click()

        # Do standard xmleditor tests
        win = self._open_create_win(hostwin)
        self._test_xmleditor_interactions(win, finish)
        win.find("Cancel", "push button").click()
        uiutils.check_in_loop(lambda: not win.visible)

        # Ensure host window closes fine
        hostwin.click()
        hostwin.keyCombo("<ctrl>w")
        uiutils.check_in_loop(
            lambda: not hostwin.showing and not hostwin.active)
Esempio n. 20
0
    def _testLiveHotplug(self, fname):
        win = self.app.topwin
        win.find("Details", "radio button").click()

        # Add a scsi disk, importing the passed path
        win.find("add-hardware", "push button").click()
        addhw = self.app.root.find("Add New Virtual Hardware", "frame")
        addhw.find("Storage", "table cell").click()
        tab = addhw.find("storage-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        tab.find("Select or create", "radio button").click()
        tab.find("storage-entry").text = fname
        tab.find("Bus type:", "combo box").click()
        tab.find("SCSI", "menu item").click()
        addhw.find("Finish", "push button").click()

        # Hot unplug the disk
        win.find("SCSI Disk 1", "table cell").click()
        tab = win.find("disk-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        self.assertTrue(tab.find("Storage format:", "text").text == "qcow2")
        win.find("config-remove").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Are you sure you want to remove", "label")
        alert.find("Yes", "push button").click()

        # Change CDROM
        win.find("IDE CDROM 1", "table cell").click()
        tab = win.find("disk-tab", None)
        entry = win.find("media-entry")
        appl = win.find("config-apply")
        uiutils.check_in_loop(lambda: tab.showing)
        entry.text = fname
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        self.assertTrue(entry.text == fname)
        entry.click_secondary_icon()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        self.assertTrue(not entry.text)
Esempio n. 21
0
    def _testLiveHotplug(self, fname):
        win = self.app.topwin
        win.find("Details", "radio button").click()

        # Add a scsi disk, importing the passed path
        win.find("add-hardware", "push button").click()
        addhw = self.app.root.find("Add New Virtual Hardware", "frame")
        addhw.find("Storage", "table cell").click()
        tab = addhw.find("storage-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        tab.find("Select or create", "radio button").click()
        tab.find("storage-entry").text = fname
        tab.find("Bus type:", "combo box").click()
        tab.find("SCSI", "menu item").click()
        addhw.find("Finish", "push button").click()

        # Hot unplug the disk
        win.find("SCSI Disk 1", "table cell").click()
        tab = win.find("disk-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        self.assertTrue(tab.find("Storage format:", "text").text == "qcow2")
        win.find("config-remove").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Are you sure you want to remove", "label")
        alert.find("Yes", "push button").click()

        # Change CDROM
        win.find("IDE CDROM 1", "table cell").click()
        tab = win.find("disk-tab", None)
        entry = win.find("media-entry")
        appl = win.find("config-apply")
        uiutils.check_in_loop(lambda: tab.showing)
        entry.text = fname
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        self.assertTrue(entry.text == fname)
        entry.click_secondary_icon()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        self.assertTrue(not entry.text)
Esempio n. 22
0
    def testPrefs(self):
        self.app.root.find("Edit", "menu").click()
        self.app.root.find("Preferences", "menu item").click()

        win = self.app.root.find_fuzzy("Preferences", "frame")

        win.find_fuzzy("Enable system tray", "check").click()

        win.find("Polling", "page tab").click()
        win.find_fuzzy(None, "check box", labeller_text="Poll CPU").click()

        win.find("New VM", "page tab").click()
        win.find("prefs-add-spice-usbredir", "combo box").click()
        win.find("No", "menu item").click()

        win.find("Console", "page tab").click()
        win.find("Change...", "push button").click()
        keyframe = self.app.root.find_fuzzy("Configure grab", "dialog")

        # On certain environments pressing "Alt_L" and clicking a window starts
        # window drag operation. Work around by pushing both Control and Alt.
        self.holdKey("Control_L")
        self.holdKey("Alt_L")
        self.holdKey("Z")
        try:
            keyframe.find_fuzzy("OK", "push button").click()
        finally:
            self.releaseKey("Z")
            self.releaseKey("Alt_L")
            self.releaseKey("Control_L")

        win.find("Feedback", "page tab").click()
        win.find_fuzzy(None, "check box",
                       labeller_text="Force Poweroff").click()

        win.find("General", "page tab").click()
        win.find_fuzzy("Enable system tray", "check").click()

        win.find_fuzzy("Close", "push button").click()
        uiutils.check_in_loop(lambda: win.visible is False)
Esempio n. 23
0
    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
        newvm.find_fuzzy("PXE", "radio").click()
        newvm.find_fuzzy("Forward", "button").click()
        osentry = newvm.find("oslist-entry")
        uiutils.check_in_loop(lambda: not osentry.text)

        # Make sure we throw an error if no OS selected
        newvm.find_fuzzy("Forward", "button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find("You must select", "label")
        alert.find("OK", "push button").click()

        # Test activating the osentry to grab the popover selection
        osentry.click()
        osentry.typeText("generic")
        newvm.find("oslist-popover")
        osentry.click()
        self.pressKey("Enter")
        uiutils.check_in_loop(lambda: osentry.text == "Generic default")

        # Verify back+forward still keeps Generic selected
        newvm.find_fuzzy("Back", "button").click()
        newvm.find_fuzzy("Forward", "button").click()
        uiutils.check_in_loop(lambda: "Generic" in osentry.text)

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

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

        delete = self.app.root.find_fuzzy("Delete", "frame")
        delete.find_fuzzy("Delete", "button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Yes", "push button").click()

        # Verify delete dialog and VM dialog are now gone
        uiutils.check_in_loop(lambda: vmwindow.showing is False)
Esempio n. 24
0
 def testManagerDefaultStartup(self):
     self.app.open(use_uri=False)
     manager = self.app.topwin
     errlabel = manager.find("error-label")
     uiutils.check_in_loop(
         lambda: "Checking for virtualization" in errlabel.text)
     uiutils.check_in_loop(lambda: "File->Add Connection" in errlabel.text)
     uiutils.check_in_loop(lambda: "appropriate qemu/kvm" in errlabel.text)
    def testAddHWXMLEdit(self):
        """
        Test XML editor integration
        """
        self.app.open(xmleditor_enabled=True)
        details = self._open_details_window()
        win = self._open_addhw_window(details)
        finish = win.find("Finish", "push button")

        # Disk test, change path and make sure we error it is missing
        win.find("XML", "page tab").click()
        xmleditor = win.find("XML editor")
        origpath = "/var/lib/libvirt/images/test-clone-simple.qcow2"
        newpath = "/FOO/XMLEDIT/test1.img"
        xmleditor.text = xmleditor.text.replace(origpath, newpath)
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("non-existent path")
        alert.find("Close", "push button").click()

        # Undo the bad change, change bus/target
        xmleditor.text = xmleditor.text.replace(newpath, origpath)
        xmleditor.text = xmleditor.text.replace("hdb", "xvda")
        xmleditor.text = xmleditor.text.replace("ide", "xen")
        finish.click()

        # Verify the changes applied
        details.find("Xen Disk 1").click()
        uiutils.check_in_loop(lambda: details.active)
        win = self._open_addhw_window(details)
        tab = self._select_hw(win, "Storage", "storage-tab")
        tab.find_fuzzy("Select or create", "radio").click()
        tab.find("storage-browse", "push button").click()
        browse = self.app.root.find("Choose Storage Volume", "frame")
        browse.find(os.path.basename(origpath))
        browse.find("Cancel").click()

        # Select XML, switch to new dev type, verify we change focus
        win.find("XML", "page tab").click()
        xmleditor = win.find("XML editor")
        uiutils.check_in_loop(lambda: xmleditor.showing)
        tab = self._select_hw(win, "Network", "network-tab")
        uiutils.check_in_loop(lambda: not xmleditor.showing)

        # Do standard xmleditor tests
        self._test_xmleditor_interactions(win, finish)
        win.find("Cancel", "push button").click()
        uiutils.check_in_loop(lambda: not win.visible)
Esempio n. 26
0
    def testMigrate(self):
        # Add an additional connection
        self.app.root.find("File", "menu").click()
        self.app.root.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")
        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("Custom URI", "menu item").click()
        win.find("uri-entry", "text").text = "test:///default"
        win.find("Connect", "push button").click()

        uiutils.check_in_loop(lambda: win.showing is False)
        c = self.app.root.find("test-many-devices", "table cell")
        c.click(button=3)
        self.app.root.find("Migrate...", "menu item").click()

        mig = self.app.root.find("Migrate the virtual machine", "frame")
        mig.find("Advanced", "toggle button").click_expander()
        mig.find("Migrate", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("the.connection.driver:.virDomainMigrate")
        alert.find("Close", "push button").click()
        mig.find("Cancel", "push button").click()
        uiutils.check_in_loop(lambda: not mig.showing)
Esempio n. 27
0
    def testMigrate(self):
        # Add an additional connection
        self.app.root.find("File", "menu").click()
        self.app.root.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")
        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("Custom URI", "menu item").click()
        win.find("uri-entry", "text").text = "test:///default"
        win.find("Connect", "push button").click()

        uiutils.check_in_loop(lambda: win.showing is False)
        c = self.app.root.find("test-many-devices", "table cell")
        c.click(button=3)
        self.app.root.find("Migrate...", "menu item").click()

        mig = self.app.root.find("Migrate the virtual machine", "frame")
        mig.find("Advanced", "toggle button").click_expander()
        mig.find("Migrate", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("the connection driver: virDomainMigrate")
        alert.find("Close", "push button").click()
        mig.find("Cancel", "push button").click()
        uiutils.check_in_loop(lambda: not mig.showing)
Esempio n. 28
0
    def testChooseCDHotplug(self):
        """
        Test in the case of a running VM
        """
        win = self._open_details_window()
        hw = win.find("hw-list")
        tab = win.find("disk-tab")

        # CDROM + physical
        hw.find("IDE CDROM 1", "table cell").click()
        tab.find("Connect", "push button").click()
        cm = self.app.root.find("Choose Media", "dialog")
        cm.find("OK", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("changes will take effect", "label")
        alert.find("OK", "push button").click()
        self.assertTrue("-" in tab.find("disk-source-path").text)

        # Shutdown the VM, verify change shows up
        win.find("Shut Down", "push button").click()
        run = win.find("Run", "push button")
        uiutils.check_in_loop(lambda: run.sensitive)
        self.assertTrue("/dev/sr0" in tab.find("disk-source-path").text)
    def testAddGraphics(self):
        """
        Graphics device testing
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # VNC example
        tab = self._select_hw(addhw, "Graphics", "graphics-tab")
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("VNC", "menu item").click()
        tab.find("Listen type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Address", "menu item").click()
        tab.find("Address:", "combo box").click_combo_entry()
        tab.find_fuzzy("All interfaces", "menu item").click()
        tab.find("graphics-port-auto", "check").click()
        tab.find("graphics-port", "spin button").text = "1234"
        tab.find("Password:"******"check").click()
        passwd = tab.find_fuzzy("graphics-password", "text")
        newpass = "******"
        passwd.typeText(newpass)
        tab.find("Show password", "check").click()
        self.assertEqual(passwd.text, newpass)
        finish.click()

        # Catch a port error
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Port must be above 5900", "label")
        alert.find("Close", "push button").click()
        tab.find("graphics-port", "spin button").text = "5920"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Spice regular example
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Graphics", "graphics-tab")
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Spice", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Spice GL example
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Graphics", "graphics-tab")
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Spice", "menu item").click()
        tab.find("Listen type:", "combo box").click_combo_entry()
        tab.find_fuzzy("None", "menu item").click()
        tab.find("OpenGL:", "check box").click()
        render = tab.find("graphics-rendernode", "combo box")
        m = tab.find_fuzzy("Intel Corp", "menu item")
        render.click_combo_entry()
        self.assertTrue(m.selected)
        self.pressKey("Escape")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 30
0
 def _browse_local_path(winlabel, usepath):
     chooser = self.app.root.find(winlabel, "file chooser")
     # Enter the filename and select it
     chooser.find(usepath, "table cell").click()
     obutton = chooser.find("Open", "push button")
     uiutils.check_in_loop(lambda: obutton.sensitive)
     obutton.click()
     uiutils.check_in_loop(lambda: not chooser.showing)
     uiutils.check_in_loop(lambda: win.active)
Esempio n. 31
0
    def testNewVMInstallFail(self):
        def dofail():
            _newvm = self._open_create_wizard()
            _newvm.find_fuzzy("Manual", "radio").click()
            self.forward(_newvm)
            _newvm.find("oslist-entry").text = "generic"
            _newvm.find("oslist-popover").find_fuzzy("generic").click()
            self.forward(_newvm)
            self.forward(_newvm)
            self.forward(_newvm)

            # '/' in name will trigger libvirt error
            _newvm.find_fuzzy("Name", "text").text = "test/bad"
            _newvm.find_fuzzy("Finish", "button").click()
            alert = self.app.root.find("vmm dialog", "alert")
            alert.find_fuzzy("Unable to complete install")
            alert.find_fuzzy("Close", "button").click()
            return _newvm

        newvm = dofail()

        # Closing dialog should trigger storage cleanup path
        newvm.find_fuzzy("Cancel", "button").click()
        uiutils.check_in_loop(lambda: not newvm.visible)

        # Run again
        newvm = dofail()
        self.back(newvm)
        newvm.find_fuzzy("Select or create", "radio").click()
        newvm.find("storage-entry").text = "/dev/default-pool/somenewvol1"
        self.forward(newvm)
        newvm.find_fuzzy("Name", "text").text = "test-foo"
        newvm.find_fuzzy("Finish", "button").click()

        self.app.root.find_fuzzy("test-foo on", "frame")
        self.assertFalse(newvm.showing)
Esempio n. 32
0
    def _testQemuSearchCheck(self, filename):
        """
        Use fake KVM URI, create a tmpdir with bad perms, make sure
        UI offers to fix it, and initiate the fix
        """
        self.app.uri = tests.utils.URIs.kvm
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Launch addhw, storage, file chooser
        tab = self._select_hw(addhw, "Storage", "storage-tab")
        tab.find_fuzzy("Select or create", "radio").click()
        tab.find("storage-browse", "push button").click()
        browse = self.app.root.find("Choose Storage Volume", "frame")
        browse.find("Browse Local", "push button").click()
        chooser = self.app.root.find(
                "Locate existing storage", "file chooser")

        # Enter the filename and select it
        chooser.find("Name", "text").text = filename
        obutton = chooser.find("Open", "push button")
        uiutils.check_in_loop(lambda: obutton.sensitive)
        obutton.click()
        uiutils.check_in_loop(lambda: not chooser.showing)
        uiutils.check_in_loop(lambda: addhw.active)
        finish.click()

        # Verify permission dialog pops up, ask to change
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find("The emulator may not have search permissions")
        alert.find("Yes", "push button").click()

        # Verify no errors
        uiutils.check_in_loop(lambda: not addhw.showing)
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 33
0
    def testNewVMMultiConnection(self):
        """
        Test the wizard's multiple connection handling
        """
        # Add an extra connection for test:///default
        self.app.root.find("File", "menu").click()
        self.app.root.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")
        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("Custom URI", "menu item").click()
        win.find("uri-entry", "text").text = "test:///default"
        win.find("Connect", "push button").click()

        # Open the new VM wizard, select a connection
        newvm = self._open_create_wizard()
        combo = newvm.find("create-conn")
        combo.click()
        combo.find_fuzzy("testdriver.xml").click()
        self.forward(newvm)

        # Verify media-combo contents for testdriver.xml
        cdrom = newvm.find("media-combo")
        entry = newvm.find("media-entry")
        cdrom.click_combo_entry()
        cdrom.find_fuzzy(r"\(/dev/sr1\)")
        entry.click()

        # Back up, select test:///default, verify media-combo is now empty
        self.back(newvm)
        back = newvm.find_fuzzy("Back", "button")
        uiutils.check_in_loop(lambda: not back.sensitive)
        combo.click()
        combo.find_fuzzy("test default").click()
        self.forward(newvm)
        cdrom.click_combo_entry()
        self.assertTrue("/dev/sr1" not in cdrom.fmt_nodes())
Esempio n. 34
0
    def testCreateNet(self):
        hostwin = self._open_host_window("Virtual Networks")
        win = self._open_create_win(hostwin)

        # Create a simple default network
        name = win.find("Name:", "text")
        finish = win.find("Finish", "push button")
        self.assertEqual(name.text, "network")
        newname = "a-test-new-net"
        name.text = newname
        finish.click()

        # Select the new network in the host window, then do
        # stop->start->stop->delete, for lifecycle testing
        uiutils.check_in_loop(lambda: hostwin.active)
        cell = hostwin.find(newname, "table cell")
        delete = hostwin.find("net-delete", "push button")
        start = hostwin.find("net-start", "push button")
        stop = hostwin.find("net-stop", "push button")

        cell.click()
        stop.click()
        uiutils.check_in_loop(lambda: start.sensitive)
        start.click()
        uiutils.check_in_loop(lambda: stop.sensitive)
        stop.click()
        uiutils.check_in_loop(lambda: delete.sensitive)

        # Delete it
        delete.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("permanently delete the network", "label")
        alert.find("Yes", "push button").click()

        # Ensure it's gone
        uiutils.check_in_loop(lambda: cell.dead)
Esempio n. 35
0
    def testNewVMMultiConnection(self):
        """
        Test the wizard's multiple connection handling
        """
        # Add an extra connection for test:///default
        self.app.root.find("File", "menu").click()
        self.app.root.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")
        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("Custom URI", "menu item").click()
        win.find("uri-entry", "text").text = "test:///default"
        win.find("Connect", "push button").click()

        # Open the new VM wizard, select a connection
        newvm = self._open_create_wizard()
        combo = newvm.find("create-conn")
        combo.click()
        combo.find_fuzzy("testdriver.xml").click()
        newvm.find_fuzzy("Forward", "button").click()

        # Verify media-combo contents for testdriver.xml
        cdrom = newvm.find("media-combo")
        entry = newvm.find("media-entry")
        cdrom.click_combo_entry()
        cdrom.find_fuzzy(r"\(/dev/sr1\)")
        entry.click()

        # Back up, select test:///default, verify media-combo is now empty
        back = newvm.find_fuzzy("Back", "button")
        back.click()
        uiutils.check_in_loop(lambda: not back.sensitive)
        combo.click()
        combo.find_fuzzy("test default").click()
        newvm.find_fuzzy("Forward", "button").click()
        cdrom.click_combo_entry()
        self.assertTrue("/dev/sr1" not in cdrom.fmt_nodes())
Esempio n. 36
0
 def testManagerDefaultStartup(self):
     self.app.open(use_uri=False)
     manager = self.app.topwin
     errlabel = manager.find("error-label")
     uiutils.check_in_loop(
             lambda: "Checking for virtualization" in errlabel.text)
     uiutils.check_in_loop(
             lambda: "File->Add Connection" in errlabel.text)
     uiutils.check_in_loop(
             lambda: "appropriate qemu/kvm" in errlabel.text)
    def testAddHosts(self):
        """
        Add a few different USB and PCI devices
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add USB device dup1
        tab = self._select_hw(addhw, "USB Host Device", "host-tab")
        tab.find_fuzzy("HP Dup USB 1", "table cell").click()
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("device is already in use by", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: details.active)

        # Add USB device dup2
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "USB Host Device", "host-tab")
        tab.find_fuzzy("HP Dup USB 2", "table cell").click()
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("device is already in use by", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: details.active)

        # Add another USB device
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "USB Host Device", "host-tab")
        tab.find_fuzzy("Cruzer Micro 256", "table cell").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add PCI device
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "PCI Host Device", "host-tab")
        tab.find_fuzzy("(Interface eth0)", "table cell").click()
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("device is already in use by", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 38
0
    def testAddHosts(self):
        """
        Add a few different USB and PCI devices
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add USB device dup1
        tab = self._select_hw(addhw, "USB Host Device", "host-tab")
        tab.find_fuzzy("HP Dup USB 1", "table cell").click()
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("device is already in use by", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: details.active)

        # Add USB device dup2
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "USB Host Device", "host-tab")
        tab.find_fuzzy("HP Dup USB 2", "table cell").click()
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("device is already in use by", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: details.active)

        # Add another USB device
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "USB Host Device", "host-tab")
        tab.find_fuzzy("Cruzer Micro 256", "table cell").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add PCI device
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "PCI Host Device", "host-tab")
        tab.find_fuzzy("(Interface eth0)", "table cell").click()
        finish.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("device is already in use by", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 39
0
    def testAddChars(self):
        """
        Add a bunch of char devices
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add console device
        tab = self._select_hw(addhw, "Console", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("Pseudo TTY", "menu item").click()
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Hypervisor default", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add serial+file
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Serial", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("Output to a file", "menu item").click()
        tab.find("Path:", "text").text = "/tmp/foo.log"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Parallel", "char-tab")
        tab.find("Device Type:", "combo box").click()
        tab.find_fuzzy("Unix", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add spicevmc channel
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Channel", "char-tab")
        # Ensures that this is selected by default
        tab.find("com.redhat.spice.0", "combo box")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 40
0
    def _checkConsoleStandard(self):
        """
        Shared logic for general console handling
        """
        win = self.app.topwin
        con = win.find("console-gfx-viewport")
        self.assertTrue(con.showing)

        win.find("Virtual Machine", "menu").click()
        win.find("Take Screenshot", "menu item").click()
        chooser = self.app.root.find(None, "file chooser")
        fname = chooser.find("Name", "text").text
        self.pressKey("Enter")
        uiutils.check_in_loop(lambda: os.path.exists(fname))
        os.unlink(fname)
        self.assertTrue(lambda: win.active)

        win.find("Send Key", "menu").click()
        win.find("Ctrl\+Alt\+F1", "menu item").click()
        win.find("Send Key", "menu").click()
        win.find("Ctrl\+Alt\+F10", "menu item").click()
        win.find("Send Key", "menu").click()
        win.find("Ctrl\+Alt\+Delete", "menu item").click()

        # 'Resize to VM' testing
        oldsize = win.size
        win.find("^View$", "menu").click()
        win.find("Resize to VM", "menu item").click()
        newsize = win.size
        self.assertTrue(oldsize != newsize)

        # Fullscreen testing
        win.find("^View$", "menu").click()
        win.find("Fullscreen", "check menu item").click()
        fstb = win.find("Fullscreen Toolbar")
        self.assertTrue(fstb.showing)
        self.assertTrue(win.size != newsize)

        # Wait for toolbar to hide, then reveal it again
        uiutils.check_in_loop(lambda: not fstb.showing, timeout=5)
        self.point(win.size[0] / 2, 0)
        uiutils.check_in_loop(lambda: fstb.showing)

        # Click stuff and exit fullscreen
        win.find("Fullscreen Send Key").click()
        self.pressKey("Escape")
        win.find("Fullscreen Exit").click()
        self.assertTrue(win.size == newsize)
Esempio n. 41
0
    def _checkConsoleStandard(self):
        """
        Shared logic for general console handling
        """
        win = self.app.topwin
        con = win.find("console-gfx-viewport")
        self.assertTrue(con.showing)

        win.find("Virtual Machine", "menu").click()
        win.find("Take Screenshot", "menu item").click()
        chooser = self.app.root.find(None, "file chooser")
        fname = chooser.find("Name", "text").text
        self.pressKey("Enter")
        uiutils.check_in_loop(lambda: os.path.exists(fname))
        os.unlink(fname)
        self.assertTrue(lambda: win.active)

        win.find("Send Key", "menu").click()
        win.find(r"Ctrl\+Alt\+F1", "menu item").click()
        win.find("Send Key", "menu").click()
        win.find(r"Ctrl\+Alt\+F10", "menu item").click()
        win.find("Send Key", "menu").click()
        win.find(r"Ctrl\+Alt\+Delete", "menu item").click()

        # 'Resize to VM' testing
        oldsize = win.size
        win.find("^View$", "menu").click()
        win.find("Resize to VM", "menu item").click()
        newsize = win.size
        self.assertTrue(oldsize != newsize)

        # Fullscreen testing
        win.find("^View$", "menu").click()
        win.find("Fullscreen", "check menu item").click()
        fstb = win.find("Fullscreen Toolbar")
        self.assertTrue(fstb.showing)
        self.assertTrue(win.size != newsize)

        # Wait for toolbar to hide, then reveal it again
        uiutils.check_in_loop(lambda: not fstb.showing, timeout=5)
        self.point(win.position[0] + win.size[0] / 2, 0)
        uiutils.check_in_loop(lambda: fstb.showing)

        # Click stuff and exit fullscreen
        win.find("Fullscreen Send Key").click()
        self.pressKey("Escape")
        win.find("Fullscreen Exit").click()
        self.assertTrue(win.size == newsize)
    def testAddNetworks(self):
        """
        Test various network configs
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Basic network + opts
        tab = self._select_hw(addhw, "Network", "network-tab")
        src = tab.find(None, "combo box", "Network source:")
        src.click()
        tab.find_fuzzy("Virtual network 'default' : NAT", "menu item").click()
        tab.find("MAC Address Field", "text").text = "00:11:00:11:00:11"
        tab.find("Device model:", "combo box").click_combo_entry()
        tab.find("virtio", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Manual macvtap
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Network", "network-tab")
        src.click()
        tab.find_fuzzy("Macvtap device...", "menu item").click()
        tab.find("Device name:", "text").text = "macvtapfoo7"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Manual bridge. Also trigger MAC collision
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Network", "network-tab")
        tab.find("mac-address-enable", "check box").click()
        src.click()
        self.pressKey("End")
        tab.find_fuzzy("Bridge device...", "menu item").click()
        tab.find("Device name:", "text").text = "zbr0"
        finish.click()

        # Check MAC validation error
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("00:11:22:33:44:55", "label")
        alert.find("Close", "push button").click()

        # Fix MAC
        tab.find("mac-address-enable", "check box").click()
        tab.find("MAC Address Field", "text").text = "00:11:0A:11:00:11"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 43
0
    def testDetailsEditDiskNet(self):
        """
        Test disk and network devices
        """
        win = self._open_details_window(vmname="test-many-devices")
        appl = win.find("config-apply", "push button")
        self._stop_vm(win)


        # Disk options
        tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
        tab.find("Shareable:", "check box").click()
        tab.find("Readonly:", "check box").click()
        tab.find("Advanced options", "toggle button").click_expander()
        tab.find("Cache mode:", "text").text = "unsafe"
        tab.find("Discard mode:", "text").text = "unmap"
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)


        # Network values w/ macvtap manual
        tab = self._select_hw(win, "NIC :54:32:10", "network-tab")
        src = tab.find("Network source:", "combo box")
        src.click()
        self.pressKey("Home")
        tab.find_fuzzy("Macvtap device...",
                       "menu item").bring_on_screen().click()
        tab.find("Device name:", "text").text = "fakedev12"
        tab.find("Device model:", "combo box").click_combo_entry()
        tab.find("rtl8139", "menu item").click()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)

        # Manual bridge
        src.click()
        tab.find_fuzzy("Bridge device...",
                       "menu item").bring_on_screen().click()
        tab.find("Device name:", "text").text = ""
        appl.click()
        # Check validation error
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Error changing VM configuration", "label")
        alert.find("Close", "push button").click()
        tab.find("Device name:", "text").text = "zbr0"
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
Esempio n. 44
0
    def testCreateVol(self):
        # Open the createnet dialog
        hostwin = self._open_host_window("Storage")
        poolcell = hostwin.find("default-pool", "table cell")
        poolcell.click()
        hostwin.find("vol-new", "push button").click()
        win = self.app.root.find(
                "Add a Storage Volume", "frame")

        # Create a default qcow2 volume
        newname = "a-newvol"
        finish = win.find("Finish", "push button")
        name = win.find("Name:", "text")
        name.text = newname
        win.find("Max Capacity:", "spin button").text = "10.5"
        finish.click()

        # Delete it
        vollist = hostwin.find("vol-list", "table")
        volcell = vollist.find(newname + ".qcow2")
        volcell.click()
        hostwin.find("vol-refresh", "push button").click()
        hostwin.find("vol-delete", "push button").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("permanently delete the volume", "label")
        alert.find("Yes", "push button").click()
        uiutils.check_in_loop(lambda: volcell.dead)


        # Create a raw volume too
        hostwin.find("vol-new", "push button").click()
        uiutils.check_in_loop(lambda: win.active)
        newname = "a-newvol.raw"
        name.text = newname
        combo = win.find("Format:", "combo box")
        combo.click_combo_entry()
        combo.find("raw", "menu item").click()
        win.find("Allocation:", "spin button").text = "0.5"
        finish.click()
        vollist.find(newname)

        # Ensure host window closes fine
        hostwin.keyCombo("<ctrl>w")
        uiutils.check_in_loop(lambda: not hostwin.showing and
                not hostwin.active)
Esempio n. 45
0
    def testAddControllers(self):
        """
        Add various controller configs
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Default SCSI
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ = tab.find("Type:", "combo box")
        typ.click_combo_entry()
        tab.find("SCSI", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Virtio SCSI
        addhw = self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ.click_combo_entry()
        tab.find("SCSI", "menu item").click()
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("VirtIO SCSI", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # USB 2
        addhw = self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ.click_combo_entry()
        tab.find("USB", "menu item").click()
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("USB 2", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # USB 3
        addhw = self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ.click_combo_entry()
        tab.find("^USB$", "menu item").click()
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("USB 3", "menu item").click()
        # Can't add more than 1 USB controller, so finish isn't sensitive
        self.assertFalse(finish.sensitive)
    def testAddControllers(self):
        """
        Add various controller configs
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Default SCSI
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ = tab.find("Type:", "combo box")
        typ.click_combo_entry()
        tab.find("SCSI", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Virtio SCSI
        addhw = self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ.click_combo_entry()
        tab.find("SCSI", "menu item").click()
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("VirtIO SCSI", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # USB 2
        addhw = self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ.click_combo_entry()
        tab.find("USB", "menu item").click()
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("USB 2", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # USB 3
        addhw = self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Controller", "controller-tab")
        typ.click_combo_entry()
        tab.find("^USB$", "menu item").click()
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("USB 3", "menu item").click()
        # Can't add more than 1 USB controller, so finish isn't sensitive
        self.assertFalse(finish.sensitive)
Esempio n. 47
0
    def testAddLXCFilesystem(self):
        """
        Adding LXC specific filesystems
        """
        self.app.uri = tests.utils.URIs.lxc

        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add File+nbd share
        tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
        tab.find("Type:", "combo box").click()
        tab.find("File", "menu item").click()
        tab.find("Driver:", "combo box").click()
        tab.find("Nbd", "menu item").click()
        tab.find("Format:", "combo box").click_combo_entry()
        tab.find("qcow2", "menu item").click()
        tab.find("Browse...", "push button").click()

        browsewin = self.app.root.find(
                "Choose Storage Volume", "frame")
        browsewin.find("Cancel", "push button").click()
        uiutils.check_in_loop(lambda: addhw.active)

        tab.find("Source path:", "text").text = "/foo/source"
        tab.find("Target path:", "text").text = "/foo/target"
        tab.find_fuzzy("Export filesystem", "check").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add RAM type
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
        tab.find("Type:", "combo box").click()
        tab.find("Ram", "menu item").click()
        tab.find("Usage:", "spin button").text = "12345"
        tab.find("Target path:", "text").text = "/mem"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 48
0
    def testAddLXCFilesystem(self):
        """
        Adding LXC specific filesystems
        """
        self.app.uri = tests.utils.URIs.lxc

        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add File+nbd share
        tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
        tab.find("Type:", "combo box").click()
        tab.find("File", "menu item").click()
        tab.find("Driver:", "combo box").click()
        tab.find("Nbd", "menu item").click()
        tab.find("Format:", "combo box").click_combo_entry()
        tab.find("qcow2", "menu item").click()
        tab.find("Browse...", "push button").click()

        browsewin = self.app.root.find(
                "Choose Storage Volume", "frame")
        browsewin.find("Cancel", "push button").click()
        uiutils.check_in_loop(lambda: addhw.active)

        tab.find("Source path:", "text").text = "/foo/source"
        tab.find("Target path:", "text").text = "/foo/target"
        tab.find_fuzzy("Export filesystem", "check").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add RAM type
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
        tab.find("Type:", "combo box").click()
        tab.find("Ram", "menu item").click()
        tab.find("Usage:", "spin button").text = "12345"
        tab.find("Target path:", "text").text = "/mem"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 49
0
    def _testLiveHotplug(self, fname):
        win = self.app.topwin
        win.find("Details", "radio button").click()

        # Add a scsi disk, importing the passed path
        win.find("add-hardware", "push button").click()
        addhw = self.app.root.find("Add New Virtual Hardware", "frame")
        addhw.find("Storage", "table cell").click()
        tab = addhw.find("storage-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        tab.find("Select or create", "radio button").click()
        tab.find("storage-entry").text = fname
        tab.find("Bus type:", "combo box").click()
        tab.find("SCSI", "menu item").click()
        addhw.find("Finish", "push button").click()

        # Hot unplug the disk
        win.find("SCSI Disk 1", "table cell").click()
        tab = win.find("disk-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        self.assertTrue(tab.find("Storage format:", "text").text == "qcow2")
        win.find("config-remove").click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Are you sure you want to remove", "label")
        alert.find("Yes", "push button").click()

        # Change CDROM
        win.find("IDE CDROM 1", "table cell").click()
        tab = win.find("disk-tab", None)
        uiutils.check_in_loop(lambda: tab.showing)
        tab.find("Connect", "push button").click()
        cm = self.app.root.find("Choose Media", "dialog")
        cm.find("Image Location", "radio button").click()
        cm.find("Location:", "text").text = fname
        cm.find("OK", "push button").click()
        self.assertTrue(tab.find("disk-source-path").text == fname)
        tab.find("Disconnect", "push button").click()
        self.assertTrue("-" in tab.find("disk-source-path").text)
Esempio n. 50
0
    def testConnect(self):
        # Start with connection delete
        c = self.app.root.find("test testdriver.xml", "table cell")
        c.click(button=3)
        self.app.root.find("conn-disconnect",
                             "menu item").click()
        uiutils.check_in_loop(lambda: "Not Connected" in c.text)
        c.click(button=3)
        self.app.root.find("conn-delete", "menu item").click()
        err = self.app.root.find("vmm dialog", "alert")
        err.find_fuzzy("will remove the connection", "label")
        err.find_fuzzy("Yes", "push button").click()
        uiutils.check_in_loop(lambda: c.dead)

        # Launch the dialog, grab some UI pointers
        self.app.root.find("File", "menu").click()
        self.app.root.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")

        connect = win.find("Connect", "push button")
        remote = win.find_fuzzy("Connect to remote", "check box")
        user = win.find("Username", "text")
        host = win.find("Hostname", "text")
        urilabel = win.find("uri-label", "label")
        urientry = win.find("uri-entry", "text")
        self.assertTrue(user.showing is host.showing is True)

        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("QEMU/KVM user session", "menu item").click()
        self.assertTrue(user.showing is host.showing is False)
        self.assertTrue(urilabel.text == "qemu:///session")

        # Enter a failing URI, make sure error is raised, and we can
        # fall back to the dialog
        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("Xen", "menu item").click()
        remote.click()
        user.text = "fribuser"
        fakehost = "ix8khfyidontexistkdjur.com"
        host.text = fakehost + ":12345"
        self.assertTrue(
                urilabel.text == "xen+ssh://fribuser@%s:12345/" % fakehost)
        connect.click()

        uiutils.check_in_loop(lambda: win.showing is True)
        c = self.app.root.find_fuzzy(fakehost, "table cell")
        uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
                timeout=10)
        err = self.app.root.find_fuzzy("vmm dialog", "alert")
        err.find_fuzzy("No", "push button").click()

        # Ensure dialog shows old contents for editing
        uiutils.check_in_loop(lambda: win.showing)
        self.assertTrue(fakehost in host.text)

        # This time say 'yes'
        connect.click()
        uiutils.check_in_loop(lambda: win.showing is True)
        c = self.app.root.find_fuzzy(fakehost, "table cell")
        uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
                timeout=10)
        err = self.app.root.find_fuzzy("vmm dialog", "alert")
        err.find_fuzzy("Yes", "push button").click()
        c = self.app.root.find_fuzzy(fakehost, "table cell")

        # Test with custom test:///default connection
        uiutils.check_in_loop(lambda: win.showing is False)
        self.app.root.find("File", "menu").click()
        self.app.root.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")
        win.find_fuzzy("Hypervisor", "combo box").click()
        win.find_fuzzy("Custom URI", "menu item").click()
        urientry.text = "test:///default"
        connect.click()

        # Try various connect/disconnect routines
        uiutils.check_in_loop(lambda: win.showing is False)
        c = self.app.root.find("test default", "table cell")
        c.click(button=3)
        self.app.root.find("conn-disconnect", "menu item").click()
        uiutils.check_in_loop(lambda: "Not Connected" in c.text)
        c.click(button=3)
        self.app.root.find("conn-connect", "menu item").click()
        c = self.app.root.find("test default", "table cell")
        c.click(button=3)
        self.app.root.find("conn-disconnect", "menu item").click()
        uiutils.check_in_loop(lambda: "Not Connected" in c.text)
        c.doubleClick()
        c = self.app.root.find("test default", "table cell")
        c.click()
Esempio n. 51
0
    def testCreatePool(self):
        # Open the createnet dialog
        hostwin = self._open_host_window("Storage")
        hostwin.find("pool-add", "push button").click()
        win = self.app.root.find(
                "Add a New Storage Pool", "frame")

        # Create a simple default dir pool
        newname = "a-test-new-pool"
        forward = win.find("Forward", "push button")
        finish = win.find("Finish", "push button")
        name = win.find("Name:", "text")
        name.text = newname
        forward.click()
        finish.click()

        # Select the new object in the host window, then do
        # stop->start->stop->delete, for lifecycle testing
        uiutils.check_in_loop(lambda: hostwin.active)
        cell = hostwin.find(newname, "table cell")
        delete = hostwin.find("pool-delete", "push button")
        start = hostwin.find("pool-start", "push button")
        stop = hostwin.find("pool-stop", "push button")

        cell.click()
        stop.click()
        uiutils.check_in_loop(lambda: start.sensitive)
        start.click()
        uiutils.check_in_loop(lambda: stop.sensitive)
        stop.click()
        uiutils.check_in_loop(lambda: delete.sensitive)

        # Delete it
        delete.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("permanently delete the pool", "label")
        alert.find("Yes", "push button").click()

        # Ensure it's gone
        uiutils.check_in_loop(lambda: cell.dead)


        # Test a scsi pool
        hostwin.find("pool-add", "push button").click()
        uiutils.check_in_loop(lambda: win.active)
        typ = win.find("Type:", "combo box")
        newname = "a-scsi-pool"
        name.text = "a-scsi-pool"
        typ.click()
        win.find_fuzzy("SCSI Host Adapter", "menu item").click()
        forward.click()
        win.find_fuzzy("Source Path:", "combo").click_combo_entry()
        win.find_fuzzy("host2", "menu item").click()
        finish.click()
        hostwin.find(newname, "table cell")

        # Test a ceph pool
        hostwin.find("pool-add", "push button").click()
        uiutils.check_in_loop(lambda: win.active)
        newname = "a-ceph-pool"
        name.text = "a-ceph-pool"
        typ.click()
        win.find_fuzzy("RADOS Block", "menu item").click()
        forward.click()
        win.find_fuzzy("Host Name:", "text").text = "example.com:1234"
        win.find_fuzzy("Source Name:", "text").typeText("frob")
        finish.click()
        hostwin.find(newname, "table cell")

        # Ensure host window closes fine
        hostwin.click()
        hostwin.keyCombo("<ctrl>w")
        uiutils.check_in_loop(lambda: not hostwin.showing and
                not hostwin.active)
Esempio n. 52
0
    def testCreateNet(self):
        # Open the createnet dialog
        hostwin = self._open_host_window("Virtual Networks")
        hostwin.find("net-add", "push button").click()
        win = self.app.root.find("Create a new virtual network", "frame")

        # Create a simple default network
        newname = "a-test-new-net"
        forward = win.find("Forward", "push button")
        finish = win.find("Finish", "push button")
        name = win.find("Network Name:", "text")
        name.text = newname
        forward.click()
        forward.click()
        forward.click()
        finish.click()

        # Select the new network in the host window, then do
        # stop->start->stop->delete, for lifecycle testing
        uiutils.check_in_loop(lambda: hostwin.active)
        cell = hostwin.find(newname, "table cell")
        delete = hostwin.find("net-delete", "push button")
        start = hostwin.find("net-start", "push button")
        stop = hostwin.find("net-stop", "push button")

        cell.click()
        stop.click()
        uiutils.check_in_loop(lambda: start.sensitive)
        start.click()
        uiutils.check_in_loop(lambda: stop.sensitive)
        stop.click()
        uiutils.check_in_loop(lambda: delete.sensitive)

        # Delete it
        delete.click()
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("permanently delete the network", "label")
        alert.find("Yes", "push button").click()

        # Ensure it's gone
        uiutils.check_in_loop(lambda: cell.dead)

        # Ensure host window closes fine
        hostwin.click()
        hostwin.keyCombo("<ctrl>w")
        uiutils.check_in_loop(
            lambda: not hostwin.showing and not hostwin.active)
Esempio n. 53
0
 def _open_create_win(self, hostwin):
     hostwin.find("vol-new", "push button").click()
     win = self.app.root.find("Add a Storage Volume", "frame")
     uiutils.check_in_loop(lambda: win.active)
     return win
Esempio n. 54
0
    def testDetailsEditDomain1(self):
        """
        Test overview, memory, cpu pages
        """
        self.app.uri = tests.utils.URIs.kvm
        win = self._open_details_window(vmname="test-many-devices")
        appl = win.find("config-apply", "push button")

        # Overview description
        tab = self._select_hw(win, "Overview", "overview-tab")
        tab.find("Description:", "text").text = "hey new description"
        tab.find("Title:", "text").text = "hey new title"
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)

        # Memory balloon
        tab = self._select_hw(win, "Memory", "memory-tab")
        tab.find("Current allocation:", "spin button").text = "300"
        tab.find("Maximum allocation:", "spin button").text = "800"
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)

        # CPU hotplug
        tab = self._select_hw(win, "CPUs", "cpu-tab")
        tab.find("Current allocation:", "spin button").text = "2"
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)

        # Static CPU config
        self._stop_vm(win)
        # more cpu config: host-passthrough, copy, clear CPU, manual
        tab.find("cpu-model").click_combo_entry()
        tab.find_fuzzy("Clear CPU", "menu item").click()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        tab.find("cpu-model").click_combo_entry()
        tab.find("coreduo", "menu item").click()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        tab.find("cpu-model").click_combo_entry()
        tab.find("Application Default", "menu item").click()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        tab.find_fuzzy("Copy host").click()
        tab.find("cpu-model").click_combo_entry()
        tab.find("Hypervisor Default", "menu item").click()
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)

        # CPU topology
        tab.find_fuzzy("Manually set", "check").click()
        tab.find("Sockets:", "spin button").typeText("8")
        tab.find("Cores:", "spin button").typeText("2")
        tab.find("Threads:", "spin button").typeText("2")
        appl.click()
        uiutils.check_in_loop(lambda: not appl.sensitive)
        self.assertTrue(tab.find_fuzzy("Maximum", "spin").text == "32")
Esempio n. 55
0
    def testAddHWMisc(self):
        """
        Add one each of simple devices
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Add input
        tab = self._select_hw(addhw, "Input", "input-tab")
        tab.find("Type:", "combo box").click()
        tab.find("EvTouch", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add sound
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Sound", "sound-tab")
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("HDA", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add video
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Video", "video-tab")
        tab.find("Model:", "combo box").click_combo_entry()
        tab.find("Virtio", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add watchdog
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Watchdog", "watchdog-tab")
        tab.find("Model:", "combo box").click()
        tab.find("I6300", "menu item").click()
        tab.find("Action:", "combo box").click()
        tab.find("Pause the guest", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add smartcard
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Smartcard", "smartcard-tab")
        tab.find("Mode:", "combo box").click()
        tab.find("Passthrough", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add basic filesystem
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
        tab.find("Source path:", "text").text = "/foo/source"
        tab.find("Target path:", "text").text = "/foo/target"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add TPM
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "TPM", "tpm-tab")
        tab.find("Model:", "combo").click()
        tab.find("TIS", "menu item").click()
        tab.find("Backend:", "combo").click()
        tab.find("Passthrough", "menu item").click()
        tab.find("Device Path:", "text").text = "/tmp/foo"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add RNG
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "RNG", "rng-tab")
        tab.find("Host Device:", "text").text = "/dev/random"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add Panic
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Panic", "panic-tab")
        tab.find("Model:", "combo box").click()
        tab.find("Hyper-V", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Add vsock
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Virtio VSOCK", "vsock-tab")
        tab.find("vsock-auto").click()
        tab.find("vsock-cid").text = "7"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 56
0
    def testAddGraphics(self):
        """
        Graphics device testing
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # VNC example
        tab = self._select_hw(addhw, "Graphics", "graphics-tab")
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("VNC", "menu item").click()
        tab.find("Listen type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Address", "menu item").click()
        tab.find("Address:", "combo box").click_combo_entry()
        tab.find_fuzzy("All interfaces", "menu item").click()
        tab.find("graphics-port-auto", "check").click()
        tab.find("graphics-port", "spin button").text = "1234"
        tab.find("Password:"******"check").click()
        passwd = tab.find_fuzzy("graphics-password", "text")
        newpass = "******"
        passwd.typeText(newpass)
        tab.find("Show password", "check").click()
        self.assertEqual(passwd.text, newpass)
        tab.find("Keymap:", "combo box").click()
        self.pressKey("Down")
        self.pressKey("Down")
        self.pressKey("Down")
        finish.click()

        # Catch a port error
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("Port must be above 5900", "label")
        alert.find("Close", "push button").click()
        tab.find("graphics-port", "spin button").text = "5920"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Spice regular example
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Graphics", "graphics-tab")
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Spice", "menu item").click()
        tab.find("graphics-tlsport-auto", "check").click()
        tab.find("graphics-tlsport", "spin button").text = "5999"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Spice GL example
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Graphics", "graphics-tab")
        tab.find("Type:", "combo box").click_combo_entry()
        tab.find_fuzzy("Spice", "menu item").click()
        tab.find("Listen type:", "combo box").click_combo_entry()
        tab.find_fuzzy("None", "menu item").click()
        tab.find("OpenGL:", "check box").click()
        render = tab.find("graphics-rendernode", "combo box")
        m = tab.find_fuzzy("Intel Corp", "menu item")
        render.click_combo_entry()
        self.assertTrue(m.selected)
        self.pressKey("Escape")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 57
0
    def testAddNetworks(self):
        """
        Test various network configs
        """
        details = self._open_details_window()
        addhw = self._open_addhw_window(details)
        finish = addhw.find("Finish", "push button")

        # Basic network + opts
        tab = self._select_hw(addhw, "Network", "network-tab")
        src = tab.find(None, "combo box", "Network source:")
        src.click()
        tab.find_fuzzy("Virtual network 'default' : NAT", "menu item").click()
        tab.find("MAC Address Field", "text").text = "00:11:00:11:00:11"
        tab.find("Device model:", "combo box").click_combo_entry()
        tab.find("virtio", "menu item").click()
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # macvtap
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Network", "network-tab")
        src.click()
        tab.find_fuzzy("macvtap", "menu item").click()
        mode = tab.find_fuzzy("Source mode:", "combo box")
        mode.click_combo_entry()
        self.assertTrue(mode.find("Bridge", "menu item").selected)
        self.pressKey("Escape")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Manual bridge
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Network", "network-tab")
        tab.find("mac-address-enable", "check box").click()
        src.click()
        self.pressKey("End")
        tab.find_fuzzy("Specify shared device", "menu item").click()
        tab.find("Bridge name:", "text").text = "zbr0"
        finish.click()

        # Check MAC validation error
        alert = self.app.root.find("vmm dialog", "alert")
        alert.find_fuzzy("00:11:22:33:44:55", "label")
        alert.find("Close", "push button").click()

        # Fix MAC
        tab.find("mac-address-enable", "check box").click()
        tab.find("MAC Address Field", "text").text = "00:11:0A:11:00:11"
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Network with portops
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Network", "network-tab")
        tab.find("MAC Address Field", "text").text = "00:11:0B:11:00:11"
        src.click()
        self.sleep(1)
        self.pressKey("Home")
        tab.find_fuzzy("plainbridge-portgroups", "menu item").click()
        c = tab.find_fuzzy("Portgroup:", "combo box")
        c.click_combo_entry()
        self.assertTrue(c.find("engineering", "menu item").selected)
        self.pressKey("Escape")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)

        # Network with vport stuff
        self._open_addhw_window(details)
        tab = self._select_hw(addhw, "Network", "network-tab")
        tab.find("MAC Address Field", "text").text = "00:11:0C:11:00:11"
        src.click()
        tab.find_fuzzy("OpenVSwitch", "menu item").click()
        t = tab.find("Virtual port", "toggle button")
        t.click()
        t.find("Type:", "text").text = "802.1Qbg"
        t.find("Managerid:", "text").text = "12"
        t.find("Typeid:", "text").text = "1193046"
        t.find("Typeid version:", "text").text = "1"
        t.find("Instance id:", "text").text = (
                "09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b")
        finish.click()
        uiutils.check_in_loop(lambda: details.active)
Esempio n. 58
0
    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.assertEquals(
            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.assertEquals(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, "Forward", "button").click()

        # Verify that CPU values are non-default
        cpus = uiutils.find_fuzzy(newvm, None, "spin button", "CPUs:")
        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)
Esempio n. 59
0
 def _select_hw(self, addhw, hwname, tabname):
     addhw.find(hwname, "table cell").click()
     tab = addhw.find(tabname, None)
     uiutils.check_in_loop(lambda: tab.showing)
     return tab