Cleanup of debug, and revision of tests

This commit is contained in:
David Murphy 2024-06-13 14:54:37 -06:00 committed by Daniel Wozniak
parent c21f67b915
commit 82070dc46d
12 changed files with 8 additions and 102 deletions

View file

@ -2,8 +2,6 @@
. /usr/share/debconf/confmodule
echo "DGM salt-api.postinst dollar $@"
case "$1" in
configure)
db_get salt-api/user

View file

@ -2,10 +2,6 @@
. /usr/share/debconf/confmodule
## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership
echo "DGM salt-api.preinst dollar $@"
case "$1" in
upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt

View file

@ -2,8 +2,6 @@
. /usr/share/debconf/confmodule
echo "DGM salt-cloud.postinst dollar $@"
case "$1" in
configure)
db_get salt-master/user

View file

@ -2,8 +2,6 @@
. /usr/share/debconf/confmodule
echo "DGM salt-master.postinst dollar $@"
case "$1" in
configure)
db_get salt-master/user

View file

@ -2,11 +2,6 @@
. /usr/share/debconf/confmodule
## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership
echo "DGM salt-master.preinst dollar $@"
case "$1" in
install)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt

View file

@ -2,8 +2,6 @@
. /usr/share/debconf/confmodule
echo "DGM salt-minion.postinst dollar $@"
case "$1" in
configure)
db_get salt-minion/user

View file

@ -2,10 +2,6 @@
. /usr/share/debconf/confmodule
## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership
echo "DGM salt-minion.preinst dollar $@"
case "$1" in
upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt

View file

@ -1,7 +1,5 @@
import packaging.version
import psutil
## DGM import pytest
from pytestskipmarkers.utils import platform
@ -89,66 +87,3 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt):
# test pip install after a downgrade
use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo)
assert "Authentication information could" in use_lib.stderr
## DGM @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family")
## DGM def test_salt_downgrade_master(install_salt):
## DGM """
## DGM Test an downgrade of Salt Master.
## DGM """
## DGM if not install_salt.downgrade:
## DGM pytest.skip("Not testing a downgrade, do not run")
## DGM
## DGM is_downgrade_to_relenv = packaging.version.parse(
## DGM install_salt.prev_version
## DGM ) >= packaging.version.parse("3006.0")
## DGM
## DGM if is_downgrade_to_relenv:
## DGM original_py_version = install_salt.package_python_version()
## DGM
## DGM # Verify current install version is setup correctly and works
## DGM bin_file = "salt"
## DGM ret = install_salt.proc.run(bin_file, "--version")
## DGM assert ret.returncode == 0
## DGM assert packaging.version.parse(
## DGM ret.stdout.strip().split()[1]
## DGM ) == packaging.version.parse(install_salt.artifact_version)
## DGM
## DGM # Verify there is a running master by getting its PID
## DGM salt_name = "salt"
## DGM process_name = "salt-master"
## DGM
## DGM old_pid = []
## DGM
## DGM # psutil process name only returning first part of the command '/opt/saltstack/'
## DGM # need to check all of command line for salt-minion
## DGM # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher']
## DGM # and psutil is only returning the salt-minion once
## DGM for proc in psutil.process_iter():
## DGM if salt_name in proc.name():
## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline())
## DGM if process_name in cmdl_strg:
## DGM old_pid.append(proc.pid)
## DGM
## DGM assert old_pid
## DGM
## DGM # Downgrade Salt to the previous version and test
## DGM install_salt.install(downgrade=True)
## DGM
## DGM # Verify there is a new running master by getting its PID and comparing it
## DGM # with the PID from before the upgrade
## DGM new_pid = []
## DGM for proc in psutil.process_iter():
## DGM if salt_name in proc.name():
## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline())
## DGM if process_name in cmdl_strg:
## DGM new_pid.append(proc.pid)
## DGM
## DGM assert new_pid
## DGM assert new_pid != old_pid
## DGM
## DGM ret = install_salt.proc.run(bin_file, "--version")
## DGM assert ret.returncode == 0
## DGM assert packaging.version.parse(
## DGM ret.stdout.strip().split()[1]
## DGM ) < packaging.version.parse(install_salt.artifact_version)

View file

@ -3,11 +3,12 @@ from pytestskipmarkers.utils import platform
@pytest.mark.skip_on_windows(reason="Linux test only")
def test_services(install_salt, salt_cli, salt_minion, salt_call_cli):
def test_services(install_salt, salt_call_cli):
"""
Check if Services are enabled/disabled
"""
install_salt.install()
if not install_salt.upgrade:
install_salt.install()
services_disabled = []
services_enabled = []

View file

@ -9,15 +9,7 @@ import pytest
from saltfactories.utils.tempfiles import temp_directory
pytestmark = [
pytest.mark.skip_on_windows,
pytest.mark.skip_on_darwin,
## DGM pytest.mark.skipif(
## DGM True,
## DGM reason=(
## DGM "Package permissions are getting reworked in "
## DGM "https://github.com/saltstack/salt/pull/66218"
## DGM ),
## DGM ),
pytest.mark.skip_unless_on_linux,
]

View file

@ -484,11 +484,10 @@ class SaltPkgInstall:
ret = self.proc.run("installer", "-pkg", str(pkg), "-target", "/")
self._check_retcode(ret)
## DGM TBD why stop service on upgrade ???
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))
## 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))
elif upgrade:
env = os.environ.copy()