serverspec 在一个且只有一个文件上不断失败
serverspec keeps failing on one and only one file
我有一本设置 Splunk 转发器的食谱。我已经创建了许多集成 - 配置文件的 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 所以当我登录时我发现:
- 文件存在
- 文件归"nobody"
所有
- 文件有 600 个权限
与其他几个文件完全一样。此外,我可以从 Chef 收敛的标准中看到,创建的文件具有正确的权限和所有权以及内容。
我已经检查过是否有一个父目录的所有权不正确或与其他通过的文件具有不同的权限,但事实并非如此。
我不知道为什么没有通过。
我怀疑考试错字是你的敌人
describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf
}') do
尝试移除该支架并运行再次测试。
我有一本设置 Splunk 转发器的食谱。我已经创建了许多集成 - 配置文件的 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 所以当我登录时我发现:
- 文件存在
- 文件归"nobody" 所有
- 文件有 600 个权限
与其他几个文件完全一样。此外,我可以从 Chef 收敛的标准中看到,创建的文件具有正确的权限和所有权以及内容。
我已经检查过是否有一个父目录的所有权不正确或与其他通过的文件具有不同的权限,但事实并非如此。
我不知道为什么没有通过。
我怀疑考试错字是你的敌人
describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf
}') do
尝试移除该支架并运行再次测试。