コード例 #1
0
 def test_drivers(self):
     win7 = OSDB.lookup_os("win7")
     generic = OSDB.lookup_os("generic")
     self.assertFalse(generic.supports_unattended_drivers("x86_64"))
     self.assertTrue(win7.supports_unattended_drivers("x86_64"))
     self.assertFalse(win7.supports_unattended_drivers("fakearch"))
     self.assertTrue(win7.get_pre_installable_drivers_location("x86_64"))
コード例 #2
0
def test_drivers():
    win7 = OSDB.lookup_os("win7")
    generic = OSDB.lookup_os("generic")
    assert generic.supports_unattended_drivers("x86_64") is False
    assert win7.supports_unattended_drivers("x86_64") is True
    assert win7.supports_unattended_drivers("fakearch") is False
    assert win7.get_pre_installable_drivers_location("x86_64")
コード例 #3
0
def test_tree_url():
    f26 = OSDB.lookup_os("fedora26")
    f29 = OSDB.lookup_os("fedora29")
    winxp = OSDB.lookup_os("winxp")

    # Valid tree URL
    assert "fedoraproject.org" in f26.get_location("x86_64")

    # Most generic tree URL
    assert "Everything" in f29.get_location("x86_64")

    # Specific tree
    assert "Server" in f29.get_location("x86_64", "jeos")
    assert "Workstation" in f29.get_location("x86_64", "desktop")

    # Has tree URLs, but none for arch
    try:
        f26.get_location("ia64")
        raise AssertionError("Expected failure")
    except RuntimeError as e:
        assert "ia64" in str(e)

    # Has no tree URLs
    try:
        winxp.get_location("x86_64")
        raise AssertionError("Expected failure")
    except RuntimeError as e:
        assert str(e).endswith("URL location")

    # Trigger an error path for code coverage
    assert OSDB.guess_os_by_tree(utils.TESTDIR) is None
コード例 #4
0
def test_recommended_resources():
    conn = utils.URIs.open_testdefault_cached()
    guest = Guest(conn)
    res = OSDB.lookup_os("generic").get_recommended_resources()
    assert res.get_recommended_ram(guest.os.arch) is None

    res = OSDB.lookup_os("fedora21").get_recommended_resources()
    assert res.get_recommended_ncpus(guest.os.arch) == 2
コード例 #5
0
ファイル: test_osdict.py プロジェクト: zenglg/virt-manager
    def test_recommended_resources(self):
        conn = utils.URIs.open_testdefault_cached()
        guest = Guest(conn)
        res = OSDB.lookup_os("generic").get_recommended_resources()
        self.assertEqual(res.get_recommended_ram(guest.os.arch), None)

        res = OSDB.lookup_os("fedora21").get_recommended_resources()
        self.assertEqual(res.get_recommended_ncpus(guest.os.arch), 2)
コード例 #6
0
    def test_drivers(self):
        win7 = OSDB.lookup_os("win7")
        generic = OSDB.lookup_os("generic")
        self.assertFalse(generic.supports_unattended_drivers("x86_64"))
        self.assertTrue(win7.supports_unattended_drivers("x86_64"))
        self.assertFalse(win7.supports_unattended_drivers("fakearch"))
        self.assertTrue(win7.get_pre_installable_drivers_location("x86_64"))

        # Just call this for code coverage. Values differ by osinfo-db version
        win7.get_post_installable_drivers_location("x86_64")
コード例 #7
0
ファイル: osdict.py プロジェクト: zz38/virt-manager
    def test_recommended_resources(self):
        conn = utils.URIs.open_testdefault_cached()
        guest = Guest(conn)
        assert not OSDB.lookup_os("generic").get_recommended_resources(guest)

        res = OSDB.lookup_os("fedora21").get_recommended_resources(guest)
        assert res["n-cpus"] == 2

        guest.type = "qemu"
        res = OSDB.lookup_os("fedora21").get_recommended_resources(guest)
        assert res["n-cpus"] == 1
コード例 #8
0
ファイル: osdict.py プロジェクト: virt-manager/virt-manager
    def test_recommended_resources(self):
        conn = utils.URIs.open_testdefault_cached()
        guest = Guest(conn)
        assert not OSDB.lookup_os("generic").get_recommended_resources(guest)

        res = OSDB.lookup_os("fedora21").get_recommended_resources(guest)
        assert res["n-cpus"] == 2

        guest.type = "qemu"
        res = OSDB.lookup_os("fedora21").get_recommended_resources(guest)
        assert res["n-cpus"] == 1
コード例 #9
0
ファイル: osdict.py プロジェクト: yen3/virt-manager
    def test_recommended_resources(self):
        conn = utils.open_testdriver()
        guest = conn.caps.lookup_virtinst_guest()
        assert not OSDB.lookup_os("generic").get_recommended_resources(guest)

        res = OSDB.lookup_os("fedora21").get_recommended_resources(guest)
        assert res["n-cpus"] == 2

        guest.type = "qemu"
        res = OSDB.lookup_os("fedora21").get_recommended_resources(guest)
        assert res["n-cpus"] == 1
