Hi Chef Testing Gurus!
I am working on implementing some of the cool new techniques that I learned at chefconf last week and I am running into a few roadblocks. I am hoping that some of you on here have seen similar issues before and help me get un-stuck. I have been trying to get this simple example working for the better part of a day now and the errors I am getting from the serverspec run simply don't mean much to me. I have tried using google to find answers but all the suggested fixes I have come across have led to different errors.
I am using test-kitchen with the Vagrant driver and vagrant is using the vmware_workstation plugin to deploy VMs. I am able to successfully spin up new VMs using kitchen create <suite-name>-sles11sp3 and converge the node using kitchen converge <suite-name>-sles11sp3, and I am even able to run the setup task to create the busser and setup the serverspec plugin on the target host. All my issues come into play with the verify step of the process. It seems as though the error changes based on what I have in my spec_helper.rb. I started with the contents that we used in the training and that produced the following error.
spec_helper.rb
require 'serverspec'
include Serverspec::Helper::Exec
connector_spec.rb
require 'spec_helper'
describe 'connector' do
it 'should have created a log4j.properties file' do
expect(file '/usr/local/horizon/conf/log4j.properties').to be_installed
end
it 'should have enabled the horizon-workspace service on runlevel 3' do
expect(service 'horizon-workspace').to be_enabled.with_level(3)
end
it 'should have installed the c2-rpm package' do
expect(package 'c2-rpm').to be_installed
end
end
Output from Kitchen Verify
I then went on to try some other configurations in my spec_helper.rb. Seeing as though I am using Vagrant I thought maybe the exec helper was not the right thing. I change my spec_helper to use Serverspec::Helper::Ssh however this yielded the same error message when I tried to run it. I was then reading the serverspec documentation where I saw another example of how I should be setting up my spec_helper.rb...
spec_helper.rb (from serverspec docs)
require 'serverspec'
require 'pathname'
require 'net/ssh'
include Serverspec::Helper::Ssh
include Serverspec::Helper::RedHat
Output from verify (different than the last error)
The last configuration I tried I got from reading the documentation on the
vagrant-serverspec github page. This configuration also did not work.
spec_helper.rb
require 'serverspec'
require 'pathname'
require 'net/ssh'
include SpecInfra::Helper::Ssh
include SpecInfra::Helper::DetectOS
Output from verify
Please help me guys! I have tried everything I can think of and I feel like I am running in circles. I must be missing something here but what?
Thanks,
Scott