Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pytest-dev/pytest-testinfra
Testinfra test your infrastructures
https://github.com/pytest-dev/pytest-testinfra
ansible chef devops devops-tools docker infrastructure-as-code infrastructure-testing kubernetes nagios puppet pytest-plugin python saltstack tdd tdd-utilities testing testing-tools
Last synced: 8 days ago
JSON representation
Testinfra test your infrastructures
- Host: GitHub
- URL: https://github.com/pytest-dev/pytest-testinfra
- Owner: pytest-dev
- License: apache-2.0
- Created: 2015-03-15T20:49:52.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T12:07:21.000Z (18 days ago)
- Last Synced: 2024-10-30T01:02:48.834Z (10 days ago)
- Topics: ansible, chef, devops, devops-tools, docker, infrastructure-as-code, infrastructure-testing, kubernetes, nagios, puppet, pytest-plugin, python, saltstack, tdd, tdd-utilities, testing, testing-tools
- Language: Python
- Homepage: https://testinfra.readthedocs.io
- Size: 1.03 MB
- Stars: 2,372
- Watchers: 71
- Forks: 355
- Open Issues: 140
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- stars - pytest-dev/pytest-testinfra
- awesome-repositories - pytest-dev/pytest-testinfra - Testinfra test your infrastructures (Python)
- awesome-list - pytest-testinfra - dev | 1936 | (Python)
- awesome-pytest - pytest-testinfra - Infrastructure testing to validate the actual state of your servers configured by management tools like Salt, Ansible, Puppet, Chef and so on. (Plugins)
- best-of-python-dev - GitHub - 38% open · ⏱️ 27.05.2024): (Testing Tools)
README
##################################
Testinfra test your infrastructure
##################################Latest documentation: https://testinfra.readthedocs.io/en/latest
About
=====With Testinfra you can write unit tests in Python to test *actual state* of
your servers configured by management tools like Salt_, Ansible_, Puppet_,
Chef_ and so on.Testinfra aims to be a Serverspec_ equivalent in python and is written as
a plugin to the powerful Pytest_ test engineLicense
=======`Apache License 2.0 `_
The logo is licensed under the `Creative Commons NoDerivatives 4.0 License `_
If you have some other use in mind, contact us.Quick start
===========Install testinfra using pip::
$ pip install pytest-testinfra
# or install the devel version
$ pip install 'git+https://github.com/pytest-dev/pytest-testinfra@main#egg=pytest-testinfra'Write your first tests file to `test_myinfra.py`:
.. code-block:: python
def test_passwd_file(host):
passwd = host.file("/etc/passwd")
assert passwd.contains("root")
assert passwd.user == "root"
assert passwd.group == "root"
assert passwd.mode == 0o644def test_nginx_is_installed(host):
nginx = host.package("nginx")
assert nginx.is_installed
assert nginx.version.startswith("1.2")def test_nginx_running_and_enabled(host):
nginx = host.service("nginx")
assert nginx.is_running
assert nginx.is_enabledAnd run it::
$ py.test -v test_myinfra.py
====================== test session starts ======================
platform linux -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4
plugins: testinfra
collected 3 itemstest_myinfra.py::test_passwd_file[local] PASSED
test_myinfra.py::test_nginx_is_installed[local] PASSED
test_myinfra.py::test_nginx_running_and_enabled[local] PASSED=================== 3 passed in 0.66 seconds ====================
.. _Salt: https://saltstack.com/
.. _Ansible: https://www.ansible.com/
.. _Puppet: https://puppetlabs.com/
.. _Chef: https://www.chef.io/
.. _Serverspec: https://serverspec.org/
.. _Pytest: https://pytest.org/