Chef infra 在chefspec中测试windows_包资源时出错

Chef infra 在chefspec中测试windows_包资源时出错,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我有如下厨师资源 windows_package node['besclient']['exe_display_name'] do installer_type :installshield source "#{download_dir}\\BESClient-installer.exe" end runner = ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2',file_cache_path: 'C:

我有如下厨师资源

windows_package node['besclient']['exe_display_name'] do
  installer_type :installshield
  source "#{download_dir}\\BESClient-installer.exe"
end
runner = ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2',file_cache_path: 'C:\Program Files (x86)\BigFix Enterprise')
runner.converge(described_recipe)
其中在属性文件中,我有
default['besclient']['exe\u display\u name']='IBM BigFix Client'
download\u dir=“{Chef::Config[:file\u cache\u path]}\\besclient”

为了测试这一点,我有以下测试

it 'installs a windows_package with attributes' do
     expect(chef_run).to install_windows_package('IBM BigFix Client').with(
     installer_type: :installshield,
     source: "#{download_dir}\\BESClient-installer.exe"
)
end
其中
下载\u dir=“C:\\Program Files(x86)\\BigFix Enterprise\\BESClient”
但这始终会产生以下错误:

besclient::windows
  Windows 2012R2: when all attributes are default
    converges successfully
    installs a windows_package with attributes (FAILED - 1)

Failures:

  1) besclient::windows Windows 2012R2: when all attributes are default installs
 a windows_package with attributes
     Failure/Error:
       expect(chef_run).to install_windows_package('IBM BigFix Client').with(
         installer_type: :installshield,
         source: "#{download_dir}\\BESClient-installer.exe"
       )

       expected "windows_package[IBM BigFix Client]" to have parameters:

         source "C:\\Program Files (x86)\\BigFix Enterprise\\BESClient\\BESClien
t-installer.exe", was "c:\\program files (x86)\\bigfix enterprise\\besclient\\be
sclient-installer.exe"
     # ./spec/unit/recipes/windows_spec.rb:48:in `block (3 levels) in <top (requ
ired)>'

Finished in 4.74 seconds (files took 17.56 seconds to load)
2 examples, 1 failure

Failed examples:

rspec ./spec/unit/recipes/windows_spec.rb:47 # besclient::windows Windows 2012R2
: when all attributes are default installs a windows_package with attributes

source
属性通过一些强制逻辑运行,包括。你必须调整你的测试以匹配