| .. | ||
| meta | ||
| test-bad-file-error | ||
| test-bad-file-skip | ||
| test-bad-file-warn | ||
| test-disable-sops | ||
| test-extensions | ||
| test-not-dir | ||
| test-stage-inv-cache | ||
| test-stage-inv-no-cache | ||
| test-stage-task-cache | ||
| test-stage-task-no-cache | ||
| test-success | ||
| .gitignore | ||
| .sops.yaml | ||
| aliases | ||
| README.md | ||
| run-test.sh | ||
| run-tests.sh | ||
| runme.sh | ||
| setup.yml | ||
How the tests work
ansible-test integration --docker ubuntu1804 -v var_sops essentially executes runme.sh. That script does:
- Make sure it isn't run for Ansible 2.9 (which does not support vars plugins);
- Use the
setup.ymlplaybook to install the requirements (sops); - Look at all subdirectories called
test-*, and for each of them:- Execute the playbook
playbook.ymlin it; - Call
validate.shin it with parameters<exit_code> <path_to_captured_output>; - If
validate.shexists with an exit code not equal to 0, the test has failed.
- Execute the playbook
Adding more tests
If possible, extend an existing test. If that's not possible, or if you are afraid to pollute one's test environment with more data, create a new one:
- Create a subdirectory
test-<name_of_your_test>; - Create a
playbook.ymlandvalidate.shin there (copy from a similar test and adjust); - Create subdirectories
group_varsand/orhost_varsand fill them as needed.
For creating sops encrypted files, use the private GPG keys from https://raw.githubusercontent.com/getsops/sops/master/pgp/sops_functional_tests_key.asc. There is a .sops.yaml file in this directory which makes sure that sops automatically uses the correct one of the keys provided in that file.