-
Notifications
You must be signed in to change notification settings - Fork 85
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 #34 from netmanagers/master
Add a testing scaffold with `kitchen-ci`, `inspec` and `travis` support
- Loading branch information
Showing
11 changed files
with
289 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a packager | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.kitchen | ||
.kitchen.local.yml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
# For help on this file's format, see https://kitchen.ci/ | ||
driver: | ||
name: docker | ||
|
||
driver_config: | ||
use_sudo: false | ||
privileged: true | ||
provision_command: mkdir -p /run/sshd | ||
|
||
platforms: | ||
- name: debian-9 | ||
driver_config: | ||
# This run_command is required to test systemd services in docker | ||
run_command: /lib/systemd/systemd | ||
provision_command: | ||
- apt-get install udev -y | ||
- name: ubuntu-18.04 | ||
driver_config: | ||
run_command: /lib/systemd/systemd | ||
provision_command: | ||
- apt-get install udev -y | ||
- name: centos-7 | ||
driver_config: | ||
image: centos:7 | ||
run_command: /usr/lib/systemd/systemd | ||
|
||
provisioner: | ||
name: salt_solo | ||
log_level: debug | ||
require_chef: false | ||
salt_version: latest | ||
formula: template | ||
salt_copy_filter: | ||
- .kitchen | ||
- .git | ||
pillars-from-files: | ||
template.sls: pillar.example | ||
pillars: | ||
top.sls: | ||
base: | ||
'*': | ||
- template | ||
state_top: | ||
base: | ||
'*': | ||
- template | ||
|
||
verifier: | ||
# https://www.inspec.io/ | ||
name: inspec | ||
sudo: true | ||
# cli, documentation, html, progress, json, json-min, json-rspec, junit | ||
reporter: | ||
- cli | ||
inspec_tests: | ||
- path: test/integration/default | ||
|
||
suites: | ||
- name: default | ||
# Below is an example where test suites are segregated by os_family | ||
# - name: debian | ||
# excludes: | ||
# - centos-7 | ||
# - name: redhat | ||
# excludes: | ||
# - debian-9 | ||
# - ubuntu-18.04 | ||
# provisioner: | ||
# # You can add dependencies on other formulas to set up this formula's environment | ||
# dependencies: | ||
# - name: epel | ||
# repo: git | ||
# source: https://github.com/saltstack-formulas/epel-formula.git | ||
# state_top: | ||
# base: | ||
# '*': | ||
# - epel | ||
# - template | ||
# pillars: | ||
# top.sls: | ||
# base: | ||
# '*': | ||
# - epel | ||
# - template | ||
# epel.sls: | ||
# disabled: false |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
sudo: required | ||
cache: bundler | ||
language: ruby | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
- bundle install | ||
|
||
env: | ||
matrix: | ||
- INSTANCE: default-debian-9 | ||
- INSTANCE: default-ubuntu-1804 | ||
- INSTANCE: default-centos-7 | ||
|
||
script: | ||
- bundle exec kitchen verify ${INSTANCE} | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source "https://rubygems.org" | ||
|
||
gem "test-kitchen" | ||
gem "kitchen-docker" | ||
gem "kitchen-salt" | ||
gem "kitchen-inspec" | ||
|
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
control 'Template configuration' do | ||
title 'should match desired lines' | ||
|
||
describe file('/etc/template-formula.conf') do | ||
it { should be_file } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its('content') { should include 'This is an example file from SaltStack template-formula.' } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
control 'Template package' do | ||
title 'should be installed' | ||
|
||
describe package('bash') do | ||
it { should be_installed } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
control 'Template service' do | ||
impact 0.5 | ||
title 'should be running and enabled' | ||
|
||
describe service('systemd-udevd') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: template | ||
title: Template Formula | ||
maintainer: Your Name | ||
license: Apache-2.0 | ||
summary: Verify that the template formula is setup and configured correctly | ||
supports: | ||
- os-name: debian | ||
- os-name: centos | ||
- os-name: ubuntu |