mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Skip problematic tests due to system python being too recent
This commit is contained in:
parent
457dfa6f23
commit
85ea23dd62
4 changed files with 18 additions and 29 deletions
|
@ -34,18 +34,18 @@ import pytest
|
|||
from tests.support.case import SSHCase
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip_on_windows,
|
||||
pytest.mark.skipif(
|
||||
"grains['osfinger'] == 'Fedora Linux-40'",
|
||||
reason="Fedora 40 ships with Python 3.12. Test can't run with system Python on 3.12",
|
||||
'grains["osfinger"].startswith(("Fedora Linux-40", "Ubuntu-24.04", "Arch Linux"))',
|
||||
reason="System ships with a version of python that is too recent for salt-ssh tests",
|
||||
# Actually, the problem is that the tornado we ship is not prepared for Python 3.12,
|
||||
# and it imports `ssl` and checks if the `match_hostname` function is defined, which
|
||||
# has been deprecated since Python 3.7, so, the logic goes into trying to import
|
||||
# backports.ssl-match-hostname which is not installed on the system.
|
||||
)
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.skip_on_windows
|
||||
class SSHCustomModuleTest(SSHCase):
|
||||
"""
|
||||
Test sls with custom module functionality using ssh
|
||||
|
|
|
@ -12,14 +12,16 @@ from tests.support.case import SSHCase
|
|||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.slow_test,
|
||||
pytest.mark.timeout_unless_on_windows(120),
|
||||
pytest.mark.skipif(
|
||||
"grains['osfinger'] == 'Fedora Linux-40'",
|
||||
reason="Fedora 40 ships with Python 3.12. Test can't run with system Python on 3.12",
|
||||
'grains["osfinger"].startswith(("Fedora Linux-40", "Ubuntu-24.04", "Arch Linux"))',
|
||||
reason="System ships with a version of python that is too recent for salt-ssh tests",
|
||||
# Actually, the problem is that the tornado we ship is not prepared for Python 3.12,
|
||||
# and it imports `ssl` and checks if the `match_hostname` function is defined, which
|
||||
# has been deprecated since Python 3.7, so, the logic goes into trying to import
|
||||
# backports.ssl-match-hostname which is not installed on the system.
|
||||
)
|
||||
),
|
||||
]
|
||||
|
||||
SSH_SLS = "ssh_state_tests"
|
||||
|
@ -28,8 +30,6 @@ SSH_SLS_FILE = "/tmp/salt_test_file"
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.slow_test
|
||||
@pytest.mark.timeout_unless_on_windows(120)
|
||||
class SSHStateTest(SSHCase):
|
||||
"""
|
||||
testing the state system with salt-ssh
|
||||
|
@ -55,7 +55,6 @@ class SSHStateTest(SSHCase):
|
|||
exp_ret=SSH_SLS,
|
||||
)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_apply(self):
|
||||
"""
|
||||
test state.apply with salt-ssh
|
||||
|
@ -66,7 +65,6 @@ class SSHStateTest(SSHCase):
|
|||
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE])
|
||||
self.assertTrue(check_file)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_sls_id(self):
|
||||
"""
|
||||
test state.sls_id with salt-ssh
|
||||
|
@ -93,7 +91,6 @@ class SSHStateTest(SSHCase):
|
|||
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE])
|
||||
self.assertTrue(check_file)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_sls_wrong_id(self):
|
||||
"""
|
||||
test state.sls_id when id does not exist
|
||||
|
@ -102,7 +99,6 @@ class SSHStateTest(SSHCase):
|
|||
ret = self.run_function("state.sls_id", ["doesnotexist", SSH_SLS])
|
||||
assert "No matches for ID" in ret
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_sls_id_with_pillar(self):
|
||||
"""
|
||||
test state.sls_id with pillar data
|
||||
|
@ -116,7 +112,6 @@ class SSHStateTest(SSHCase):
|
|||
)
|
||||
self.assertTrue(check_file)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_show_sls(self):
|
||||
"""
|
||||
test state.show_sls with salt-ssh
|
||||
|
@ -127,7 +122,6 @@ class SSHStateTest(SSHCase):
|
|||
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE], wipe=False)
|
||||
self.assertFalse(check_file)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_show_top(self):
|
||||
"""
|
||||
test state.show_top with salt-ssh
|
||||
|
@ -154,7 +148,6 @@ class SSHStateTest(SSHCase):
|
|||
ret = self.run_function("state.show_top")
|
||||
self.assertEqual(ret, {"base": ["core", "master_tops_test"]})
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_single(self):
|
||||
"""
|
||||
state.single with salt-ssh
|
||||
|
@ -172,7 +165,6 @@ class SSHStateTest(SSHCase):
|
|||
self.assertEqual(value["result"], ret_out["result"])
|
||||
self.assertEqual(value["comment"], ret_out["comment"])
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_show_highstate(self):
|
||||
"""
|
||||
state.show_highstate with salt-ssh
|
||||
|
@ -202,7 +194,6 @@ class SSHStateTest(SSHCase):
|
|||
self.assertIn(destpath, high)
|
||||
self.assertEqual(high[destpath]["__env__"], "base")
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_high(self):
|
||||
"""
|
||||
state.high with salt-ssh
|
||||
|
@ -220,7 +211,6 @@ class SSHStateTest(SSHCase):
|
|||
self.assertEqual(value["result"], ret_out["result"])
|
||||
self.assertEqual(value["comment"], ret_out["comment"])
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_show_lowstate(self):
|
||||
"""
|
||||
state.show_lowstate with salt-ssh
|
||||
|
@ -248,7 +238,6 @@ class SSHStateTest(SSHCase):
|
|||
self.assertIsInstance(low, list)
|
||||
self.assertIsInstance(low[0], dict)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_low(self):
|
||||
"""
|
||||
state.low with salt-ssh
|
||||
|
@ -267,7 +256,6 @@ class SSHStateTest(SSHCase):
|
|||
self.assertEqual(value["result"], ret_out["result"])
|
||||
self.assertEqual(value["comment"], ret_out["comment"])
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_request_check_clear(self):
|
||||
"""
|
||||
test state.request system with salt-ssh
|
||||
|
@ -281,7 +269,6 @@ class SSHStateTest(SSHCase):
|
|||
clear = self.run_function("state.clear_request", wipe=False)
|
||||
self._check_request(empty=True)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_run_request(self):
|
||||
"""
|
||||
test state.request system with salt-ssh
|
||||
|
@ -295,7 +282,6 @@ class SSHStateTest(SSHCase):
|
|||
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE], wipe=False)
|
||||
self.assertTrue(check_file)
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_state_running(self):
|
||||
"""
|
||||
test state.running with salt-ssh
|
||||
|
|
|
@ -11,8 +11,8 @@ pytestmark = [
|
|||
pytest.mark.slow_test,
|
||||
pytest.mark.requires_sshd_server,
|
||||
pytest.mark.skipif(
|
||||
"grains['osfinger'] == 'Fedora Linux-40'",
|
||||
reason="Fedora 40 ships with Python 3.12. Test can't run with system Python on 3.12",
|
||||
'grains["osfinger"].startswith(("Fedora Linux-40", "Ubuntu-24.04", "Arch Linux"))',
|
||||
reason="System ships with a version of python that is too recent for salt-ssh tests",
|
||||
# Actually, the problem is that the tornado we ship is not prepared for Python 3.12,
|
||||
# and it imports `ssl` and checks if the `match_hostname` function is defined, which
|
||||
# has been deprecated since Python 3.7, so, the logic goes into trying to import
|
||||
|
|
|
@ -4,10 +4,13 @@ from tests.support.pytest.helpers import reap_stray_processes
|
|||
|
||||
|
||||
@pytest.fixture(scope="package", autouse=True)
|
||||
def _auto_skip_on_fedora_40(grains):
|
||||
if grains["osfinger"] == "Fedora Linux-40":
|
||||
def _auto_skip_on_system_python_too_recent(grains):
|
||||
if (
|
||||
grains["osfinger"] in ("Fedora Linux-40", "Ubuntu-24.04")
|
||||
or grains["os_family"] == "Arch"
|
||||
):
|
||||
pytest.skip(
|
||||
"Fedora 40 ships with Python 3.12. Test can't run with system Python on 3.12"
|
||||
"System ships with a version of python that is too recent for salt-ssh tests",
|
||||
# Actually, the problem is that the tornado we ship is not prepared for Python 3.12,
|
||||
# and it imports `ssl` and checks if the `match_hostname` function is defined, which
|
||||
# has been deprecated since Python 3.7, so, the logic goes into trying to import
|
||||
|
@ -16,7 +19,7 @@ def _auto_skip_on_fedora_40(grains):
|
|||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _reap_stray_processes(grains):
|
||||
def _reap_stray_processes():
|
||||
# when tests timeout, we migth leave child processes behind
|
||||
# nuke them
|
||||
with reap_stray_processes():
|
||||
|
|
Loading…
Add table
Reference in a new issue