Testinfra 可测试您的基础架构
################################## Testinfra 用于测试您的基础架构 ##################################
Testinfra 旨在成为 Python 中的 Serverspec 等价物,它是作为一个插件来编写的,用于强大的 Pytest 测试引擎。
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 == 0o644 def 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_enabled 然后运行它: $ pytest -v test_myinfra.py
===================== 测试会话开始 ====================== 平台 Linux -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4 插件: testinfra 收集了 3 个项目 test_myinfra.py::tes
暂无开放 Issues,或尚未同步最近议题。