Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.93 KB

TESTING.md

File metadata and controls

41 lines (26 loc) · 1.93 KB

Testing the chef_fedora_base cookbook

This cookbook includes both unit tests via ChefSpec and integration tests via Test Kitchen. Contributions to this cookbook will only be accepted if all tests pass successfully:

kitchen test
chef exec rspec

Setting up the test environment

Install the latest version of Vagrant and VirtualBox (free) or VMWare Fusion (paid).

The Chef tooling (chefspec/test kitchen/etc) is managed by the Chef Development Kit - Version: 2.4.17 as of 12/26/2017

Clone the latest version of the cookbook from the repository.

git clone [email protected]:Defilan/chef_fedora_base.git
cd chef_fedora_base

Running ChefSpec

ChefSpec unit tests are located in spec. Each recipe has a recipename_spec.rb file that contains unit tests for that recipe. Your new functionality or bug fix should have corresponding test coverage - if it's a change, make sure it doesn't introduce a regression (existing tests should pass). If it's a change or introduction of new functionality, add new tests as appropriate.

To run ChefSpec for the whole cookbook:

chef exec rspec

To run ChefSpec for a specific recipe:

chef exec rspec spec/unit/recipes/default_spec.rb

Running Test Kitchen

Test Kitchen test suites are defined in .kitchen.yml. Running kitchen test will cause Test Kitchen to spin up each platform VM in turn, running the chef_fedora_base::default recipe with differing parameters in order to test all possible combinations of platform, install_flavor, and JDK version. If the Chef run completes successfully, corresponding tests in test/integration are executed. These must also pass.