Provide fmw_source contextual variable
Previously, we would use the $VERSION$ variable to create a header string, such as Fedora 44, that would refer to a column in the test matrices. However, how the variable was provided made us unable to report to a column such as Flathub. This adds a different mechanism that provides a correct string based on the environment where the test is running, be it Fedora XX or Flathub, to the report.py and modifies the tests in test_report.py to cover this change. Fixes: quality/os-autoinst-distri-fedora#529
This commit is contained in:
parent
634422ee01
commit
e77a5ced0d
3 changed files with 16 additions and 3 deletions
|
|
@ -679,9 +679,10 @@ TESTCASES = {
|
|||
},
|
||||
"QA:Testcase_USB_fmw": {
|
||||
"section": "Fedora Media Writer",
|
||||
"env": "Fedora $VERSION$",
|
||||
"env": "$FMW_SOURCE$",
|
||||
"type": "Installation",
|
||||
}
|
||||
},
|
||||
|
||||
# "": {
|
||||
# "name": "", # optional, use when same testcase occurs on multiple rows with different link text
|
||||
# "section": "", # optional, some result pages have no sections
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ def _uniqueres_replacements(job, tcdict):
|
|||
version = job['settings'].get('VERSION', '')
|
||||
if version == "Rawhide":
|
||||
version = job['settings'].get('RAWREL', '')
|
||||
# For Fedora Media Writer, version is not enough because we also need to
|
||||
# to report to the Flathub column (which does not have version in it), so
|
||||
# if CANNED is set, let's change the string to "Flathub".
|
||||
fmw_source = f"Fedora {version}"
|
||||
if job["settings"].get('CANNED', ''):
|
||||
fmw_source = "Flathub"
|
||||
if arch == "aarch64":
|
||||
bootmethod = "aarch64"
|
||||
firmware = "UEFI"
|
||||
|
|
@ -124,8 +130,8 @@ def _uniqueres_replacements(job, tcdict):
|
|||
value = value.replace('$MEDIUM$', medium)
|
||||
value = value.replace('$BASE_SECTION$', base_section)
|
||||
value = value.replace('$VERSION$', version)
|
||||
value = value.replace('$FMW_SOURCE$', fmw_source)
|
||||
changed[key] = value
|
||||
|
||||
return changed
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ def test_uniqueres_replacements(jobdict01):
|
|||
"medium": "$MEDIUM$",
|
||||
"base_section": "$BASE_SECTION$",
|
||||
"version": "$VERSION$",
|
||||
"fmw_source": "$FMW_SOURCE$",
|
||||
}
|
||||
origbase = copy.deepcopy(basedict)
|
||||
ret = fosreport._uniqueres_replacements(jobdict01, basedict)
|
||||
|
|
@ -72,6 +73,7 @@ def test_uniqueres_replacements(jobdict01):
|
|||
# this is a Server dict so we get release-blocking
|
||||
assert ret['base_section'] == "Release-blocking environments (x86_64)"
|
||||
assert ret['version'] == "27"
|
||||
assert ret['fmw_source'] == "Fedora 27"
|
||||
# basedict should not be modified
|
||||
assert basedict == origbase
|
||||
|
||||
|
|
@ -133,6 +135,10 @@ def test_uniqueres_replacements(jobdict01):
|
|||
ret = fosreport._uniqueres_replacements(jobdict01, basedict)
|
||||
assert ret['base_section'] == 'RPM-based non-blocking environments (x86_64)'
|
||||
|
||||
# Correct version (fmw_source) string for CANNED
|
||||
with mock.patch.dict(jobdict01['settings'], {'CANNED': '1'}):
|
||||
ret = fosreport._uniqueres_replacements(jobdict01, basedict)
|
||||
assert ret["fmw_source"] == "Flathub"
|
||||
|
||||
class TestGetPassedTcNames:
|
||||
"""Tests for _get_passed_tcnames."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue