forked from saltstack-formulas/openssh-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(_mapdata_spec): perform comparison using
describe yaml
instead
- Loading branch information
Showing
2 changed files
with
16 additions
and
9 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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml" | ||
mapdata_dump = inspec.profile.file(mapdata_file) | ||
require 'yaml' | ||
|
||
# Replace per minion strings | ||
replacement = { | ||
hostname: system.hostname | ||
} | ||
|
||
control '`map.jinja` YAML dump' do | ||
title 'should contain the lines' | ||
title 'should contain exactly the same data as the comparison file' | ||
|
||
mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml" | ||
mapdata_dump = YAML.safe_load(inspec.profile.file(mapdata_file) % replacement) | ||
|
||
describe file('/tmp/salt_mapdata_dump.yaml') do | ||
it { should exist } | ||
its('content') { should eq mapdata_dump } | ||
describe yaml('/tmp/salt_mapdata_dump.yaml').params do | ||
it { should eq mapdata_dump } | ||
end | ||
end |