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

Agile 2014 - Agile Infrastructure Development with Test Kitchen

Agile 2014 - Agile Infrastructure Development with Test Kitchen

Why would we test infrastructure code? Well, you test your application code, right? You wouldn't think of putting a complex website into production without a test harness, would you? We've come a long way with infrastructure as code and are getting closer to better test frameworks and facilities.

Test Kitchen (http://kitchen.ci/) is an integration tool for developing and testing infrastructure code and software on isolated target platforms. It was originally developed with Chef in mind, but it is now being used across different configuration management tools.

This talk will focus on how Test Kitchen can help you shorten the feedback cycle during the development of infrastructure code and discover how it plays nice with other existing tools like ChefSpec, RSpec Puppet, Docker containers, and Vagrant. We will cover getting up and running with Test Kitchen, we will work up a basic greenfield Chef cookbook, and add testing support to a larger real world project. Learn how you can develop infrastructure code using quick iterations and in a Test Driven Development (TDD) cycle. Besides the technology we will look into the benefits of this faster feedback cycle and the current/future state of infrastructure as code testing.

Fletcher Nichol

August 04, 2014
Tweet

More Decks by Fletcher Nichol

Other Decks in Technology

Transcript

  1. What can make me confident about my work? Knowing that

    my work functions correctly by watching it succeed & recover in failure.
  2. How can I run my work regularly? Have an automated

    test suite that can execute on demand.
  3. commit fda10bb71cc45c7eebeb4355f8dafa2b55f00709 Author: Fletcher Nichol <[email protected]> Date: Sat Dec 1

    10:51:52 2012 -0700 Jamie: A Chef Convergence Integration Test Harness. Also, what the heck I am getting into here?
  4. commit c8303426363a50a08137e518e124dad31facb9f1 Author: Fletcher Nichol <[email protected]> Date: Mon Jan 28

    22:22:08 2013 -0700 Thank you Jamie, hello Test Kitchen. This is a first-pass renaming of the Jamie project to test-kitchen. The following are major breaking changes: * all constant references of `Jamie` have been renamed to `Kitchen` * the .jamie.yml file has been renamed to .kitchen.yml * the binary bin/jamie has been renamed to bin/kitchen * the Rake task namespace :jamie is now :kitchen * the Thor task namespace :jamie is now :kitchen * the `kitchen new_plugin` subcommand will create a 'kitchen-*' gem project
  5. Manifesto for Agile Software Development “We are uncovering better ways

    of developing software by doing it and helping others do it. Through this work we have come to value:
  6. Manifesto for Agile Software Development That is, while there is

    value in the items on the right, we value the items on the left more.”
  7. Manifesto for Agile Software Development “We are uncovering better ways

    of developing software by doing it and helping others do it. Through this work we have come to value:
  8. Manifesto for Agile Infrastructure Development “We are uncovering better ways

    of deploying infrastructure by doing it and helping others do it. Through this work we have come to value:
  9. Infrastructure as code “Enable the reconstruction of the business from

    nothing but a source code repository, an application data backup, and bare metal resources” - Adam Jacob, Web Operations
  10. Infrastructure as Code Fr D v r’ P f V

    w Devopsdays Portland 2013 Fletcher Nichol @fnichol http://hw-ops.com/
  11. TDD

  12. TDD “‘Only ever write code to fix a failing test.’

    That's test-driven development, or TDD, in one sentence.” - Lasse Koskela, Test Driven
  13. TDD Benfits 1. “I rarely get a support call or

    end up in a long debugging session.” - Lasse Koskela, Test Driven
  14. TDD Benfits 2. “I feel confident in the quality of

    my work.” - Lasse Koskela, Test Driven
  15. TDD Benfits 3. “I have more time to develop as

    a professional.” - Lasse Koskela, Test Driven
  16. Test Driven “Deep down, we want to write code that

    works.” - Lasse Koskela, Test Driven
  17. BDD

  18. BDD “Behavior-Driven Development is about implementing an application by describing

    its behavior from the perspective of its stakeholders.” - David Chelimsky, The RSpec Book
  19. BDD “BDD is a second-generation, outside-in, pull- based, multiple-stakeholder, multiple-scale,

    high-automation, agile methodology. It describes a cycle of interactions with well- defined outputs, resulting in the delivery of working, tested software that matters.” - Dan North, Agile specifications, BDD and Testing eXchange
  20. Given/When/Then “Given, When, Then, the BDD triad, are simple words

    that we use whether we’re talking about application behavior or object behavior. They are easily understood by business analysts, testers, and developers alike.” - David Chelimsky, The RSpec Book
  21. Test Kitchen is: A test harness tool to execute your

    configured code on one or more platforms in isolation
  22. Kitchen converges with provisioners and runs specific blah blah blababibty

    blah and lets you optionally run tests on them to verify state
  23. Busser Runner Plugins busser-bash, busser-bats, busser- minitest, busser-shunit2, busser- aruba,

    busser-serverspec, busser- rspec, busser-shpec, busser-cucumber