From ba558deaa869471ceaee65aee6eb1730cbc9b92e Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 29 Aug 2024 14:08:56 -0600 Subject: [PATCH] Altered debugging --- .../pytests/pkg/integration/test_salt_user.py | 44 ++++++++++----- tests/pytests/pkg/integration/test_version.py | 55 ++++++++++--------- 2 files changed, 58 insertions(+), 41 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index bb79e9f5293..99228d74304 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -2,13 +2,15 @@ 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, ] @@ -92,20 +94,20 @@ def test_salt_user_master(install_salt, salt_master): """ Test the correct user is running the Salt Master """ - 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 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) - print( - f"DGM test_salt_user_master, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM test_salt_user_master, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'", + ## DGM flush=True, + ## DGM ) assert salt_master.is_running() match = False @@ -193,6 +195,12 @@ def test_pkg_paths( assert pkg_path.exists() for dirpath, sub_dirs, files in os.walk(pkg_path): path = pathlib.Path(dirpath) + + print( + f"DGM test_pkg_paths, dirpath '{str(dirpath)}', path '{str(path)}', path owner '{path.owner()}', path group '{path.group()}'", + flush=True, + ) + # Directories owned by salt:salt or their subdirs/files if ( str(path) in pkg_paths_salt_user or str(path) in salt_user_subdirs @@ -206,6 +214,10 @@ def test_pkg_paths( for file in files: file_path = path.joinpath(file) 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: @@ -216,6 +228,10 @@ def test_pkg_paths( continue file_path = path.joinpath(file) # Individual files owned by salt user + print( + f"DGM test_pkg_paths, root:root file_path '{str(file_path)}', file_path owner '{file_path.owner()}', file_path group '{file_path.group()}'", + flush=True, + ) if str(file_path) in pkg_paths_salt_user: assert file_path.owner() == "salt" else: diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 01225dd2e6b..ff78ee080b6 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -1,11 +1,12 @@ 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): @@ -60,38 +61,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 - 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 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) - print( - f"DGM test_salt_user_minion, salt_minion '{salt_minion}' and is_running '{salt_minion.is_running()}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM test_salt_user_minion, salt_minion '{salt_minion}' and is_running '{salt_minion.is_running()}'", + ## DGM flush=True, + ## DGM ) assert salt_minion.is_running() # DGM # Make sure the master is running - 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 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) - print( - f"DGM test_salt_user_minion, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM test_salt_user_minion, salt_master '{salt_master}' and is_running '{salt_master.is_running()}'", + ## DGM flush=True, + ## DGM ) assert salt_master.is_running() ret = salt_call_cli.run("--local", "test.ping")