Reputation: 161
I have a cookbook setting up a Splunk Forwarder. I've created a number of integration - serverspec tests for the configuration files. One in particular, /opt/splunkforwarder/etc/apps/search/local/inputs.conf
keeps failing all the tests the other files are passing. My code looks like this:
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
Every file and directory in this spec file passes except for /opt/splunkforwarder/etc/apps/search/local/inputs.conf
. I'm using a Docker instance and Test Kitchen so when I log in I find:
Exactly like several of the other files. Additionally, I can see from the standard out of my Chef convergence the file getting created with the correct permissions and ownership as well as content.
I've checked to see if one of the parent directories is not owned correctly or has different permissions than the other files that pass but that isn't the case.
I have no idea why this is not passing.
Upvotes: 1
Views: 85
Reputation: 777
I suspect that typo in the test is your enemy.
describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf
}') do
Try to remove that bracket and run test again.
Upvotes: 2