Further debugging

This commit is contained in:
David Murphy 2024-09-03 16:30:53 -06:00 committed by Daniel Wozniak
parent ba558deaa8
commit 067ee3ca04
2 changed files with 73 additions and 49 deletions

View file

@ -2,15 +2,13 @@ import os
import pathlib
import subprocess
import sys
import time
import packaging.version
import psutil
import pytest
from saltfactories.utils.tempfiles import temp_directory
## DGM import time
pytestmark = [
pytest.mark.skip_unless_on_linux,
]
@ -94,20 +92,20 @@ def test_salt_user_master(install_salt, salt_master):
"""
Test the correct user is running the Salt Master
"""
## DGM for count in range(0, 30):
## DGM if salt_master.is_running():
## DGM print(
## DGM f"DGM test_salt_user_master, salt_master is_running, count '{count}'",
## DGM flush=True,
## DGM )
## DGM break
## DGM else:
## DGM time.sleep(2)
for count in range(0, 30):
if salt_master.is_running():
print(
f"DGM test_salt_user_master, salt_master is_running, count '{count}'",
flush=True,
)
break
else:
time.sleep(2)
## DGM print(
## DGM f"DGM test_salt_user_master, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'",
## DGM flush=True,
## DGM )
print(
f"DGM test_salt_user_master, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'",
flush=True,
)
assert salt_master.is_running()
match = False
@ -179,6 +177,7 @@ def test_pkg_paths(
pkg_paths,
pkg_paths_salt_user,
pkg_paths_salt_user_exclusions,
salt_call_cli,
):
"""
Test package paths ownership
@ -190,6 +189,32 @@ def test_pkg_paths(
salt_user_subdirs = []
print(
f"DGM test_pkg_paths, pkg_paths '{pkg_paths}', pkg_paths_salt_user '{pkg_paths_salt_user}', exclusions '{pkg_paths_salt_user_exclusions}'",
flush=True,
)
dgm_cmd = "ps -ef"
ret = salt_call_cli("--local", "cmd.run", dgm_cmd)
print(
f"DGM test_pkg_paths, test ps -ef, ret '{ret}'",
flush=True,
)
dgm_cmd = "ls -al /var/log/"
ret = salt_call_cli("--local", "cmd.run", dgm_cmd)
print(
f"DGM test_pkg_paths, test ls -al /var/log/, ret '{ret}'",
flush=True,
)
dgm_cmd = "ls -al /var/log/salt"
ret = salt_call_cli("--local", "cmd.run", dgm_cmd)
print(
f"DGM test_pkg_paths, test ls -al /var/log/salt, ret '{ret}'",
flush=True,
)
for _path in pkg_paths:
pkg_path = pathlib.Path(_path)
assert pkg_path.exists()
@ -197,7 +222,7 @@ def test_pkg_paths(
path = pathlib.Path(dirpath)
print(
f"DGM test_pkg_paths, dirpath '{str(dirpath)}', path '{str(path)}', path owner '{path.owner()}', path group '{path.group()}'",
f"DGM test_pkg_paths, dirpath '{str(dirpath)}', path '{str(path)}', path owner '{path.owner()}', path group '{path.group()}', salt_user_subdirs '{salt_user_subdirs}', sub_dirs '{sub_dirs}', files '{files}'",
flush=True,
)
@ -213,11 +238,11 @@ def test_pkg_paths(
# Individual files owned by salt user
for file in files:
file_path = path.joinpath(file)
print(
f"DGM test_pkg_paths, salt:salt file_path '{str(file_path)}', file_path owner '{file_path.owner()}', file_path group '{file_path.group()}'",
flush=True,
)
if str(file_path) not in pkg_paths_salt_user_exclusions:
print(
f"DGM test_pkg_paths, salt:salt file_path '{str(file_path)}', file_path owner '{file_path.owner()}', file_path group '{file_path.group()}'",
flush=True,
)
assert file_path.owner() == "salt"
# Directories owned by root:root
else:

View file

@ -1,12 +1,11 @@
import os.path
import pathlib
import subprocess
import time
import pytest
from pytestskipmarkers.utils import platform
## DGM import time
@pytest.mark.skip_on_windows
def test_salt_version(version, install_salt):
@ -61,38 +60,38 @@ def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_master, salt_
Test running test.versions_report on minion
"""
# Make sure the minion is running
## DGM for count in range(0, 30):
## DGM if salt_minion.is_running():
## DGM print(
## DGM f"DGM test_salt_user_minion, salt_minion is running, final count '{count}'",
## DGM flush=True,
## DGM )
## DGM break
## DGM else:
## DGM time.sleep(2)
for count in range(0, 30):
if salt_minion.is_running():
print(
f"DGM test_salt_user_minion, salt_minion is running, final count '{count}'",
flush=True,
)
break
else:
time.sleep(2)
## DGM print(
## DGM f"DGM test_salt_user_minion, salt_minion '{salt_minion}' and is_running '{salt_minion.is_running()}'",
## DGM flush=True,
## DGM )
print(
f"DGM test_salt_user_minion, salt_minion '{salt_minion}' and is_running '{salt_minion.is_running()}'",
flush=True,
)
assert salt_minion.is_running()
# DGM
# Make sure the master is running
## DGM for count in range(0, 30):
## DGM if salt_master.is_running():
## DGM print(
## DGM f"DGM test_salt_user_minion, salt_master is running, final count '{count}'",
## DGM flush=True,
## DGM )
## DGM break
## DGM else:
## DGM time.sleep(2)
for count in range(0, 30):
if salt_master.is_running():
print(
f"DGM test_salt_user_minion, salt_master is running, final count '{count}'",
flush=True,
)
break
else:
time.sleep(2)
## DGM print(
## DGM f"DGM test_salt_user_minion, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'",
## DGM flush=True,
## DGM )
print(
f"DGM test_salt_user_minion, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'",
flush=True,
)
assert salt_master.is_running()
ret = salt_call_cli.run("--local", "test.ping")