on-line, pero de código abierto y con versión on-premise. http://sentry.io • Hecho en Python con Django. • Vagrant + Debian + Ansible + Pytest/Testinfra • Necesitamos: – python 2.7 – dependencias para librerías python – postgresql – redis – nginx (frontal, no requerido)
para testear servidores (Unix/Linux). • “aims to be a Serverspec equivalent in python” • Diferentes formas de conexión. Repo: https://github.com/philpep/testinfra/ Docu.: http://testinfra.readthedocs.io Instalar: $ pip install testinfra Lanzar: $ testinfra <args>
obtener modules de un backend específico. @pytest.mark.skip(reason="This won't work with vagrant because how handle hostnames") def test__webserver_working(TestinfraBackend): host = TestinfraBackend.get_hostname() r = requests.get("http://" + host) assert r.status_code == 200
atributos están definidos en man ps(1) def test__processes(Process): processes = Process.filter(uname="sentry") mem = sum((p.pmem for p in processes)) assert mem < 40 # 40% of systems's memory
http://testinfra.readthedocs.io/en/latest/ Blogs, vídeos, etc.: • The checklist manifesto, Atul Gawande. • Introduction to pytest https://www.youtube.com/watch?v=LdVJj65ikRY • Introduction to Unit Testing in Python with Pytest https://www.youtube.com/watch?v=UPanUFVFfzY • Five minutes with testinfra http://www.unixdaemon.net/tools/five-minutes-with-testinfra/ • System Testing with pytest and docker-py https://www.youtube.com/watch?v=EDpwvvU-sPY • Pytest desde las trincheras https://www.youtube.com/watch?v=q3549t2EalY • A beginner's guide to testing infrastructure as code https://www.ansible.com/beginners-guide-to-testing-infrastructure-as-code