test_urls: Always check for distro value

This commit is contained in:
Cole Robinson 2018-10-18 13:43:12 -04:00
parent cd122b9387
commit 49f469a034
2 changed files with 8 additions and 16 deletions

View File

@ -170,8 +170,7 @@ distro = ubuntu16.04
[ubuntu17.10]
url = http://us.archive.ubuntu.com/ubuntu/dists/artful/main/installer-amd64
testxen = 1
# No entry in libosinfo yet
#distro = ubuntu17.10
distro = ubuntu17.10

View File

@ -120,13 +120,8 @@ def _storeForDistro(fetcher, guest):
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 in ["none", "None", None]:
return None
if detectdistro == "testsuite-fedora-rawhide":
# Special value we use in the test suite to always return the latest
@ -149,9 +144,6 @@ def _testURL(fetcher, testdata):
if testdata.testshortcircuit:
hvmguest.set_os_name(detectdistro)
xenguest.set_os_name(detectdistro)
else:
hvmguest.set_os_name("generic")
xenguest.set_os_name("generic")
try:
hvmstore = _storeForDistro(fetcher, hvmguest)
@ -165,8 +157,10 @@ def _testURL(fetcher, testdata):
(distname, fetcher.location, "".join(traceback.format_exc())))
for s in [hvmstore, xenstore]:
if (s and testdata.distroclass and
not isinstance(s, testdata.distroclass)):
if not s:
continue
if not isinstance(s, testdata.distroclass):
raise AssertionError("Unexpected URLDistro class:\n"
"found = %s\n"
"expect = %s\n\n"
@ -176,8 +170,7 @@ def _testURL(fetcher, testdata):
fetcher.location))
# Make sure the stores are reporting correct distro name/variant
if (s and detectdistro and
detectdistro != s.get_osdict_info()):
if detectdistro != s.get_osdict_info():
raise AssertionError(
"Detected OS did not match expected values:\n"
"found = %s\n"