From a5a5ca9081273d836897317b4062f578443ccc8a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 19 Jun 2024 17:43:15 -0600 Subject: [PATCH] Updated version comparsion and to ignore ipc files --- .../pytests/pkg/integration/test_salt_user.py | 3 +++ tests/pytests/pkg/integration/test_version.py | 23 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 347215e25ca..400ed09dca0 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -137,6 +137,7 @@ def test_pkg_paths( ): pytest.skip("Package path ownership was changed in salt 3006.4") salt_user_subdirs = [] + for _path in pkg_paths: pkg_path = pathlib.Path(_path) assert pkg_path.exists() @@ -161,6 +162,8 @@ def test_pkg_paths( assert path.owner() == "root" assert path.group() == "root" for file in files: + if file.endswith("ipc"): + continue file_path = path.joinpath(file) # Individual files owned by salt user if str(file_path) in pkg_paths_salt_user: diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index c484684b9d5..936f6da9aa9 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -14,16 +14,21 @@ def test_salt_version(version, install_salt): actual = [] test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") - actual_ver = ret.stdout.strip().split(" ")[:2] - actual_ver_salt = actual_ver[1] # get salt version - if "+" in actual_ver_salt: - actual_ver_salt_stripped = actual_ver_salt.split("+")[ - 0 - ] # strip any git versioning - actual.append(actual_ver[0]) - actual.append(actual_ver_salt_stripped) + if "+" in version: + # testing a non-release build artifact version + actual = ret.stdout.strip().split(" ")[:2] else: - pytest.skip("Not testing a non-release build artifact, do not run") + # testing against release build version, for example: downgrade + actual_ver = ret.stdout.strip().split(" ")[:2] + actual_ver_salt = actual_ver[1] # get salt version + if "+" in actual_ver_salt: + actual_ver_salt_stripped = actual_ver_salt.split("+")[ + 0 + ] # strip any git versioning + actual.append(actual_ver[0]) + actual.append(actual_ver_salt_stripped) + else: + pytest.skip("Not testing a non-release build artifact, do not run") expected = ["salt", version] assert actual == expected