From c21f67b9154e81a661ff90a8b64860ed5f594b54 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 13 Jun 2024 11:27:59 -0600 Subject: [PATCH] Updated tests --- .../pytests/pkg/integration/test_salt_user.py | 14 ++--- .../integration/test_systemd_permissions.py | 15 +++++ tests/pytests/pkg/integration/test_version.py | 56 ++++++++++--------- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 834fd399121..1f43fd5490e 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -11,13 +11,13 @@ from saltfactories.utils.tempfiles import temp_directory pytestmark = [ pytest.mark.skip_on_windows, pytest.mark.skip_on_darwin, - pytest.mark.skipif( - True, - reason=( - "Package permissions are getting reworked in " - "https://github.com/saltstack/salt/pull/66218" - ), - ), + ## 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 ), ] diff --git a/tests/pytests/pkg/integration/test_systemd_permissions.py b/tests/pytests/pkg/integration/test_systemd_permissions.py index b5576b75e14..0a7bf6c158a 100644 --- a/tests/pytests/pkg/integration/test_systemd_permissions.py +++ b/tests/pytests/pkg/integration/test_systemd_permissions.py @@ -34,6 +34,9 @@ def test_salt_systemd_disabled_preservation( """ Test upgrade of Salt packages preserve disabled state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -66,6 +69,9 @@ def test_salt_systemd_enabled_preservation( """ Test upgrade of Salt packages preserve enabled state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -91,6 +97,9 @@ def test_salt_systemd_inactive_preservation( """ Test upgrade of Salt packages preserve inactive state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -123,6 +132,9 @@ def test_salt_systemd_active_preservation( """ Test upgrade of Salt packages preserve active state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -146,6 +158,9 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set """ Test upgrade of Salt packages preserve existing ownership """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index aa59b5674ad..d59377c31d6 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -6,37 +6,13 @@ import pytest from pytestskipmarkers.utils import platform -@pytest.mark.skip_on_windows -def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): - """ - Test running test.versions_report on minion - """ - # Make sure the minion is running - assert salt_minion.is_running() - - # Make sure we can ping the minion ... - ret = salt_cli.run( - "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 - ) - assert ret.returncode == 0 - assert ret.data is True - ret = salt_cli.run( - "--hard-crash", - "--failhard", - "--timeout=240", - "test.versions_report", - minion_tgt=salt_minion.id, - _timeout=240, - ) - ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) - - @pytest.mark.skip_on_windows def test_salt_version(version, install_salt): """ Test version output from salt --version """ - install_salt.install() + if install_salt.upgrade: + install_salt.install() test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") @@ -65,6 +41,31 @@ def test_salt_versions_report_master(install_salt): ret.stdout.matcher.fnmatch_lines([f"*{py_version}*"]) +@pytest.mark.skip_on_windows +def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): + """ + Test running test.versions_report on minion + """ + # Make sure the minion is running + assert salt_minion.is_running() + + # Make sure we can ping the minion ... + ret = salt_cli.run( + "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 + ) + assert ret.returncode == 0 + assert ret.data is True + ret = salt_cli.run( + "--hard-crash", + "--failhard", + "--timeout=240", + "test.versions_report", + minion_tgt=salt_minion.id, + _timeout=240, + ) + ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) + + @pytest.mark.parametrize( "binary", ["master", "cloud", "syndic", "minion", "call", "api"] ) @@ -73,7 +74,8 @@ def test_compare_versions(version, binary, install_salt): Test compare versions """ if binary in install_salt.binary_paths: - install_salt.install() + if install_salt.upgrade: + install_salt.install() ret = install_salt.proc.run( *install_salt.binary_paths[binary],