Having a Rakefile will allow us to change the actual test commands on our side rather than relying on changes to the openstack-infra repository. This should make it a lot faster to change things, but also easier to test since the jenkins jobs are actually run in this repository, not the openstack-infra one. This commit defines the jobs we previously had defined in Jenkins and uses 'high-level' naming consistently (i.e. lint, style vs. foodcritic, rubocop). There is also a :clean task to help with deleting the files generated by the other jobs. Also changed foodcritic to run on the source cookbook rather than the one installed by berks, see e.g. https://github.com/berkshelf/berkshelf/issues/931#issuecomment-29668369 Change-Id: I3951f7bf3b474f1b7aab46c16d91a9b431a787bf blueprint: rakefile
1.6 KiB
Testing the Cookbook
This cookbook uses bundler and berkshelf to isolate dependencies. Make sure you have ruby 1.9.x
, bundler
, rake
, build essentials and the header files for gecode
installed before continuing. Make sure that you're using gecode version 3. More info here.
We have three test suites which you can run either, individually (there are three rake tasks):
$ rake lint
$ rake style
$ rake unit
or altogether:
$ rake test
The rake
tasks will take care of installing the needed gem dependencies and cookbooks with berkshelf
.
Rubocop
Rubocop is a static Ruby code analyzer, based on the community Ruby style guide. We are attempting to adhere to this where applicable, slowly cleaning up the cookbooks until we can turn on Rubocop for gating the commits.
Foodcritic
Foodcritic is a lint tool for Chef cookbooks. We ignore the following rules:
Chefspec
ChefSpec is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.