mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
3e5c06b4fb
commit
3962fcd281
1 changed files with 38 additions and 0 deletions
38
tests/pytests/integration/states/test_include.py
Normal file
38
tests/pytests/integration/states/test_include.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
Integration tests for the jinja includes in states
|
||||
"""
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_issue_64111(salt_master, salt_minion, salt_call_cli):
|
||||
|
||||
macros_jinja = """
|
||||
{% macro a_jinja_macro(arg) -%}
|
||||
{{ arg }}
|
||||
{%- endmacro %}
|
||||
"""
|
||||
|
||||
init_sls = """
|
||||
include:
|
||||
- common.file1
|
||||
"""
|
||||
|
||||
file1_sls = """
|
||||
{% from 'common/macros.jinja' import a_jinja_macro with context %}
|
||||
|
||||
a state id:
|
||||
cmd.run:
|
||||
- name: echo {{ a_jinja_macro("hello world") }}
|
||||
"""
|
||||
tf = salt_master.state_tree.base.temp_file
|
||||
|
||||
with tf("common/macros.jinja", macros_jinja):
|
||||
with tf("common/init.sls", init_sls):
|
||||
with tf("common/file1.sls", file1_sls):
|
||||
ret = salt_call_cli.run("state.apply", "common")
|
||||
assert ret.returncode == 0
|
Loading…
Add table
Reference in a new issue