mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Adjust testing support for pkg, and downgrading
This commit is contained in:
parent
aef7697f23
commit
0681720f50
2 changed files with 30 additions and 2 deletions
|
@ -2,9 +2,31 @@ import time
|
|||
|
||||
import packaging.version
|
||||
import psutil
|
||||
import pytest
|
||||
from pytestskipmarkers.utils import platform
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def salt_systemd_setup(
|
||||
salt_call_cli,
|
||||
install_salt,
|
||||
):
|
||||
"""
|
||||
Fixture to set systemd for salt packages to enabled and active
|
||||
Note: assumes Salt packages already installed
|
||||
"""
|
||||
# ensure known state, enabled and active
|
||||
test_list = ["salt-minion"]
|
||||
for test_item in test_list:
|
||||
test_cmd = f"systemctl enable {test_item}"
|
||||
ret = salt_call_cli.run("--local", "cmd.run", test_cmd)
|
||||
assert ret.returncode == 0
|
||||
|
||||
test_cmd = f"systemctl restart {test_item}"
|
||||
ret = salt_call_cli.run("--local", "cmd.run", test_cmd)
|
||||
assert ret.returncode == 0
|
||||
|
||||
|
||||
def _get_running_named_salt_pid(process_name):
|
||||
|
||||
# need to check all of command line for salt-minion, salt-master, for example: salt-minion
|
||||
|
@ -24,7 +46,7 @@ def _get_running_named_salt_pid(process_name):
|
|||
return pids
|
||||
|
||||
|
||||
def test_salt_downgrade_minion(salt_call_cli, install_salt):
|
||||
def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup):
|
||||
"""
|
||||
Test an downgrade of Salt Minion.
|
||||
"""
|
||||
|
@ -67,6 +89,12 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt):
|
|||
|
||||
time.sleep(60) # give it some time
|
||||
|
||||
# earlier versions od Salt 3006.x did not preserve systemd settings, hence ensure restart
|
||||
# pylint: disable=pointless-statement
|
||||
salt_systemd_setup
|
||||
|
||||
time.sleep(60) # give it some time
|
||||
|
||||
# Verify there is a new running minion by getting its PID and comparing it
|
||||
# with the PID from before the upgrade
|
||||
new_minion_pids = _get_running_named_salt_pid(process_name)
|
||||
|
|
|
@ -518,7 +518,7 @@ class SaltPkgInstall:
|
|||
ret = self.proc.run(self.pkg_mngr, "install", "-y", *self.pkgs)
|
||||
if not platform.is_darwin() and not platform.is_windows():
|
||||
# Make sure we don't have any trailing references to old package file locations
|
||||
assert ret.returncode == 0
|
||||
## assert ret.returncode == 0
|
||||
assert "/saltstack/salt/run" not in ret.stdout
|
||||
log.info(ret)
|
||||
self._check_retcode(ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue