Conftest vs Serverspec
Conftest
conftest.devServerspec
serverspec.orgSide by side
| Figure | Conftest | Serverspec |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| Self-hosted | — | Yes |
| Plans published | 1 | 1 |
| Spec score · Infrastructure Testing Tools | 8.4 (#4) | 7.5 (#17) |
| Purpose | Conftest is a utility for writing tests against structured configuration data. | Serverspec lets users write RSpec tests to check that servers are configured correctly. |
Plans
In their own words
Conftest
Conftest is a free utility for testing structured configuration data, designed for use in CI environments. It uses the Open Policy Agent Rego language to express policies, then evaluates deny, violation, and warning rules within namespaces. Configuration can be read from individual files, directories, multiple files, or standard input. Supported inputs include Kubernetes-style YAML, JSON, HCL and HCL2, Dockerfiles, Terraform-related data, JSONnet, TOML, and XML. Results can be output as plaintext, JSON, TAP, table, JUnit, GitHub, Azure DevOps, or SARIF; the GitHub outputter can annotate test results in workflows. The `conftest verify` command runs policy unit tests. Policies can be pulled from HTTPS URLs, Git repositories, and OCI registries, or pushed to compatible OCI registries. Plugins extend the CLI, with downloads available from sources including OCI, Git, HTTP/HTTPS, Mercurial, and cloud storage. Pre-commit hooks support policy workflows, and integrations are documented for CircleCI, GitHub Actions, and Tekton. Conftest is available for Linux, macOS, and Windows.
Serverspec
Serverspec is an open-source Ruby gem for writing RSpec tests that verify server configuration. It examines actual machine state by executing commands locally or through SSH, WinRM, and the Docker API, without requiring agent software on target servers. Checks cover packages, services, files, ports, users, Docker containers and images, Windows features, and X.509 certificates and private keys. Both RSpec should and expect syntax are supported. Serverspec can accompany Puppet, Ansible, CFEngine, Itamae, and Chef, with infrastructure-code refactoring stated as its central aim. The tutorial names Linux distributions, macOS, Windows, BSD systems, Solaris, SmartOS, and others, while noting incomplete support for some. Each suite targets one machine or Docker container, so separate RSpec commands are advised for separate targets. Install through Bundler or gem install serverspec. It is MIT licensed and maintained by Gosuke Miyashita.