コード例 #10
0
    def test_tree_url(self):
        f26 = OSDB.lookup_os("fedora26")
        winxp = OSDB.lookup_os("winxp")

        # Valid tree URL
        assert "fedoraproject.org" in f26.get_location("x86_64")

        # Has tree URLs, but none for arch
        try:
            f26.get_location("ia64")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "ia64" in str(e)

        # Has no tree URLs
        try:
            winxp.get_location("x86_64")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert str(e).endswith("URL location")
コード例 #11
0
ファイル: osdict.py プロジェクト: rffontenelle/virt-manager
    def test_get_script(self):
        dos = OSDB.lookup_os("msdos6.22")
        winxp = OSDB.lookup_os("winxp")

        # No install scripts at all
        try:
            dos.get_install_script("desktop")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "does not support unattended installation." in str(e)

        # No profile foobar
        try:
            winxp.get_install_script("foobar")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "foobar" in str(e)

        script = winxp.get_install_script("desktop")
        self.assertTrue(bool(script))
コード例 #12
0
ファイル: osdict.py プロジェクト: virt-manager/virt-manager
    def test_get_script(self):
        dos = OSDB.lookup_os("msdos6.22")
        winxp = OSDB.lookup_os("winxp")

        # No install scripts at all
        try:
            dos.get_install_script("desktop")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "does not support unattended installation." in str(e)

        # No profile foobar
        try:
            winxp.get_install_script("foobar")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "foobar" in str(e)

        script = winxp.get_install_script("desktop")
        self.assertTrue(bool(script))
コード例 #13
0
ファイル: osdict.py プロジェクト: virt-manager/virt-manager
    def test_tree_url(self):
        f26 = OSDB.lookup_os("fedora26")
        winxp = OSDB.lookup_os("winxp")

        # Valid tree URL
        assert "fedoraproject.org" in f26.get_location("x86_64")

        # Has tree URLs, but none for arch
        try:
            f26.get_location("ia64")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "ia64" in str(e)

        # Has no tree URLs
        try:
            winxp.get_location("x86_64")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert str(e).endswith("URL location")
コード例 #14
0
def test_urldetct_matching_distros():
    # pylint: disable=protected-access
    allstores = urldetect._build_distro_list(OSDB.lookup_os("generic"))

    seen_distro = []
    for store in allstores:
        for distro in store.matching_distros:
            if distro in seen_distro:
                raise xmlutil.DevError(
                    "store=%s has conflicting matching_distro=%s " %
                    (store.PRETTY_NAME, distro))
            seen_distro.append(distro)
コード例 #15
0
    def test_tree_url(self):
        f26 = OSDB.lookup_os("fedora26")
        winxp = OSDB.lookup_os("winxp")

        # Valid tree URL
        assert "fedoraproject.org" in f26.get_location("x86_64")

        # Has tree URLs, but none for arch
        try:
            f26.get_location("ia64")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert "ia64" in str(e)

        # Has no tree URLs
        try:
            winxp.get_location("x86_64")
            raise AssertionError("Expected failure")
        except RuntimeError as e:
            assert str(e).endswith("URL location")

        # Trigger an error path for code coverage
        self.assertEqual(OSDB.guess_os_by_tree(os.getcwd()), None)
コード例 #16
0
def _sanitize_osdict_name(detectdistro):
    """
    Try to handle working with out of date osinfo-db data. Like if
    checking distro FedoraXX but osinfo-db latest Fedora is
    FedoraXX-1, convert to use that
    """
    if not detectdistro:
        return detectdistro

    if detectdistro == "testsuite-fedora-rawhide":
        # Special value we use in the test suite to always return the latest
        # fedora when checking rawhide URL
        return OSDB.latest_fedora_version()

    if re.match("fedora[0-9]+", detectdistro):
        if not OSDB.lookup_os(detectdistro):
            ret = OSDB.latest_fedora_version()
            print("\nConverting detectdistro=%s to latest value=%s" %
                  (detectdistro, ret))
            return ret

    return detectdistro
コード例 #17
0
 def _c(name):
     osobj = OSDB.lookup_os(name)
     if not osobj:
         pytest.skip("osinfo-db doesn't have '%s'" % name)
     return osobj.get_kernel_url_arg()
コード例 #18
0
ファイル: test_osdict.py プロジェクト: zenglg/virt-manager
 def test_related_to(self):
     # pylint: disable=protected-access
     win10 = OSDB.lookup_os("win10")
     self.assertTrue(win10._is_related_to("winxp"))
     self.assertTrue(win10._is_related_to("win10"))
     self.assertTrue(win10._is_related_to("fedora26") is False)
コード例 #19
0
def test_related_to():
    # pylint: disable=protected-access
    win10 = OSDB.lookup_os("win10")
    assert win10._is_related_to("winxp") is True
    assert win10._is_related_to("win10") is True
    assert win10._is_related_to("fedora26") is False