test(libtofs): “tofs.files_switch” lookup can return a list

We need to verify that “libtofs” works when the “tofs.files_switch”
lookup return a list instead of a single element.

* kitchen.yml (provisioner): copy tests specific pillars into the test
  environment.

* pillar.example (template.tofs.files_switch): lookup for “roles” at
  the end.

* test/salt/pillar/test.sls (roles): list of roles to apply during
  tests.

* test/integration/default/controls/config_spec.rb: add “roles” to the
  list of “tofs.files_switch” items to verify.
This commit is contained in:
Daniel Dehennin 2019-07-24 12:13:53 +02:00
parent f2c6454c2a
commit 13f1728c27
4 changed files with 8 additions and 1 deletions

View file

@ -124,8 +124,10 @@ provisioner:
base:
'*':
- template
- define_roles
pillars_from_files:
template.sls: pillar.example
define_roles.sls: test/salt/pillar/define_roles.sls
verifier:
# https://www.inspec.io/

View file

@ -33,6 +33,7 @@ template:
files_switch:
- any/path/can/be/used/here
- id
- roles
- osfinger
- os
- os_family

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", "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"]}' }
its('content') { should include '"winner": "pillar"}' }
its('content') { should include 'winner of the merge: pillar' }
end

View file

@ -0,0 +1,4 @@
# libtofs.jinja must work with tofs.files_switch looked up list
roles:
- foo
- bar