|
| 1 | +From dc3027bab4925228cacde00ae626bf651d0a0c3b Mon Sep 17 00:00:00 2001 |
| 2 | +From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= |
| 3 | + |
| 4 | +Date: Wed, 17 Sep 2025 09:56:44 +0200 |
| 5 | +Subject: [PATCH] Even more reliable pillar timeout test |
| 6 | + |
| 7 | +* Even more reliable pillar timeout test |
| 8 | + |
| 9 | +* Use sys.executable on test_pillar_timeout test |
| 10 | + |
| 11 | +--------- |
| 12 | + |
| 13 | +Co-authored-by: Daniel A. Wozniak < [email protected]> |
| 14 | +--- |
| 15 | + .../integration/minion/test_return_retries.py | 18 +++++++++++------- |
| 16 | + 1 file changed, 11 insertions(+), 7 deletions(-) |
| 17 | + |
| 18 | +diff --git a/tests/pytests/integration/minion/test_return_retries.py b/tests/pytests/integration/minion/test_return_retries.py |
| 19 | +index 45dea9c4c76..9b71bed58c5 100644 |
| 20 | +--- a/tests/pytests/integration/minion/test_return_retries.py |
| 21 | ++++ b/tests/pytests/integration/minion/test_return_retries.py |
| 22 | +@@ -5,6 +5,7 @@ import pytest |
| 23 | + from saltfactories.utils import random_string |
| 24 | + |
| 25 | + from tests.support.helpers import dedent |
| 26 | ++import salt.utils.files |
| 27 | + |
| 28 | + |
| 29 | + @pytest.fixture(scope="function") |
| 30 | +@@ -57,14 +58,13 @@ def test_publish_retry(salt_master, salt_minion_retry, salt_cli, salt_run_cli): |
| 31 | + |
| 32 | + @pytest.mark.slow_test |
| 33 | + @pytest.mark.flaky(max_runs=4) |
| 34 | +-def test_pillar_timeout(salt_master_factory): |
| 35 | +- cmd = ( |
| 36 | +- sys.executable |
| 37 | +- + ' -c "import time; time.sleep(4.8); print(\'{\\"foo\\": \\"bar\\"}\');"' |
| 38 | +- ).strip() |
| 39 | ++def test_pillar_timeout(salt_master_factory, tmp_path): |
| 40 | ++ with salt.utils.files.fopen(tmp_path / "script.py", "w") as fp: |
| 41 | ++ fp.write('print(\'{"foo": "bar"}\');\n') |
| 42 | ++ |
| 43 | + master_overrides = { |
| 44 | + "ext_pillar": [ |
| 45 | +- {"cmd_json": cmd}, |
| 46 | ++ {"cmd_json": f"{sys.executable} {tmp_path / 'script.py'}"}, |
| 47 | + ], |
| 48 | + "auto_accept": True, |
| 49 | + "worker_threads": 3, |
| 50 | +@@ -110,7 +110,11 @@ def test_pillar_timeout(salt_master_factory): |
| 51 | + sls_tempfile = master.state_tree.base.temp_file( |
| 52 | + "{}.sls".format(sls_name), sls_contents |
| 53 | + ) |
| 54 | +- with master.started(), minion1.started(), minion2.started(), minion3.started(), minion4.started(), sls_tempfile: |
| 55 | ++ with master.started(), minion1.started(), minion2.started(), minion3.started(), minion4.started(), ( |
| 56 | ++ sls_tempfile |
| 57 | ++ ): |
| 58 | ++ with salt.utils.files.fopen(tmp_path / "script.py", "w") as fp: |
| 59 | ++ fp.write('import time; time.sleep(6); print(\'{"foo": "bang"}\');\n') |
| 60 | + proc = cli.run("state.sls", sls_name, minion_tgt="*") |
| 61 | + # At least one minion should have a Pillar timeout |
| 62 | + print(proc) |
| 63 | +-- |
| 64 | +2.51.0 |
| 65 | + |
0 commit comments