mirror of
https://github.com/saltstack-formulas/template-formula.git
synced 2025-04-17 10:10:28 +00:00
test(inspec): verify map.jinja
dump
We store `map.jinja` dump files under the profile `files` directory to access them with `inspec.profile.file('filename')` to validate the content of the generated mapdata file. The `default` inspec profile needs to depend on `share` to access the `system` library.
This commit is contained in:
parent
64c2b6cdae
commit
3dc28bfb34
16 changed files with 500 additions and 0 deletions
21
test/integration/default/controls/_mapdata_spec.rb
Normal file
21
test/integration/default/controls/_mapdata_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Replace per minion strings
|
||||
replacement = {
|
||||
hostname: system.hostname
|
||||
}
|
||||
|
||||
# Keep only first 2 digits from Ubuntu finger
|
||||
mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml"
|
||||
|
||||
# Load the mapdata from profile https://docs.chef.io/inspec/profiles/#profile-files
|
||||
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 eq mapdata_dump }
|
||||
end
|
||||
end
|
34
test/integration/default/files/_mapdata/amazonlinux-1.yaml
Normal file
34
test/integration/default/files/_mapdata/amazonlinux-1.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Amazon Linux AMI-2018
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: cronie
|
||||
rootgroup: root
|
||||
service:
|
||||
name: crond
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/amazonlinux-2.yaml
Normal file
34
test/integration/default/files/_mapdata/amazonlinux-2.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Amazon Linux-2
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Arch
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/centos-6.yaml
Normal file
34
test/integration/default/files/_mapdata/centos-6.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# CentOS-6
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: cronie
|
||||
rootgroup: root
|
||||
service:
|
||||
name: crond
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/centos-7.yaml
Normal file
34
test/integration/default/files/_mapdata/centos-7.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# CentOS Linux-7
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/centos-8.yaml
Normal file
34
test/integration/default/files/_mapdata/centos-8.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# CentOS Linux-8
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/debian-10.yaml
Normal file
34
test/integration/default/files/_mapdata/debian-10.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Debian-10
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/debian-9.yaml
Normal file
34
test/integration/default/files/_mapdata/debian-9.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Debian-9
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/fedora-31.yaml
Normal file
34
test/integration/default/files/_mapdata/fedora-31.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-31
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/fedora-32.yaml
Normal file
34
test/integration/default/files/_mapdata/fedora-32.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-32
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/opensuse-15.yaml
Normal file
34
test/integration/default/files/_mapdata/opensuse-15.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Leap-15
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/ubuntu-16.yaml
Normal file
34
test/integration/default/files/_mapdata/ubuntu-16.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Ubuntu-16.04
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/ubuntu-18.yaml
Normal file
34
test/integration/default/files/_mapdata/ubuntu-18.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Ubuntu-18.04
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
34
test/integration/default/files/_mapdata/ubuntu-20.yaml
Normal file
34
test/integration/default/files/_mapdata/ubuntu-20.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# Ubuntu-20.04
|
||||
---
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
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
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
|
@ -6,6 +6,9 @@ title: TEMPLATE formula
|
|||
maintainer: SaltStack Formulas
|
||||
license: Apache-2.0
|
||||
summary: Verify that the TEMPLATE formula is setup and configured correctly
|
||||
depends:
|
||||
- name: share
|
||||
path: test/integration/share
|
||||
supports:
|
||||
- platform-name: debian
|
||||
- platform-name: ubuntu
|
||||
|
|
Loading…
Add table
Reference in a new issue