mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2026-08-06 01:44:41 +02:00
test(inspec): verify map.jinja dump
We store validated `map.jinja` dump under the profile `files`
directory to access them with `inspec.profile.file('filename')` to
validate the content of the generated mapdata file.
The YAML files contain a value specific to each minion, its hostname,
so we use string format to expand `%{hostname}`.
The `default` inspec profile need to depends on `share` to access the
`system` and `salt_minion` libraries.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Replace per minion strings
|
||||
replacement = {
|
||||
hostname: system.hostname
|
||||
}
|
||||
|
||||
mapdata_file = "mapdata/#{system.platform[:finger].split('.').first}.yaml"
|
||||
mapdata_dump = inspec.profile.file(mapdata_file) % replacement
|
||||
|
||||
control '`map.jinja` YAML dump' do
|
||||
title 'should contain the lines'
|
||||
|
||||
describe file('/tmp/salt_mapdata_dump.yaml') do
|
||||
it { should exist }
|
||||
its('content') { should include mapdata_dump }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user