serverpec在一个文件上不断失败



我有一本菜谱设置一个splunk转发器。我为配置文件创建了许多集成-ServerPec测试。一个尤其是一个,/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实例和测试厨房,所以当我登录时,我会发现:

  1. 文件存在
  2. 该文件由"没人"拥有
  3. 该文件有600个权限

完全像其他几个文件一样。此外,我可以从厨师融合的标准中看到文件获得正确的权限和所有权以及内容创建的文件。

我已经检查了一下,查看一个父目录之一是不是正确拥有或与其他文件不同但事实并非如此的权限。

我不知道为什么这不会通过。

我怀疑测试中的错字是您的敌人。

describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf } ') do

尝试删除该括号并再次运行测试。

最新更新