/
githubmirror
/
salt
Обзор
Документация
Войти
/
githubmirror
/
salt
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/pytests/integration/ssh/state/test_retcode_run_fail.py
62 строки
2 KB
Daniel A. Wozniak
Improve salt-ssh relenv/thin parity and fix various regressions
05 апр 2026, 01:26
05 апр 2026, 01:26
a164b4e
Код
Авторство
О чём код?
""" Verify salt-ssh passes on a failing retcode from state execution. """ import pytest from salt.defaults.exitcodes import EX_AGGREGATE from tests.support.helpers import system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, pytest.mark.skipif( system_python_version() < (3, 10), reason="System python too old for these tests", ), ] @pytest.fixture(scope="module", autouse=True) def state_tree_run_fail(base_env_state_tree_root_dir): top_file = """ base: 'localhost': - fail_run '127.0.0.1': - fail_run """ state_file = """ This file state fails: file.managed: - name: /tmp/non/ex/is/tent - makedirs: false - contents: foo """ top_tempfile = pytest.helpers.temp_file( "top.sls", top_file, base_env_state_tree_root_dir ) state_tempfile = pytest.helpers.temp_file( "fail_run.sls", state_file, base_env_state_tree_root_dir ) with top_tempfile, state_tempfile: yield @pytest.mark.parametrize( "args", ( ("state.sls", "fail_run"), ("state.highstate",), ("state.sls_id", "This file state fails", "fail_run"), ("state.top", "top.sls"), ), ) def test_it(salt_ssh_cli_parameterized, args): ret = salt_ssh_cli_parameterized.run(*args) assert ret.returncode == EX_AGGREGATE assert isinstance(ret.data, dict) state = next(iter(ret.data)) assert isinstance(ret.data[state], dict) assert "result" in ret.data[state] assert ret.data[state]["result"] is False