Last active
August 29, 2015 14:08
-
-
Save ikuwow/b35a015a2a1558fdc1cd to your computer and use it in GitHub Desktop.
Chef+Kithcen環境でServerspecのテスト実行までの手順 ref: http://qiita.com/ikuwow/items/27397b9675bd50e87b73
This file contains hidden or 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' | |
describe package('httpd24-httpd') do | |
it { should be_installed } | |
end |
This file contains hidden or 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' | |
%w{vim-common tree}.each do |pkg| | |
describe package(pkg) do | |
it { should be_installed } | |
end | |
end |
This file contains hidden or 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
$ gem install serverspec |
This file contains hidden or 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
/test/integration/default/serverspec/base_spec.rb | |
/test/integration/default/serverspec/apache_spec.rb |
This file contains hidden or 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
/test/integration/[テストsuite名]/[テストライブラリの名前]/[テストファイル] |
This file contains hidden or 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
package 'vim' do | |
action :install | |
end |
This file contains hidden or 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
describe package('vim-common') do | |
it { should be_installed } | |
end |
This file contains hidden or 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
$ cd [chefrepoのルート] | |
$ kitchen test |
This file contains hidden or 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
$ kitchen verify | |
-----> Starting Kitchen (v1.2.1) | |
-----> Verifying <default-centos-65>... | |
Removing /tmp/busser/suites/serverspec | |
Uploading /tmp/busser/suites/serverspec/apache_spec.rb (mode=0644) | |
Uploading /tmp/busser/suites/serverspec/base_spec.rb (mode=0644) | |
-----> Running serverspec test suite | |
/opt/chef/embedded/bin/ruby -I/tmp/busser/suites/serverspec -I/tmp/busser/gems/gems/rspec-support-3.1.2/lib:/tmp/busser/gems/gems/rspec-core-3.1.7/lib /opt/chef/embedded/bin/rspec --pattern /tmp/busser/suites/serverspec/\*\*/\*_spec.rb --color --format documentation --default-path /tmp/busser/suites/serverspec | |
Package "httpd24-httpd" | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
should be installed | |
Package "vim-common" | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
should be installed | |
Package "tree" | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
No backend type is specified. Fall back to :exec type. | |
should be installed | |
Finished in 0.20124 seconds (files took 0.27194 seconds to load) | |
3 examples, 0 failures | |
Finished verifying <default-centos-65> (0m2.30s). | |
-----> Kitchen is finished. (0m3.81s) |
This file contains hidden or 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
--- | |
driver: | |
name: vagrant | |
provisioner: | |
name: chef_solo | |
platforms: | |
- name: centos-6.5 | |
suites: | |
- name: default # <- ここです | |
run_list: | |
- recipe[base] | |
- recipe[apache] | |
attributes: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment