mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-29 19:04:42 +00:00
Added ability to add pytest tests
Until now ansible-freeipa repository only had playbook tests. This commit introduces the ability of creating TestCase classes connected to the master host. This connection can be used to run commands in the managed host after the ansible playbook execution is the allowing the verification of the machine state.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Before starting
|
||||
|
||||
In order to run ansible-freeipa tests you will need to have `ansible`, `pytest` and `jmespath` installed on your machine. We'll call this local machine `controller`. `jmespath` is needed for the `json_query` filter.
|
||||
In order to run ansible-freeipa tests you will need to install the dependencies listed in the file `requirements-tests.txt` in your local machine. We'll call this local machine `controller`.
|
||||
|
||||
You will also need to have a remote host with freeipa server installed and configured. We'll call this remote host `ipaserver`.
|
||||
|
||||
@@ -63,6 +63,20 @@ IPA_SERVER_HOST=<ipaserver_host_or_ip> pytest -rs
|
||||
|
||||
For a complete list of options check `pytest --help`.
|
||||
|
||||
### Types of tests
|
||||
|
||||
#### Playbook tests
|
||||
|
||||
The playbook tests will run our roles / modules using Ansible with various parameters. Most of these tests will be executed more than once, to verify idempotence. In general those tests don't verify the state of the machine after the playbook is executed.
|
||||
|
||||
To select only these tests use the option `-m "playbook"`
|
||||
|
||||
#### Python tests (pytests)
|
||||
|
||||
The pytests are tests that will execute small playbooks and then will verify the test results immediately after, using python code for that.
|
||||
|
||||
To select only these tests on a test execution use the option `-m "not playbook"`.
|
||||
|
||||
|
||||
## Running tests in a docker container
|
||||
|
||||
|
||||
Reference in New Issue
Block a user