Merge pull request #238 from baby-gnu/test/pillar-top-from-file

test(pillar): use static test/salt/pillar/top.sls
This commit is contained in:
Imran Iqbal 2021-11-16 22:05:24 +00:00 committed by GitHub
commit 939e422e8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 91 additions and 81 deletions

View file

@ -197,8 +197,8 @@ default-amazonlinux-2-master-py3: {extends: '.test_instance'}
default-oraclelinux-8-master-py3: {extends: '.test_instance'}
default-oraclelinux-7-master-py3: {extends: '.test_instance'}
default-arch-base-latest-master-py3: {extends: '.test_instance'}
gentoo-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
gentoo-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
default-almalinux-8-master-py3: {extends: '.test_instance'}
default-rockylinux-8-master-py3: {extends: '.test_instance'}
# default-debian-11-3003-3-py3: {extends: '.test_instance'}
@ -217,8 +217,8 @@ default-rockylinux-8-master-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3003-3-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3003-3-py3: {extends: '.test_instance'}
# default-arch-base-latest-3003-3-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-3003-3-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-3003-3-py3: {extends: '.test_instance'}
# default-gentoo-stage3-latest-3003-3-py3: {extends: '.test_instance'}
# default-gentoo-stage3-systemd-3003-3-py3: {extends: '.test_instance'}
# default-almalinux-8-3003-3-py3: {extends: '.test_instance'}
# default-debian-11-3002-7-py3: {extends: '.test_instance'}
# default-debian-10-3002-7-py3: {extends: '.test_instance'}
@ -236,8 +236,8 @@ default-rockylinux-8-master-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3002-7-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3002-7-py3: {extends: '.test_instance'}
# default-arch-base-latest-3002-7-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-3002-7-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-3002-7-py3: {extends: '.test_instance'}
# default-gentoo-stage3-latest-3002-7-py3: {extends: '.test_instance'}
# default-gentoo-stage3-systemd-3002-7-py3: {extends: '.test_instance'}
# default-debian-10-3001-8-py3: {extends: '.test_instance'}
# default-debian-9-3001-8-py3: {extends: '.test_instance'}
# default-ubuntu-2004-3001-8-py3: {extends: '.test_instance'}
@ -253,8 +253,8 @@ default-rockylinux-8-master-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3001-8-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3001-8-py3: {extends: '.test_instance'}
# default-arch-base-latest-3001-8-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-3001-8-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-3001-8-py3: {extends: '.test_instance'}
# default-gentoo-stage3-latest-3001-8-py3: {extends: '.test_instance'}
# default-gentoo-stage3-systemd-3001-8-py3: {extends: '.test_instance'}
###############################################################################
# `release` stage: `semantic-release`

View file

@ -122,8 +122,8 @@ jobs:
- env: INSTANCE=default-oraclelinux-8-master-py3
- env: INSTANCE=default-oraclelinux-7-master-py3
- env: INSTANCE=default-arch-base-latest-master-py3
- env: INSTANCE=gentoo-gentoo-stage3-latest-master-py3
- env: INSTANCE=gentoo-gentoo-stage3-systemd-master-py3
- env: INSTANCE=default-gentoo-stage3-latest-master-py3
- env: INSTANCE=default-gentoo-stage3-systemd-master-py3
- env: INSTANCE=default-almalinux-8-master-py3
- env: INSTANCE=default-rockylinux-8-master-py3
# - env: INSTANCE=default-debian-11-3003-3-py3
@ -142,8 +142,8 @@ jobs:
# - env: INSTANCE=default-oraclelinux-8-3003-3-py3
# - env: INSTANCE=default-oraclelinux-7-3003-3-py3
# - env: INSTANCE=default-arch-base-latest-3003-3-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3003-3-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3003-3-py3
# - env: INSTANCE=default-gentoo-stage3-latest-3003-3-py3
# - env: INSTANCE=default-gentoo-stage3-systemd-3003-3-py3
# - env: INSTANCE=default-almalinux-8-3003-3-py3
# - env: INSTANCE=default-debian-11-3002-7-py3
# - env: INSTANCE=default-debian-10-3002-7-py3
@ -161,8 +161,8 @@ jobs:
# - env: INSTANCE=default-oraclelinux-8-3002-7-py3
# - env: INSTANCE=default-oraclelinux-7-3002-7-py3
# - env: INSTANCE=default-arch-base-latest-3002-7-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3002-7-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3002-7-py3
# - env: INSTANCE=default-gentoo-stage3-latest-3002-7-py3
# - env: INSTANCE=default-gentoo-stage3-systemd-3002-7-py3
# - env: INSTANCE=default-debian-10-3001-8-py3
# - env: INSTANCE=default-debian-9-3001-8-py3
# - env: INSTANCE=default-ubuntu-2004-3001-8-py3
@ -178,8 +178,8 @@ jobs:
# - env: INSTANCE=default-oraclelinux-8-3001-8-py3
# - env: INSTANCE=default-oraclelinux-7-3001-8-py3
# - env: INSTANCE=default-arch-base-latest-3001-8-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3001-8-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3001-8-py3
# - env: INSTANCE=default-gentoo-stage3-latest-3001-8-py3
# - env: INSTANCE=default-gentoo-stage3-systemd-3001-8-py3
# <REMOVEME
# Test the conversion of `template-formula` into another formula

