Molecule/testinfra

18 views
Skip to first unread message

Chris Short

unread,
Apr 26, 2018, 2:10:10 PM4/26/18
to Ansible Project
Is anyone using molecule/testinfra to test real infrastructure (verifying things ansible has managed)? The unit testing of playbooks is awesome but how would I use the framework to test real things on real systems?

Varun Chopra

unread,
Apr 27, 2018, 9:13:36 AM4/27/18
to Ansible Project
You wouldn't.

You're supposed to test things before you deploy them.

Brian Coca

unread,
Apr 27, 2018, 9:28:45 AM4/27/18
to Ansible Project
You can use Ansible itself for testing 'existing state':

- use unprivileged users so any 'change' would fail and that failure
would tell you it is not the expected state. i.e service: name=apache
state=started

- check mode/diff are also helpful when combined with assert/fail

- it is good to model it in a TDD form, have one person create the
playbook the sets the state, another one that verifies the state, this
requires a good spec on 'expected state'


It should be simple for QA to audit and map the tasks and plays to the
test cases.

----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages