A working ruby installation (2.7+) with Bundler.
The linting is done using Cookstyle, a tailored RuboCop configuration for Chef cookbooks.
The unit testing is done with ChefSpec, an extension of Rspec for Chef cookbooks. Chefspec compiles your cookbook code and converges the run in memory, without actually executing the changes. The user can write various assertions based on what they expect to have happened during the Chef run. Chefspec is very fast, and quick useful for testing complex logic as you can easily converge a cookbook many times in different ways.
The CI is basically running bundle exec rake
which underhood call the linting and unit testing tasks.
If you just want to apply the linter, run bundle exec rake cookstyle
.
If you just want to launch the unit tests, run bundle exec rake rspec
.
When adding a new feature it is strongly recommended to add unit tests for it in the spec/unit/
directory.
When fixing a bug it is a good practive to add non-regression tests for it in the spec/regression/
directory.