Last active
August 29, 2015 14:24
-
-
Save marcy-terui/b06051bd824995cb8244 to your computer and use it in GitHub Desktop.
Test-KitchenでShell-VerifierとDockerCli-Driverで高速にServerspecテストを回す ref: http://qiita.com/Marcy/items/8a85ae78a21787f57bca
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
provisioner: | |
name: chef_zero | |
platforms: | |
- name: ubuntu-14.04 | |
suites: | |
- name: vagrant | |
driver: | |
name: vagrant | |
run_list: | |
- recipe[example::default] | |
# デフォルトのbusserでServerspec実行 | |
- name: docker_cli | |
driver: | |
name: docker_cli | |
transport: | |
name: docker_cli | |
run_list: | |
- recipe[example::default] | |
verifier: | |
name: shell | |
command: ./bin/rspec test/integration/docker_cli/serverspec/example_spec.rb | |
# ローカルからshell-verifierでServerspec実行 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute 'apt-get update -y' do | |
user 'root' | |
end | |
package 'nginx' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time ./bin/kitchen converge docker-cli -l warn | |
real 1m27.959s | |
user 0m3.111s | |
sys 0m0.603s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'serverspec' | |
set :backend, :docker | |
set :docker_container, ENV['KITCHEN_CONTAINER_ID'] | |
describe package('nginx') do | |
it { should be_installed } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem 'kitchen-verifier-shell' | |
gem 'kitchen-docker_cli' | |
gem 'kitchen-vagrant' | |
gem 'serverspec' | |
gem 'docker-api' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time ./bin/kitchen converge vagrant -l warn | |
real 2m46.553s | |
user 0m6.068s | |
sys 0m2.041s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment