ruby Chef + Kithcen环境でServerspecのテスト実行までの顺序ref:http://qiita.com/ikuwow/items/27397b9675bd50e87b73

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Chef + Kithcen环境でServerspecのテスト実行までの顺序ref:http://qiita.com/ikuwow/items/27397b9675bd50e87b73相关的知识,希望对你有一定的参考价值。

---
driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: centos-6.5

suites:
  - name: default # <- ここです
    run_list:
        - recipe[base]
        - recipe[apache]
    attributes:

$ 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)
$ cd [chefrepoのルート]
$ kitchen test
describe package('vim-common') do
    it { should be_installed }
end
package 'vim' do
  action :install
end
/test/integration/[テストsuite名]/[テストライブラリの名前]/[テストファイル]
/test/integration/default/serverspec/base_spec.rb
/test/integration/default/serverspec/apache_spec.rb
$ gem install serverspec
require 'serverspec'

%w{vim-common tree}.each do |pkg|
    describe package(pkg) do
        it { should be_installed }
    end
end
require 'serverspec'

describe package('httpd24-httpd') do
    it { should be_installed }
end

以上是关于ruby Chef + Kithcen环境でServerspecのテスト実行までの顺序ref:http://qiita.com/ikuwow/items/27397b9675bd50e87b73的主要内容,如果未能解决你的问题,请参考以下文章

Ruby 代码块和 Chef

markdown RinRubyでR言语内の変数をRubyで参照する

特定的 nodejs 版本,opsworks_ruby,aws,chef 12

ruby Nokogiriで要素作成

ruby 水豚でPHPテスト!

ruby 使用Chef特定的版本检查安装.net