Skip to content

Commit 13f1728

Browse files
committed
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.
1 parent f2c6454 commit 13f1728

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

kitchen.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ provisioner:
124124
base:
125125
'*':
126126
- template
127+
- define_roles
127128
pillars_from_files:
128129
template.sls: pillar.example
130+
define_roles.sls: test/salt/pillar/define_roles.sls
129131

130132
verifier:
131133
# https://www.inspec.io/

pillar.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ template:
3333
files_switch:
3434
- any/path/can/be/used/here
3535
- id
36+
- roles
3637
- osfinger
3738
- os
3839
- os_family

test/integration/default/controls/config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
its('content') { should include '"lookup": {"added_in_lookup": "lookup_value",' }
1515
its('content') { should include '"pkg": {"name": "' }
1616
its('content') { should include '"service": {"name": "' }
17-
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"]}' }
17+
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"]}' }
1818
its('content') { should include '"winner": "pillar"}' }
1919
its('content') { should include 'winner of the merge: pillar' }
2020
end

test/salt/pillar/define_roles.sls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# libtofs.jinja must work with tofs.files_switch looked up list
2+
roles:
3+
- foo
4+
- bar

0 commit comments

Comments
 (0)