test(inspec): verify subcomponent configuration file

* test/integration/default/controls/subcomponent_config_spec.rb: the
  subcomponent file must come from the “/subcomponent/files/” directory

* test/integration/default/controls/config_spec.rb: update to match
  the new subcomponent override.
This commit is contained in:
Daniel Dehennin 2019-07-30 16:06:53 +02:00
parent 9b98b3eb6c
commit fd55e03692
2 changed files with 13 additions and 1 deletions

View file

@ -14,7 +14,7 @@ control 'template configuration' do
its('content') { should include '"lookup": {"added_in_lookup": "lookup_value",' }
its('content') { should include '"pkg": {"name": "' }
its('content') { should include '"service": {"name": "' }
its('content') { should include '"tofs": {"files_switch": ["any/path/can/be/used/here", "id", "roles", "osfinger", "os", "os_family"], "source_files": {"template-config-file-file-managed": ["example.tmpl.jinja"]}' }
its('content') { should include '"tofs": {"files_switch": ["any/path/can/be/used/here", "id", "roles", "osfinger", "os", "os_family"], "source_files": {"template-config-file-file-managed": ["example.tmpl.jinja"], "template-subcomponent-config-file-file-managed": ["subcomponent-example.tmpl.jinja"]}' }
its('content') { should include '"arch": "amd64"' }
its('content') { should include '"winner": "pillar"}' }
its('content') { should include 'winner of the merge: pillar' }

View file

@ -0,0 +1,12 @@
control 'template subcomponent configuration' do
title 'should match desired lines'
describe file('/etc/template-subcomponent-formula.conf') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
its('content') { should include '# File managed by Salt at <salt://template/subcomponent/files/default/subcomponent-example.tmpl.jinja>.' }
its('content') { should include 'This is another subcomponent example file from SaltStack template-formula.' }
end
end