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

Casualにインフラテストへ入門した話

 Casualにインフラテストへ入門した話

Testing Casual Talk #2 LT

yudoufu

May 25, 2015
Tweet

More Decks by yudoufu

Other Decks in Technology

Transcript

  1. About me… Daichi Kamemoto (@yudoufu) • DevOps • Go! Go!

    Go! ʕ◔ϖ◔ʔ • PHP / iOS (Obj-C/Swift)
  2. खݩͰςετ͠Α͏ • Test-kitchen • Chef Cookbook༻ͷςετϋʔωε • VMͷىಈɺ൓өɺςετ࣮ߦͳͲ • Serverspec

    • mizzy͞Μ࡞αʔόςετπʔϧ • RSpecͰαʔό಺෦ͷঢ়ଶςετΛهड़ ओʹͬͪ͜
  3. ςετ؀ڥߏங • ྆ํChef DK(Development Kit)ʹؚ·ΕͯΔ • chefίϚϯυͰcookbook࡞ͬͯΈΔͱɻɻɻ % brew cask

    install virtualbox % brew cask install vagrant % brew cask install chafdk % chef generate cookbook test-cookbook
  4. test-cookbook !"" .gitignore !"" .kitchen.yml !"" Berksfile !"" README.md !""

    chefignore !"" metadata.rb !"" recipes # %"" default.rb !"" spec # !"" spec_helper.rb # %"" unit # %"" recipes # %"" default_spec.rb %"" test %"" integration !"" default # %"" serverspec # %"" default_spec.rb %"" helpers %"" serverspec %"" spec_helper.rb ࠷ॳ͔Β ͋Δʂ ࠷ॳ͔Β ͋Δʂ
  5. test-kitchenରԠํ๏ • Gemfileͷ௥Ճͱɺspec_helperͰͷLoad test %"" integration !"" default # %""

    serverspec # !"" Gemfile # %"" default_spec.rb %"" helpers %"" serverspec %"" spec_helper.rb
  6. spec_helperͰLoad • spec_helperͷ಺༰Λमਖ਼ % ${EDITOR} test/integration/helpers/ serverspec/spec_helper.rb ``` require 'serverspec'

    require 'infrataster/rspec' set :backend, :exec Infrataster::Server.define(:app, ‘127.0.0.1') ``` ର৅αʔόΛ ϩʔΧϧʹ