-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(jinja): add state files for testing known Jinja issues
Check for problems associated with this bug: * saltstack/salt#60188 - Affects use of `grains`, `opts`, `pillar` & `salt` in Jinja. Fix was first available in `3004`: * saltstack/salt#60811 Use tests to apply the Jinja2 downgrade only where necessary (and to ensure that it is actually working).
- Loading branch information
Showing
15 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
def test_jinja_grains(host): | ||
cmd = host.run("salt-call --local state.sls test_jinja.grains") | ||
assert cmd.rc == 0 | ||
|
||
|
||
def test_jinja_opts(host): | ||
cmd = host.run("salt-call --local state.sls test_jinja.opts") | ||
assert cmd.rc == 0 | ||
|
||
|
||
def test_jinja_pillar(host): | ||
cmd = host.run("salt-call --local state.sls test_jinja.pillar") | ||
assert cmd.rc == 0 | ||
|
||
|
||
def test_jinja_salt(host): | ||
cmd = host.run("salt-call --local state.sls test_jinja.salt") | ||
assert cmd.rc == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- import_yaml "./grains.yaml" as grains %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{%- from "test_jinja/grains.jinja" import grains with context %} | ||
test_jinja/grains/cmd.run: | ||
cmd.run: | ||
- name: pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- set grains = grains.get('os', '') %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- import_yaml "./opts.yaml" as opts %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{%- from "test_jinja/opts.jinja" import opts with context %} | ||
test_jinja/opts/cmd.run: | ||
cmd.run: | ||
- name: pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- set opts = opts.get('__cli', '') %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- import_yaml "./pillar.yaml" as pillar %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{%- from "test_jinja/pillar.jinja" import pillar with context %} | ||
test_jinja/pillar/cmd.run: | ||
cmd.run: | ||
- name: pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- set pillar = pillar.get('pillar', '') %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- import_yaml "./salt.yaml" as salt %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{%- from "test_jinja/salt.jinja" import salt with context %} | ||
test_jinja/salt/cmd.run: | ||
cmd.run: | ||
- name: pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- set salt = salt['pillar.get']('salt', '') %} |