Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ChefConf 2013 - Test Kitchen: Multi-Platform In...

ChefConf 2013 - Test Kitchen: Multi-Platform Integration Testing for the Masses

Test Kitchen was born out of an Opscode Engineering need to drive cross-platform integration tests for our Ruby and Erlang projects. Jamie CI was created by Fletcher Nichol to solve a similar problem he had with cross-platform cookbook testing. This talk tells the story of how these two projects joined forces to become the awesomeness that is Test Kitchen 1.0!

We will also cover Test Kitchen's design goals for 1.0, the new modular architecture, and how it can be extended to solve new problems. We'll also discuss how the new version can be used for cookbook integration testing. Testing shouldn't be a chore, and the tools you use should get out of your way to let you run tests as quickly as possible.

Fletcher Nichol

April 28, 2013
Tweet

More Decks by Fletcher Nichol

Other Decks in Programming

Transcript

  1. Test Kitchen Multi-Platform Integration Testing for the Masses Seth Chisamore,

    Opscode Joshua Timberman, Opscode Fletcher Nichol, Blue Box Group
  2. Cookbook Testing • Actually run Chef on a node •

    Across every platform they support • By hand!
  3. Requirements were gathered • Cross Platform • Regression testing •

    Linting, Unit/Spec testing • Functional/integration testing • Jenkins/CI
  4. Development continued • Andrew Crump (foodcritic author) expanded Test Kitchen

    for cookbook projects • He set up Jenkins builds for cookbooks • Announced the release, early and often • Cookbooks were updated to support Test Kitchen
  5. Test Kitchen is awesome • "kitchen test" in a repository:

    • Creates Kitchenfile • Runs foodcritic, knife cookbook test • Resolves cookbook dependencies • Runs vagrant w/ default recipe • Runs minitest-chef tests if present • Automatically.
  6. There were Limitations • Adding new providers (e.g. OpenStack) was

    non-trivial • Override/local customization (e.g., Kitchenfile, Vagrantfile) was also non-trivial
  7. ...

  8. platforms: - name: ubuntu-12.04 driver_config: box: opscode-ubuntu-12.04 box_url: https://...box run_list:

    - recipe[apt] - name: centos-6.3 driver_config: box: opscode-centos-6.3 box_url: https://...box run_list: - recipe[yum::epel] .kitchen.yml: platform
  9. platforms: - name: ubuntu-12.04 driver_config: box: opscode-ubuntu-12.04 box_url: https://...box run_list:

    - recipe[apt] - name: centos-6.3 driver_config: box: opscode-centos-6.3 box_url: https://...box run_list: - recipe[yum::epel] .kitchen.yml: platform
  10. platforms: - name: ubuntu-12.04 driver_config: box: opscode-ubuntu-12.04 box_url: https://...box run_list:

    - recipe[apt] - name: centos-6.3 driver_config: box: opscode-centos-6.3 box_url: https://...box run_list: - recipe[yum::epel] .kitchen.yml: platform
  11. platforms: - name: ubuntu-12.04 driver_config: box: opscode-ubuntu-12.04 box_url: https://...box run_list:

    - recipe[apt] - name: centos-6.3 driver_config: box: opscode-centos-6.3 box_url: https://...box run_list: - recipe[yum::epel] .kitchen.yml: platform
  12. suites: - name: rubies run_list: - recipe[java] - recipe[rvm::system] attributes:

    rvm: default_ruby: system rubies: - 1.9.3 - version: 1.9.3-p327 patch: railsexpress - version: 1.8.7 rubygems_version: 1.6.0 .kitchen.yml: suite
  13. suites: - name: rubies run_list: - recipe[java] - recipe[rvm::system] attributes:

    rvm: default_ruby: system rubies: - 1.9.3 - version: 1.9.3-p327 patch: railsexpress - version: 1.8.7 rubygems_version: 1.6.0 .kitchen.yml: suite
  14. suites: - name: rubies run_list: - recipe[java] - recipe[rvm::system] attributes:

    rvm: default_ruby: system rubies: - 1.9.3 - version: 1.9.3-p327 patch: railsexpress - version: 1.8.7 rubygems_version: 1.6.0 .kitchen.yml: suite
  15. suites: - name: rubies run_list: - recipe[java] - recipe[rvm::system] attributes:

    rvm: default_ruby: system rubies: - 1.9.3 - version: 1.9.3-p327 patch: railsexpress - version: 1.8.7 rubygems_version: 1.6.0 .kitchen.yml: suite
  16. > kitchen list Instance Last Action rubies-ubuntu-1204 <Not Created> rubies-centos-63

    <Not Created> system-ubuntu-1204 <Not Created> system-centos-63 <Not Created> Instances
  17. > kitchen list Instance Last Action rubies-ubuntu-1204 <Not Created> rubies-centos-63

    <Not Created> system-ubuntu-1204 <Not Created> system-centos-63 <Not Created> Instances
  18. > kitchen list Instance Last Action rubies-ubuntu-1204 <Not Created> rubies-centos-63

    <Not Created> system-ubuntu-1204 <Not Created> system-centos-63 <Not Created> Instances
  19. --- driver_plugin: ec2 driver_config: region: us-east-1 flavor_id: m1.small platforms: -

    name: smartos driver_plugin: vagrant driver_config: box: smartos - name: freebsd driver_config: image_id: ami-5339bb3a .kitchen.yml: driver_config
  20. --- driver_plugin: ec2 driver_config: region: us-east-1 flavor_id: m1.small platforms: -

    name: smartos driver_plugin: vagrant driver_config: box: smartos - name: freebsd driver_config: image_id: ami-5339bb3a .kitchen.yml: driver_config
  21. --- driver_plugin: ec2 driver_config: region: us-east-1 flavor_id: m1.small platforms: -

    name: smartos driver_plugin: vagrant driver_config: box: smartos - name: freebsd driver_config: image_id: ami-5339bb3a .kitchen.yml: driver_config
  22. --- driver_plugin: ec2 driver_config: region: us-east-1 flavor_id: m1.small platforms: -

    name: smartos driver_plugin: vagrant driver_config: box: smartos - name: freebsd driver_config: image_id: ami-5339bb3a .kitchen.yml: driver_config
  23. Photo Credits: http://www.flickr.com/photos/vagabondblogger/4163372966/ http://www.flickr.com/photos/26524277@N04/6870401434/ http://www.flickr.com/photos/walkn/3859852351/ http://www.flickr.com/photos/hebe/2171258965/ http://www.flickr.com/photos/methyl_lives/6009938677/ http://www.flickr.com/photos/derekbever/4413413377/ http://www.flickr.com/photos/emmajane/2580835224/ http://www.flickr.com/photos/whartz/1913603367/

    http://www.flickr.com/photos/bobaubuchon/5664242537/ http://www.flickr.com/photos/kubina/2090583987/ http://www.flickr.com/photos/leejordan/2483708561/ http://www.flickr.com/photos/peyri/304354485/ http://www.flickr.com/photos/joeshlabotnik/3707230247/ http://www.flickr.com/photos/skrb/179608762/ http://www.flickr.com/photos/nick_c/112111560/ http://www.flickr.com/photos/beltzner/2954046668/ http://www.flickr.com/photos/mattwyn/2448866914/ http://www.flickr.com/photos/beltzner/2954046668 http://www.flickr.com/photos/qmnonic/4290558018/