Add integration test

This commit is contained in:
Max Arnold 2024-02-20 10:20:27 +07:00 committed by Daniel Wozniak
parent 76ae4a6875
commit 84b4e96db2
2 changed files with 27 additions and 1 deletions

View file

@ -1 +1 @@
Make sure the root minion process handles SIGUSR1 and emits a traceback like the child minion processes
Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes

View file

@ -2,6 +2,7 @@
:codeauthor: Thayne Harbaugh (tharbaug@adobe.com)
"""
import glob
import logging
import os
import shutil
@ -276,3 +277,28 @@ def test_minion_65400(salt_cli, salt_minion, salt_minion_2, salt_master):
for minion_id in ret.data:
assert ret.data[minion_id] != "Error: test.configurable_test_state"
assert isinstance(ret.data[minion_id], dict)
@pytest.mark.skip_on_windows(reason="Windows does not support SIGUSR1")
def test_sigusr1_handler(salt_master, salt_minion):
"""
Ensure SIGUSR1 handler works.
Refer to https://docs.saltproject.io/en/latest/topics/troubleshooting/minion.html#live-python-debug-output for more details.
"""
tb_glob = os.path.join(tempfile.gettempdir(), "salt-debug-*.log")
tracebacks_before = glob.glob(tb_glob)
os.kill(salt_minion.pid, signal.SIGUSR1)
for i in range(10):
if len(glob.glob(tb_glob)) - len(tracebacks_before) == 1:
break
time.sleep(1)
os.kill(salt_master.pid, signal.SIGUSR1)
for i in range(10):
if len(glob.glob(tb_glob)) - len(tracebacks_before) == 2:
break
time.sleep(1)
tracebacks_after = glob.glob(tb_glob)
assert len(tracebacks_after) - len(tracebacks_before) == 2