Skip to content

Commit

Permalink
Convert RHEL 7 to -> RHEL 10 in test_matches_platform.py
Browse files Browse the repository at this point in the history
RHEL 7 will no longer match since it is removed
  • Loading branch information
Mab879 committed Jun 25, 2024
1 parent ffefb49 commit 52940d2
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions tests/unit/ssg_test_suite/test_matches_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,53 @@


def test_simple_match():
scenario_platforms = ["Red Hat Enterprise Linux 7"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7"}
scenario_platforms = ["Red Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True


def test_simple_no_match():
scenario_platforms = ["Red Hat Enterprise Linux 7"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:8"}
scenario_platforms = ["Red Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:9"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is False


def test_multi_platform_all():
scenario_platforms = ["multi_platform_all"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7"}
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True


def test_multi_platform_match():
scenario_platforms = ["multi_platform_rhel"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7"}
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True


def test_multi_platform_no_match():
scenario_platforms = ["multi_platform_fedora"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7"}
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is False


def test_list_simple_match_first():
scenario_platforms = ["Red Hat Enterprise Linux 7",
"Red Hat Enterprise Linux 8"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7"}
scenario_platforms = ["Red Hat Enterprise Linux 9",
"Red Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:9"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True


def test_list_simple_match_second():
scenario_platforms = ["Red Hat Enterprise Linux 7",
"Red Hat Enterprise Linux 8"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:8"}
scenario_platforms = ["Red Hat Enterprise Linux 9",
"Red Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True


def test_list_simple_no_match():
scenario_platforms = ["Red Hat Enterprise Linux 7",
"Red Hat Enterprise Linux 8"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:9"}
scenario_platforms = ["Red Hat Enterprise Linux 8",
"Red Hat Enterprise Linux 9"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is False


Expand Down Expand Up @@ -94,38 +94,38 @@ def test_list_combined_no_match():


def test_simple_multiple_unrelated_benchmark_cpes():
scenario_platforms = ["Red Hat Enterprise Linux 7"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7",
"cpe:/o:redhat:enterprise_linux:8"}
scenario_platforms = ["Red Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:9",
"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True


def test_simple_multiple_bogus_benchmark_cpes():
scenario_platforms = ["Red Hat Enterprise Linux 7"]
scenario_platforms = ["Red Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:abcdef:ghijklm:42"
"cpe:/o:zzzzz:xxxx:77",
"cpe:/o:redhat:enterprise_linux:7"}
"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is True

def test_simple_multiple_bogus_benchmark_cpes_no_match():
scenario_platforms = ["Fedora"]
benchmark_cpes = {"cpe:/o:abcdef:ghijklm:42"
"cpe:/o:zzzzz:xxxx:77",
"cpe:/o:redhat:enterprise_linux:7"}
"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is False


def test_multiple_multiple_bogus_benchmark_cpes_no_match():
scenario_platforms = ["Fedora", "openSUSE"]
benchmark_cpes = {"cpe:/o:abcdef:ghijklm:42"
"cpe:/o:zzzzz:xxxx:77",
"cpe:/o:redhat:enterprise_linux:7"}
"cpe:/o:redhat:enterprise_linux:10"}
assert common.matches_platform(scenario_platforms, benchmark_cpes) is False


def test_typo():
scenario_platforms = ["Rrd Hat Enterprise Linux 7"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:7"}
scenario_platforms = ["Rrd Hat Enterprise Linux 10"]
benchmark_cpes = {"cpe:/o:redhat:enterprise_linux:10"}
with pytest.raises(ValueError):
common.matches_platform(scenario_platforms, benchmark_cpes)

Expand Down

0 comments on commit 52940d2

Please sign in to comment.