我有一本食谱,设置了Splunk Forwarder。我已经为配置文件创建了许多集成 - serverspec测试。特别是,/opt/splunkforwarder/etc/apps/search/local/inputs.conf
使其他文件传递的所有测试都失败。我的代码如下所示:
require 'spec_helper'
describe file('/opt/splunkforwarder/etc/apps/search/local/') do
it { should be_directory }
it { should be_owned_by 'nobody' }
it { should be_mode 755 }
end
describe file('/opt/splunkforwarder/etc/system/local/') do
it { should be_directory }
it { should be_owned_by 'nobody' }
it { should be_mode 755 }
end
describe file('/opt/splunkforwarder/etc/system/local/outputs.conf') do
it { should exist }
it { should be_owned_by 'nobody' }
it { should be_mode 600 }
end
describe file('/opt/splunkforwarder/etc/system/local/inputs.conf') do
it { should exist }
it { should be_owned_by 'nobody' }
it { should be_mode 600 }
end
describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf}') do
it { should exist }
it { should be_owned_by 'nobody' }
it { should be_mode 600 }
end
describe file('/opt/splunkforwarder/etc/apps/SplunkUniversalForwarder/default/limits.conf') do
it { should exist }
it { should be_owned_by 'nobody' }
it { should be_mode 444 }
end
describe file('/opt/splunkforwarder/etc/system/local/web.conf') do
it { should exist }
it { should be_owned_by 'nobody' }
it { should be_mode 600 }
end
此规范文件中的每个文件和目录都会通过/opt/splunkforwarder/etc/apps/search/local/inputs.conf
除外。我正在使用Docker实例和Test Kitchen,所以当我登录时,我发现:
与其他几个文件完全一样。此外,我可以从我的Chef融合标准中看到使用正确的权限和所有权以及内容创建的文件。
我已经检查了其中一个父目录是否未正确拥有,或者是否具有与通过的其他文件不同的权限,但事实并非如此。
我不知道为什么这不会过去。
答案 0 :(得分:2)
我怀疑测试中的拼写错误是你的敌人。
describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf
的} 强> ') do
尝试删除该括号并再次运行测试。