Skip to content

Instantly share code, notes, and snippets.

@ikuwow
Last active August 29, 2015 14:08
Show Gist options
  • Save ikuwow/b35a015a2a1558fdc1cd to your computer and use it in GitHub Desktop.
Save ikuwow/b35a015a2a1558fdc1cd to your computer and use it in GitHub Desktop.
Chef+Kithcen環境でServerspecのテスト実行までの手順 ref: http://qiita.com/ikuwow/items/27397b9675bd50e87b73
require 'serverspec'
describe package('httpd24-httpd') do
it { should be_installed }
end
require 'serverspec'
%w{vim-common tree}.each do |pkg|
describe package(pkg) do
it { should be_installed }
end
end
$ gem install serverspec
/test/integration/default/serverspec/base_spec.rb
/test/integration/default/serverspec/apache_spec.rb
/test/integration/[テストsuite名]/[テストライブラリの名前]/[テストファイル]
package 'vim' do
action :install
end
describe package('vim-common') do
it { should be_installed }
end
$ cd [chefrepoのルート]
$ kitchen test
$ 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)
---
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