-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from myii/test/compare-mapdata-using-yaml
test(map): standardise `map.jinja` verification
- Loading branch information
Showing
20 changed files
with
962 additions
and
971 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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 eq 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 |
131 changes: 65 additions & 66 deletions
131
test/integration/default/files/_mapdata/amazonlinux-1.yaml
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,70 +1,69 @@ | ||
# yamllint disable rule:indentation rule:line-length | ||
# Amazon Linux AMI-2018 | ||
--- | ||
sudoers: | ||
aliases: | ||
commands: | ||
PROCESSES: | ||
- /usr/bin/nice | ||
- /bin/kill | ||
- /usr/bin/renice | ||
- /usr/bin/pkill | ||
- /usr/bin/top | ||
hosts: | ||
WEBSERVERS: | ||
- www1 | ||
- www2 | ||
- www3 | ||
users: | ||
ADMINS: | ||
- millert | ||
- dowdy | ||
- mikef | ||
arch: amd64 | ||
configpath: /etc | ||
defaults: | ||
command_list: | ||
PROCESSES: noexec | ||
generic: | ||
- env_reset | ||
- mail_badpass | ||
- secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
host_list: | ||
www1: log_year, logfile=/var/log/sudo.log | ||
runas_list: | ||
root: '!set_logname' | ||
user_list: | ||
ADMINS: '!lecture' | ||
johndoe: '!requiretty' | ||
execprefix: /usr/sbin | ||
group: root | ||
groups: | ||
sudo: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(nodejs) NOPASSWD: ALL' | ||
included_files: | ||
/etc/sudoers.d/extra-file: | ||
users: | ||
foo: | ||
- ALL=(ALL) ALL | ||
extra-file-2: | ||
groups: | ||
bargroup: | ||
- 'ALL=(ALL) NOPASSWD: ALL' | ||
extra-file-3: | ||
netgroups: | ||
other_netgroup: | ||
- ALL=(ALL) ALL | ||
includedir: /etc/sudoers.d | ||
manage_main_config: true | ||
netgroups: | ||
sysadmins: | ||
- ALL=(ALL) ALL | ||
pkg: sudo | ||
purge_includedir: false | ||
aliases: | ||
commands: | ||
PROCESSES: | ||
- /usr/bin/nice | ||
- /bin/kill | ||
- /usr/bin/renice | ||
- /usr/bin/pkill | ||
- /usr/bin/top | ||
hosts: | ||
WEBSERVERS: | ||
- www1 | ||
- www2 | ||
- www3 | ||
users: | ||
johndoe: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(root) NOPASSWD: /etc/init.d/httpd' | ||
kitchen: | ||
- 'ALL=(root) NOPASSWD: ALL' | ||
ADMINS: | ||
- millert | ||
- dowdy | ||
- mikef | ||
arch: amd64 | ||
configpath: /etc | ||
defaults: | ||
command_list: | ||
PROCESSES: noexec | ||
generic: | ||
- env_reset | ||
- mail_badpass | ||
- secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
host_list: | ||
www1: log_year, logfile=/var/log/sudo.log | ||
runas_list: | ||
root: '!set_logname' | ||
user_list: | ||
ADMINS: '!lecture' | ||
johndoe: '!requiretty' | ||
execprefix: /usr/sbin | ||
group: root | ||
groups: | ||
sudo: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(nodejs) NOPASSWD: ALL' | ||
included_files: | ||
/etc/sudoers.d/extra-file: | ||
users: | ||
foo: | ||
- ALL=(ALL) ALL | ||
extra-file-2: | ||
groups: | ||
bargroup: | ||
- 'ALL=(ALL) NOPASSWD: ALL' | ||
extra-file-3: | ||
netgroups: | ||
other_netgroup: | ||
- ALL=(ALL) ALL | ||
includedir: /etc/sudoers.d | ||
manage_main_config: true | ||
netgroups: | ||
sysadmins: | ||
- ALL=(ALL) ALL | ||
pkg: sudo | ||
purge_includedir: false | ||
users: | ||
johndoe: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(root) NOPASSWD: /etc/init.d/httpd' | ||
kitchen: | ||
- 'ALL=(root) NOPASSWD: ALL' |
131 changes: 65 additions & 66 deletions
131
test/integration/default/files/_mapdata/amazonlinux-2.yaml
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,70 +1,69 @@ | ||
# yamllint disable rule:indentation rule:line-length | ||
# Amazon Linux-2 | ||
--- | ||
sudoers: | ||
aliases: | ||
commands: | ||
PROCESSES: | ||
- /usr/bin/nice | ||
- /bin/kill | ||
- /usr/bin/renice | ||
- /usr/bin/pkill | ||
- /usr/bin/top | ||
hosts: | ||
WEBSERVERS: | ||
- www1 | ||
- www2 | ||
- www3 | ||
users: | ||
ADMINS: | ||
- millert | ||
- dowdy | ||
- mikef | ||
arch: amd64 | ||
configpath: /etc | ||
defaults: | ||
command_list: | ||
PROCESSES: noexec | ||
generic: | ||
- env_reset | ||
- mail_badpass | ||
- secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
host_list: | ||
www1: log_year, logfile=/var/log/sudo.log | ||
runas_list: | ||
root: '!set_logname' | ||
user_list: | ||
ADMINS: '!lecture' | ||
johndoe: '!requiretty' | ||
execprefix: /usr/sbin | ||
group: root | ||
groups: | ||
sudo: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(nodejs) NOPASSWD: ALL' | ||
included_files: | ||
/etc/sudoers.d/extra-file: | ||
users: | ||
foo: | ||
- ALL=(ALL) ALL | ||
extra-file-2: | ||
groups: | ||
bargroup: | ||
- 'ALL=(ALL) NOPASSWD: ALL' | ||
extra-file-3: | ||
netgroups: | ||
other_netgroup: | ||
- ALL=(ALL) ALL | ||
includedir: /etc/sudoers.d | ||
manage_main_config: true | ||
netgroups: | ||
sysadmins: | ||
- ALL=(ALL) ALL | ||
pkg: sudo | ||
purge_includedir: false | ||
aliases: | ||
commands: | ||
PROCESSES: | ||
- /usr/bin/nice | ||
- /bin/kill | ||
- /usr/bin/renice | ||
- /usr/bin/pkill | ||
- /usr/bin/top | ||
hosts: | ||
WEBSERVERS: | ||
- www1 | ||
- www2 | ||
- www3 | ||
users: | ||
johndoe: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(root) NOPASSWD: /etc/init.d/httpd' | ||
kitchen: | ||
- 'ALL=(root) NOPASSWD: ALL' | ||
ADMINS: | ||
- millert | ||
- dowdy | ||
- mikef | ||
arch: amd64 | ||
configpath: /etc | ||
defaults: | ||
command_list: | ||
PROCESSES: noexec | ||
generic: | ||
- env_reset | ||
- mail_badpass | ||
- secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
host_list: | ||
www1: log_year, logfile=/var/log/sudo.log | ||
runas_list: | ||
root: '!set_logname' | ||
user_list: | ||
ADMINS: '!lecture' | ||
johndoe: '!requiretty' | ||
execprefix: /usr/sbin | ||
group: root | ||
groups: | ||
sudo: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(nodejs) NOPASSWD: ALL' | ||
included_files: | ||
/etc/sudoers.d/extra-file: | ||
users: | ||
foo: | ||
- ALL=(ALL) ALL | ||
extra-file-2: | ||
groups: | ||
bargroup: | ||
- 'ALL=(ALL) NOPASSWD: ALL' | ||
extra-file-3: | ||
netgroups: | ||
other_netgroup: | ||
- ALL=(ALL) ALL | ||
includedir: /etc/sudoers.d | ||
manage_main_config: true | ||
netgroups: | ||
sysadmins: | ||
- ALL=(ALL) ALL | ||
pkg: sudo | ||
purge_includedir: false | ||
users: | ||
johndoe: | ||
- ALL=(ALL) ALL | ||
- 'ALL=(root) NOPASSWD: /etc/init.d/httpd' | ||
kitchen: | ||
- 'ALL=(root) NOPASSWD: ALL' |
Oops, something went wrong.