Skip to content

Commit

Permalink
Updated to remove RHEL 5 support and single RHEL 6 instance too
Browse files Browse the repository at this point in the history
  • Loading branch information
David Murphy committed Jun 16, 2023
1 parent 39891e9 commit e149041
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 46 deletions.
36 changes: 14 additions & 22 deletions tests/pytests/functional/states/test_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ def PKG_32_TARGETS(grains):
_PKG_32_TARGETS = []
if grains["os_family"] == "RedHat":
if grains["os"] == "CentOS":
if grains["osmajorrelease"] == 5:
_PKG_32_TARGETS = ["xz-devel.i386"]
else:
_PKG_32_TARGETS.append("xz-devel.i686")
_PKG_32_TARGETS.append("xz-devel.i686")
if not _PKG_32_TARGETS:
pytest.skip("No 32 bit packages have been specified for testing")
return _PKG_32_TARGETS
Expand All @@ -88,11 +85,7 @@ def PKG_32_TARGETS(grains):
def PKG_DOT_TARGETS(grains):
_PKG_DOT_TARGETS = []
if grains["os_family"] == "RedHat":
if grains["osmajorrelease"] == 5:
_PKG_DOT_TARGETS = ["python-migrate0.5"]
elif grains["osmajorrelease"] == 6:
_PKG_DOT_TARGETS = ["tomcat6-el-2.1-api"]
elif grains["osmajorrelease"] == 7:
if grains["osmajorrelease"] == 7:
_PKG_DOT_TARGETS = ["tomcat-el-2.2-api"]
elif grains["osmajorrelease"] == 8:
_PKG_DOT_TARGETS = ["aspnetcore-runtime-6.0"]
Expand Down Expand Up @@ -455,9 +448,10 @@ def test_pkg_011_latest_only_upgrade(
new_version = modules.pkg.version(target, use_context=False)
assert new_version == updates[target]
ret = states.pkg.latest(name=target, refresh=False, only_upgrade=True)
assert ret.raw["pkg_|-{0}_|-{0}_|-latest".format(target)][
"comment"
] == "Package {} is already up-to-date".format(target)
assert (
ret.raw["pkg_|-{0}_|-{0}_|-latest".format(target)]["comment"]
== f"Package {target} is already up-to-date"
)


@pytest.mark.usefixtures("WILDCARDS_SUPPORTED")
Expand Down Expand Up @@ -605,7 +599,7 @@ def test_pkg_015_installed_held(grains, modules, states, PKG_TARGETS):
except AssertionError as exc:
log.debug("Versionlock package not found:\n%s", exc)
else:
pytest.fail("Could not install versionlock package from {}".format(pkgs))
pytest.fail(f"Could not install versionlock package from {pkgs}")

target = PKG_TARGETS[0]

Expand All @@ -624,7 +618,7 @@ def test_pkg_015_installed_held(grains, modules, states, PKG_TARGETS):
)

if versionlock_pkg and "-versionlock is not installed" in str(ret):
pytest.skip("{} `{}` is installed".format(ret, versionlock_pkg))
pytest.skip(f"{ret} `{versionlock_pkg}` is installed")

# changes from pkg.hold for Red Hat family are different
target_changes = {}
Expand Down Expand Up @@ -724,7 +718,7 @@ def test_pkg_017_installed_held_equals_false(grains, modules, states, PKG_TARGET
except AssertionError as exc:
log.debug("Versionlock package not found:\n%s", exc)
else:
pytest.fail("Could not install versionlock package from {}".format(pkgs))
pytest.fail(f"Could not install versionlock package from {pkgs}")

target = PKG_TARGETS[0]

Expand All @@ -737,7 +731,7 @@ def test_pkg_017_installed_held_equals_false(grains, modules, states, PKG_TARGET
assert target_ret.result is True

if versionlock_pkg and "-versionlock is not installed" in str(target_ret):
pytest.skip("{} `{}` is installed".format(target_ret, versionlock_pkg))
pytest.skip(f"{target_ret} `{versionlock_pkg}` is installed")

try:
tag = "pkg_|-{0}_|-{0}_|-installed".format(target)
Expand Down Expand Up @@ -789,7 +783,7 @@ def test_pkg_cap_001_installed(PKG_CAP_TARGETS, modules, states):
test=True,
)
assert (
"The following packages would be installed/updated: {}".format(realpkg)
f"The following packages would be installed/updated: {realpkg}"
in ret.comment
)
ret = states.pkg.installed(
Expand Down Expand Up @@ -887,7 +881,7 @@ def test_pkg_cap_003_installed_multipkg_with_version(
test=True,
)
assert "packages would be installed/updated" in ret.comment
assert "{}={}".format(realpkg, realver) in ret.comment
assert f"{realpkg}={realver}" in ret.comment

ret = states.pkg.installed(
name="test_pkg_cap_003_installed_multipkg_with_version-install-capability",
Expand Down Expand Up @@ -931,7 +925,7 @@ def test_pkg_cap_004_latest(PKG_CAP_TARGETS, modules, states):
test=True,
)
assert (
"The following packages would be installed/upgraded: {}".format(realpkg)
f"The following packages would be installed/upgraded: {realpkg}"
in ret.comment
)
ret = states.pkg.latest(name=target, refresh=False, resolve_capabilities=True)
Expand Down Expand Up @@ -971,9 +965,7 @@ def test_pkg_cap_005_downloaded(PKG_CAP_TARGETS, modules, states):
resolve_capabilities=True,
test=True,
)
assert (
"The following packages would be downloaded: {}".format(realpkg) in ret.comment
)
assert f"The following packages would be downloaded: {realpkg}" in ret.comment

ret = states.pkg.downloaded(name=target, refresh=False, resolve_capabilities=True)
assert ret.result is True
Expand Down
24 changes: 0 additions & 24 deletions tests/pytests/unit/modules/test_groupadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@ def test_adduser():
Tests if specified user gets added in the group.
"""
os_version_list = [
{
"grains": {
"kernel": "Linux",
"os_family": "RedHat",
"osmajorrelease": "5",
},
"cmd": ["/bin/gpasswd", "-a", "root", "test"],
},
{
"grains": {
"kernel": "Linux",
Expand Down Expand Up @@ -242,14 +234,6 @@ def test_deluser():
Tests if specified user gets deleted from the group.
"""
os_version_list = [
{
"grains": {
"kernel": "Linux",
"os_family": "RedHat",
"osmajorrelease": "5",
},
"cmd": ["/bin/gpasswd", "-d", "root", "test"],
},
{
"grains": {
"kernel": "Linux",
Expand Down Expand Up @@ -325,14 +309,6 @@ def test_members():
Tests if members of the group, get replaced with a provided list.
"""
os_version_list = [
{
"grains": {
"kernel": "Linux",
"os_family": "RedHat",
"osmajorrelease": "5",
},
"cmd": ["/bin/gpasswd", "-M", "foo", "test"],
},
{
"grains": {
"kernel": "Linux",
Expand Down

0 comments on commit e149041

Please sign in to comment.