View file

@ -25,6 +25,7 @@
/test/integration/**/libraries/system.rb @saltstack-formulas/ssf
/test/integration/**/inspec.yml @saltstack-formulas/ssf
/test/integration/**/README.md @saltstack-formulas/ssf
/test/salt/pillar/top.sls @saltstack-formulas/ssf
/.gitignore @saltstack-formulas/ssf
/.cirrus.yml @saltstack-formulas/ssf
/.gitlab-ci.yml @saltstack-formulas/ssf

View file

@ -17,6 +17,8 @@ provisioner:
salt_copy_filter:
- .kitchen
- .git
pillars_from_directories:
- test/salt/pillar
platforms:
## SALT `tiamat`
@ -373,60 +375,12 @@ verifier:
suites:
- name: default
excludes:
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3003-3-py3
- gentoo-stage3-systemd-3003-3-py3
- gentoo-stage3-latest-3002-7-py3
- gentoo-stage3-systemd-3002-7-py3
- gentoo-stage3-latest-3001-8-py3
- gentoo-stage3-systemd-3001-8-py3
provisioner:
state_top:
base:
'*':
- TEMPLATE._mapdata
- TEMPLATE
pillars:
top.sls:
base:
'*':
- TEMPLATE
- define_roles
pillars_from_files:
TEMPLATE.sls: pillar.example
define_roles.sls: test/salt/pillar/define_roles.sls
verifier:
inspec_tests:
- path: test/integration/default
- name: gentoo
includes:
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3003-3-py3
- gentoo-stage3-systemd-3003-3-py3
- gentoo-stage3-latest-3002-7-py3
- gentoo-stage3-systemd-3002-7-py3
- gentoo-stage3-latest-3001-8-py3
- gentoo-stage3-systemd-3001-8-py3
provisioner:
state_top:
base:
'*':
- TEMPLATE._mapdata
- TEMPLATE
pillars:
top.sls:
base:
'*':
- TEMPLATE
- gentoo
- define_roles
pillars_from_files:
TEMPLATE.sls: pillar.example
gentoo.sls: test/salt/pillar/gentoo.sls
define_roles.sls: test/salt/pillar/define_roles.sls
verifier:
inspec_tests:
- path: test/integration/default

View file

@ -4,9 +4,6 @@
TEMPLATE:
lookup:
master: template-master
# Just for testing purposes
winner: lookup
added_in_lookup: lookup_value
# Using bash package and udev service as an example. This allows us to
# test the template formula itself. You should set these parameters to
@ -30,28 +27,18 @@ TEMPLATE:
- osfinger
- os
- os_family
# All aspects of path/file resolution are customisable using the options below.
# This is unnecessary in most cases; there are sensible defaults.
# Default path: salt://< path_prefix >/< dirs.files >/< dirs.default >
# I.e.: salt://TEMPLATE/files/default
# I.e.: salt://TEMPLATE/files/default
# path_prefix: template_alt
# dirs:
# files: files_alt
# default: default_alt
# The entries under `source_files` are prepended to the default source files
# given for the state
# source_files:
# TEMPLATE-config-file-file-managed:
# - 'example_alt.tmpl'
# - 'example_alt.tmpl.jinja'
# For testing purposes
source_files:
TEMPLATE-config-file-file-managed:
- 'example.tmpl.jinja'
TEMPLATE-subcomponent-config-file-file-managed:
- 'subcomponent-example.tmpl.jinja'
# Just for testing purposes
winner: pillar
added_in_pillar: pillar_value
- 'example_alt.tmpl'
- 'example_alt.tmpl.jinja'

View file

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
TEMPLATE:
lookup:
master: template-master
# Just for testing purposes
winner: lookup
added_in_lookup: lookup_value
# Using bash package and udev service as an example. This allows us to
# test the template formula itself. You should set these parameters to
# examples that make sense in the contexto of the formula you're writing.
pkg:
name: bash
service:
name: systemd-journald
config: /etc/template-formula.conf
tofs:
# The files_switch key serves as a selector for alternative
# directories under the formula files directory. See TOFS pattern
# doc for more info.
# Note: Any value not evaluated by `config.get` will be used literally.
# This can be used to set custom paths, as many levels deep as required.
files_switch:
- any/path/can/be/used/here
- id
- roles
- osfinger
- os
- os_family
# All aspects of path/file resolution are customisable using the options below.
# This is unnecessary in most cases; there are sensible defaults.
# Default path: salt://< path_prefix >/< dirs.files >/< dirs.default >
# I.e.: salt://TEMPLATE/files/default
# path_prefix: template_alt
# dirs:
# files: files_alt
# default: default_alt
# The entries under `source_files` are prepended to the default source files
# given for the state
# source_files:
# TEMPLATE-config-file-file-managed:
# - 'example_alt.tmpl'
# - 'example_alt.tmpl.jinja'
# For testing purposes
source_files:
TEMPLATE-config-file-file-managed:
- 'example.tmpl.jinja'
TEMPLATE-subcomponent-config-file-file-managed:
- 'subcomponent-example.tmpl.jinja'
# Just for testing purposes
winner: pillar
added_in_pillar: pillar_value

11
test/salt/pillar/top.sls Normal file
View file

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
base:
'*':
- default
'G@os_family:Gentoo':
- gentoo
'os:*':
- define_roles
...