forked from saltstack-formulas/openntpd-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(map): verify
map.jinja
dump using _mapdata
state [skip ci]
* Automated using myii/ssf-formula#275
- Loading branch information
Showing
3 changed files
with
42 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'yaml' | ||
|
||
control '`map.jinja` YAML dump' do | ||
title 'should contain the lines' | ||
title 'should match the comparison file' | ||
|
||
# Strip the `platform[:finger]` version number down to the "OS major release" | ||
mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml" | ||
mapdata_dump = inspec.profile.file(mapdata_file) | ||
|
||
describe file('/tmp/salt_mapdata_dump.yaml') do | ||
it { should exist } | ||
its('content') { should include mapdata_dump } | ||
# Load the mapdata from profile https://docs.chef.io/inspec/profiles/#profile-files | ||
mapdata_dump = YAML.safe_load(inspec.profile.file(mapdata_file)) | ||
|
||
# Derive the location of the dumped mapdata | ||
output_dir = platform[:family] == 'windows' ? '/temp' : '/tmp' | ||
output_file = "#{output_dir}/salt_mapdata_dump.yaml" | ||
|
||
describe 'File content' do | ||
it 'should match profile map data exactly' do | ||
expect(yaml(output_file).params).to eq(mapdata_dump) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters