mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00

- Fix thin dir unit tests after distro change revert - Skip any tests that require system python of 3.9 or higher
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
import pytest
|
|
|
|
from tests.pytests.integration.ssh import check_system_python_version
|
|
|
|
pytestmark = [
|
|
pytest.mark.skipif(
|
|
not check_system_python_version(), reason="Needs system python >= 3.9"
|
|
),
|
|
]
|
|
|
|
|
|
def test_pillar_using_http_query(salt_master, salt_minion, salt_cli, tmp_path):
|
|
pillar_top = """
|
|
base:
|
|
"*":
|
|
- http_pillar_test
|
|
"""
|
|
my_pillar = """
|
|
{%- set something = salt['http.query']('https://raw.githubusercontent.com/saltstack/salt/master/.pre-commit-config.yaml', raise_error=False, verify_ssl=False, status=True, timeout=15).status %}
|
|
http_query_test: {{ something }}
|
|
"""
|
|
|
|
with salt_master.pillar_tree.base.temp_file("top.sls", pillar_top):
|
|
with salt_master.pillar_tree.base.temp_file("http_pillar_test.sls", my_pillar):
|
|
with salt_master.pillar_tree.base.temp_file(
|
|
"http_pillar_test.sls", my_pillar
|
|
):
|
|
ret = salt_cli.run("state.apply", minion_tgt=salt_minion.id)
|
|
assert ret.returncode == 1
|
|
assert (
|
|
ret.data["no_|-states_|-states_|-None"]["comment"]
|
|
== "No states found for this minion"
|
|
)
|
|
|
|
pillar_ret = salt_cli.run(
|
|
"pillar.item", "http_query_test", minion_tgt=salt_minion.id
|
|
)
|
|
assert pillar_ret.returncode == 0
|
|
|
|
assert '"http_query_test": 200' in pillar_ret.stdout
|