InSpec でテストを作成しています。これはApacheの私のテストです:
require 'inspec'
if os[:family] == 'redhat'
describe package 'httpd' do
it { should be_installed }
end
describe service 'httpd' do
it { should be_enabled }
it { should be_running }
end
describe file '/etc/httpd/conf/httpd.conf' do
it { should be_file }
end
end
describe port(80) do
it { should_not be_listening }
end
describe port(9000) do
it { should be_listening }
end
私の質問は文脈に関連しています。InSpec の前は ChefSpec を使用していましたが、コンテキストを作成して出力にコンテキストを表示する方法が気に入っています。上記の例の場合、出力は次のようになります。
System Package
✔ httpd should be installed
Service httpd
✔ should be enabled
✔ should be running
File /etc/httpd/conf/httpd.conf
✔ should be file
Port 80
✔ should not be listening
Port 9000
✔ should be listening
私のテストのより明確な出力を知り、得るために、ファミリのフレーバー、バージョン、またはアーキテクチャを出力に含めたいと思います。
なにか提案を?