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

ChefConf 2014 - Test Kitchen: One Year Later and the Future

ChefConf 2014 - Test Kitchen: One Year Later and the Future

After one year of active development and real world use, Test Kitchen 1.0 was released on December 1, 2013. And this is only the beginning. In this session we will cover an introduction to Test Kitchen, its ecosystem, some common (and crazy) usage patterns in the wild, and ways to extend and bend the framework to your will. If you want a good insight into where Test Kitchen is going, then this talk is for you.

Fletcher Nichol

April 16, 2014
Tweet

More Decks by Fletcher Nichol

Other Decks in Technology

Transcript

  1. Test Kitchen: One Year Later and the Future ChefConf 2014,

    San Francisco Fletcher Nichol @fnichol github.com/fnichol
  2. Test Kitchen is: A test harness tool to execute your

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

    blah and lets you optionally run tests on them to verify state
  4. or

  5. --- platforms: - name: ubuntu-14.04-chef-11 provisioner: require_chef_omnibus: 11 - name:

    ubuntu-14.04-chef-12 provisioner: require_chef_omnibus: 12
  6. kitchen converge [NAME|REGEXP|all] kitchen create [NAME|REGEXP|all] kitchen destroy [NAME|REGEXP|all] kitchen

    diagnose [NAME|REGEXP|all] kitchen list [NAME|REGEXP|all] kitchen login [NAME|REGEXP|all] kitchen setup [NAME|REGEXP|all] kitchen test [NAME|REGEXP|all] kitchen verify [NAME|REGPEX|all]
  7. --- instances: default-ubuntu-1204: state_file: hostname: 192.168.206.225 last_action: create port: '22'

    ssh_key: "/Users/fnichol/.vagrant.d/ insecure_private_key" username: vagrant
  8. --- loader: global_config: filename: "/Users/fnichol/.kitchen/ config.yml" raw_data: #... project_config: filename:

    "/Users/fnichol/Projects/ sandbox/newish/.kitchen.yml" raw_data: # ... local_config:
  9. er

  10. kitchen converge --concurrency=2 kitchen create -c 2 kitchen destroy -c

    2 kitchen setup -c 2 kitchen test -c 2 kitchen verify -c
  11. No.

  12. # Environment variables export KITCHEN_INSTANCE=default-centos-65 export GIT_REV=<rev> # CI job

    pseudo-code git reset --hard “$GIT_REV” git clean -d -x -f if [ -f “.kitchen.ci.yml” ] ; then export KITCHEN_LOCAL_YAML=.kitchen.ci.yml fi bundle install --path vendor/bundle bundle exec rake kitchen:$KITCHEN_INSTANCE
  13. # Environment variables export KITCHEN_INSTANCE=default-centos-65 export GIT_REV=<rev> # CI job

    pseudo-code git reset --hard “$GIT_REV” git clean -d -x -f if [ -f “.kitchen.ci.yml” ] ; then export KITCHEN_LOCAL_YAML=.kitchen.ci.yml fi bundle install --path vendor/bundle bundle exec kitchen test $KITCHEN_INSTANCE
  14. require “kitchen” loader = Kitchen::Loader::YAML. new(local_config: “.kitchen.ci.yml”) config = Kitchen::Config.

    new(loader: loader) instance = config.instances. get(ENV[“KITCHEN_INSTANCE”]) instance.test
  15. > kitchen test -c # insane pile of output #

    in non-deterministic ordering
  16. # brew install polipo # apt-get install polipo > polipo

    \ proxyAddress='0.0.0.0' \ disableIndexing='false' \ disableServersList='false' \ allowedClients='0.0.0.0/0' \ diskCacheRoot='~/.polipo-cache'
  17. Fast when you want it to be, easy to disable

    caching when timing Chef runs, etc.
  18. --- # in a platform platforms: - name: freebsd-9.2 driver:

    name: vagrant provisioner: name: chef_zero
  19. --- # in a suite suites: - name: server driver:

    name: vagrant provisioner: name: chef_zero