Inspec file matcher windows


Hi Chefs

Up to now we have always used serverspec for our integration tests but we have decided to give inspec a try as its the new kid in town but fallen at the first hurdle!

I can’t seem to get the file matcher to work. We are running on server 2012R2 with test kitchen 1.5 and inspec 0.14.2 (chefdk 0.11.2)

My default_spec is very simple and just contains a single file matcher…(the file exists on the node!)

describe file('c:/chef/win32_eventlog_handler.rb') do
  it { should exist }

It fails with the error below. I have tried using single and double quotes with forward, backslashes and escaped backslashes.


  1) File c:/chef/win32_eventlog_handler.rb should exist
       { "#{NS_ADDRESSING}:To" => "#{@xfer.endpoint.to_s}",
         "#{NS_ADDRESSING}:ReplyTo" => {
         "#{NS_ADDRESSING}:Address" => '',
           :attributes! => {"#{NS_ADDRESSING}:Address" => {'mustUnderstand' => true}}},
         "#{NS_WSMAN_DMTF}:MaxEnvelopeSize" => @max_env_sz,
         "#{NS_ADDRESSING}:MessageID" => "uuid:#{SecureRandom.uuid.to_s.upcase}",
         "#{NS_WSMAN_DMTF}:Locale/" => '',
         "#{NS_WSMAN_MSFT}:DataLocale/" => '',
         "#{NS_WSMAN_DMTF}:OperationTimeout" => @timeout,
         :attributes! => {

       undefined method `endpoint' for nil:NilClass
     # ./test/integration/member/default_spec.rb:7:in `block (2 levels) in load'

Finished in 0.04304 seconds (files took 0.36036 seconds to load)


Yes this is a known issue with inspec on windows test instances using Test-Kitchen 1.5. Its addressed in Test-Kitchen 1.6. See this post on how to update to tk 1.6. A new Chef-dk is not far off that will come with 1.6.


Hi Matt

Thanks fdor such a quick and accurate response. It worked like a dream!




@davidmcgrath Also we had some issues with whitespace in the paths as discusses in This is fixed with the latest inspec version as well.