mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Revised tests
This commit is contained in:
parent
e2bb8361cf
commit
6743cefc1c
4 changed files with 39 additions and 15 deletions
|
@ -8,16 +8,7 @@ import psutil
|
|||
import pytest
|
||||
from saltfactories.utils.tempfiles import temp_directory
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip_unless_on_linux,
|
||||
pytest.mark.skipif(
|
||||
True,
|
||||
reason=(
|
||||
"Package permissions are getting reworked in "
|
||||
"https://github.com/saltstack/salt/pull/66218"
|
||||
),
|
||||
),
|
||||
]
|
||||
pytestmark = [pytest.mark.skip_unless_on_linux]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -11,12 +11,20 @@ def test_salt_version(version, install_salt):
|
|||
"""
|
||||
Test version output from salt --version
|
||||
"""
|
||||
if install_salt.upgrade:
|
||||
install_salt.install()
|
||||
|
||||
actual = []
|
||||
test_bin = os.path.join(*install_salt.binary_paths["salt"])
|
||||
ret = install_salt.proc.run(test_bin, "--version")
|
||||
actual = ret.stdout.strip().split(" ")[:2]
|
||||
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
|
||||
|
||||
|
@ -28,6 +36,7 @@ def test_salt_versions_report_master(install_salt):
|
|||
"""
|
||||
if not install_salt.relenv and not install_salt.classic:
|
||||
pytest.skip("Unable to get the python version dynamically from tiamat builds")
|
||||
|
||||
test_bin = os.path.join(*install_salt.binary_paths["master"])
|
||||
python_bin = os.path.join(*install_salt.binary_paths["python"])
|
||||
ret = install_salt.proc.run(test_bin, "--versions-report")
|
||||
|
|
|
@ -316,3 +316,28 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set
|
|||
assert test_group == f"{test_minion_user}"
|
||||
else:
|
||||
assert test_group == f"{test_master_user}"
|
||||
|
||||
# restore to defaults to ensure further tests run fine
|
||||
ret = salt_call_cli.run(
|
||||
"--local", "file.comment_line", "/etc/salt/master", "^user:"
|
||||
)
|
||||
assert ret.returncode == 0
|
||||
|
||||
ret = salt_call_cli.run(
|
||||
"--local", "file.comment_line", "/etc/salt/minion", "^user:"
|
||||
)
|
||||
assert ret.returncode == 0
|
||||
|
||||
test_string = "\nuser: salt\n"
|
||||
ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string)
|
||||
|
||||
test_string = "\nuser: root\n"
|
||||
ret = salt_call_cli.run("--local", "file.append", "/etc/salt/minion", test_string)
|
||||
|
||||
# restart and check ownership is correct
|
||||
test_list = ["salt-api", "salt-minion", "salt-master"]
|
||||
for test_item in test_list:
|
||||
test_cmd = f"systemctl restart {test_item}"
|
||||
ret = salt_call_cli.run("--local", "cmd.run", test_cmd)
|
||||
|
||||
time.sleep(10) # allow some time for restart
|
||||
|
|
|
@ -484,7 +484,6 @@ class SaltPkgInstall:
|
|||
ret = self.proc.run("installer", "-pkg", str(pkg), "-target", "/")
|
||||
self._check_retcode(ret)
|
||||
|
||||
## DGM TBD ? if not upgrade:
|
||||
# Stop the service installed by the installer
|
||||
self.proc.run("launchctl", "disable", f"system/{service_name}")
|
||||
self.proc.run("launchctl", "bootout", "system", str(plist_file))
|
||||
|
|
Loading…
Add table
Reference in a new issue