[E2E Test] Add E2E test for using external pillars
Open
Nobody has claimed this yet.
Tests
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Add E2E test for the following scenario:
- Setup a master with the following configuration:
ext_pillar:
- cmd_json: 'echo {\"arg\":\"value\"}'
- http_json:
url: http://localhost/%s.html
- Setup a webserver (In the test suite you can use the webserver class from tests/support/helpers.py
- Add an html page with the name of test minion. For example:
minion.html. And the contents of the html file are:
{"minion": "supersecret"}
- Create SLS File with the following contents:
{% set minion_id = grains.get("id") %}
{% set password = pillar.get(minion_id) %}
{% set arg = pillar.get("arg") %}
add_secret:
file.managed:
- name: /tmp/conf_file
- contents: |
target: {{ minion_id }}
password: {{ password }}
args: {{ arg }}
- Run the state and ensure the contents of the file are added correctly.
(py-3.10) ch3ll@megan-precision5550 ~/git/salt add_pillar_docs ± salt 'poc-minion' state.apply ext_pillar
poc-minion:
----------
ID: add_secret
Function: file.managed
Name: /tmp/conf_file
Result: True
Comment: File /tmp/conf_file is in the correct state
Started: 12:24:46.662342
Duration: 20.081 ms
Changes:
Summary for poc-minion
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 20.081 ms
(py-3.10) ch3ll@megan-precision5550 ~/git/salt add_pillar_docs ± cat /tmp/conf_file
target: poc-minion
password: supersecret
args: value
- Update the external pillar data by updating the minions.html site with a new password.
{"poc-minion": "new-supersecret"}
- Run the state again and ensure the contents of the file have changed correctly.
(py-3.10) ch3ll@megan-precision5550 ~/git/salt add_pillar_docs ± salt 'poc-minion' state.apply ext_pillar
poc-minion:
----------
ID: add_secret
Function: file.managed
Name: /tmp/conf_file
Result: True
Comment: File /tmp/conf_file updated
Started: 12:25:50.439871
Duration: 22.172 ms
Changes:
----------
diff:
---
+++
@@ -1,3 +1,3 @@
target: poc-minion
-password: supersecret
+password: new-supersecret
args: value
Summary for poc-minion
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
Total run time: 22.172 ms
(py-3.10) ch3ll@megan-precision5550 ~/git/salt add_pillar_docs ± cat /tmp/conf_file
target: poc-minion
password: new-supersecret
args: value
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the E2E test structure and the webserver helper in tests/support/helpers.py. Set up the master with cmd_json and http_json external pillars, serve the minion data, and apply the SLS scenario. Done means the managed file contains the initial external values and reflects the updated password after the web content changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100