$ rake spec
(in /path/to/nlp)/path/to/ruby -S rspec spec/nlp/mecab_spec.rb
FFF
Failures:
1) File "/usr/local/bin/mecab" should be file
Failure/Error: it { should be_file } sudo test -f /usr/local/bin/mecab
expected file? to return true, got false# ./spec/nlp/mecab_spec.rb:4:in `block (2 levels) in <top (required)>' 2) File "/usr/local/bin/mecab" should be executable
Failure/Error: it { should be_executable } sudo stat -c %a /usr/local/bin/mecab
stat: cannot stat `/usr/local/bin/mecab': そのようなファイルやディレクトリはありません expected File "/usr/local/bin/mecab" to be executable # ./spec/nlp/mecab_spec.rb:5:in `block (2 levels) in <top (required)>' 3) File "/usr/local/lib/mecab/dic/ipadic/" should be directory
Failure/Error: it { should be_directory } sudo test -f /usr/local/lib/mecab/dic/ipadic/
expected file? to return true, got false# ./spec/nlp/mecab_spec.rb:9:in `block (2 levels) in <top (required)>'Finished in 0.3636 seconds
3 examples, 3 failures
Failed examples:
rspec ./spec/nlp/mecab_spec.rb:4 # File "/usr/local/bin/mecab" should be filerspec ./spec/nlp/mecab_spec.rb:5 # File "/usr/local/bin/mecab" should be executablerspec ./spec/nlp/mecab_spec.rb:9 # File "/usr/local/lib/mecab/dic/ipadic/" should be directory/path/to/ruby -S rspec spec/nlp/mecab_spec.rb failed
version=node["mecab"]["version"]remote_file"#{Chef::Config[:file_cache_path]}/mecab-#{version}.tar.gz"dosource"http://mecab.googlecode.com/files/mecab-#{version}.tar.gz"checksumnode['mecab']['checksum']mode"0644"not_if{::File.exists?("/usr/local/bin/mecab")}endbash"build_and_install_mecab"douser"root"cwdChef::Config[:file_cache_path]code<<-EOH tar -zxf mecab-#{version}.tar.gz (cd mecab-#{version} && ./configure #{node["mecab"]["configure_options"]}) (cd mecab-#{version} && make && make check && make install) EOHnot_if{::File.exists?("/usr/local/bin/mecab")}end
$ knife solo cook nlp
Running Chef on nlp...
Checking Chef version...
Uploading the kitchen...
Generating solo config...
Running Chef...
Starting Chef Client, version 11.6.0
Compiling Cookbooks...
Converging 2 resources
Recipe: mecab::default
* remote_file[/var/chef/cache/mecab-0.996.tar.gz] action create
- create new file /var/chef/cache/mecab-0.996.tar.gz
- update content in file /var/chef/cache/mecab-0.996.tar.gz from none to e07332
(new content is binary, diff output suppressed) - change mode from '' to '0644' * bash[build_and_install_mecab] action run
- execute "bash""/tmp/chef-script20131127-3321-1d0z02u"Chef Client finished, 2 resources updated
mecabは正しくインストールされたようです.
2回目のテスト実行
ここまで出来たところで,serverspecのテストをもう1度実行してみます.
1234567891011121314151617181920
$ rake spec
(in /path/to/nlp)/path/to/ruby -S rspec spec/nlp/mecab_spec.rb
..F
Failures:
1) File "/usr/local/lib/mecab/dic/ipadic/" should be directory
Failure/Error: it { should be_directory } sudo test -f /usr/local/lib/mecab/dic/ipadic/
expected file? to return true, got false# ./spec/nlp-default/mecab_spec.rb:9:in `block (2 levels) in <top (required)>'Finished in 0.25173 seconds
3 examples, 1 failure
Failed examples:
rspec ./spec/nlp/mecab_spec.rb:9 # File "/usr/local/lib/mecab/dic/ipadic/" should be directory/path/to/ruby -S rspec spec/nlp/mecab_spec.rb failed
Running Chef on nlp...
Checking Chef version...
Uploading the kitchen...
Generating solo config...
Running Chef...
Starting Chef Client, version 11.6.0
Compiling Cookbooks...
Converging 4 resources
Recipe: mecab::default
* remote_file[/var/chef/cache/mecab-0.996.tar.gz] action create (skipped due to not_if) * bash[build_and_install_mecab] action run (skipped due to not_if) * remote_file[/var/chef/cache/mecab-ipadic-2.7.0-20070801.tar.gz] action create
- create new file /var/chef/cache/mecab-ipadic-2.7.0-20070801.tar.gz
- update content in file /var/chef/cache/mecab-ipadic-2.7.0-20070801.tar.gz from none to b62f52
(file sizes exceed 10000000 bytes, diff output suppressed) - change mode from '' to '0644' * bash[build_and_install_ipadic] action run
- execute "bash""/tmp/chef-script20131127-8352-omxnss"Chef Client finished, 2 resources updated
mecab-ipadicは正しくインストールされたようです.
3回目のテスト実行
ここまで出来たところで,serverspecのテストをもう1度実行してみます.
123456
(in /path/to/nlp)/path/to/ruby -S rspec spec/nlp/mecab_spec.rb
...
Finished in 0.34858 seconds
3 examples, 0 failures