mirror of
https://github.com/saltstack-formulas/bind-formula.git
synced 2025-04-16 17:50:23 +00:00
Add basic testing scaffold, with travis support
This commit is contained in:
parent
faddeab70e
commit
d1249949a8
6 changed files with 294 additions and 0 deletions
103
.gitignore
vendored
Normal file
103
.gitignore
vendored
Normal file
|
@ -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/
|
115
.kitchen.yml
Normal file
115
.kitchen.yml
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
|
||||||
|
driver_config:
|
||||||
|
use_sudo: false
|
||||||
|
privileged: true
|
||||||
|
provision_command: mkdir -p /run/sshd
|
||||||
|
run_command: /lib/systemd/systemd
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: debian-8
|
||||||
|
- name: debian-9
|
||||||
|
- name: ubuntu-16.04
|
||||||
|
- name: ubuntu-18.04
|
||||||
|
- name: fedora-27
|
||||||
|
- name: centos-7
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: salt_solo
|
||||||
|
log_level: info
|
||||||
|
require_chef: false
|
||||||
|
salt_version: latest
|
||||||
|
formula: bind
|
||||||
|
salt_copy_filter:
|
||||||
|
- .kitchen
|
||||||
|
- .git
|
||||||
|
pillars:
|
||||||
|
top.sls:
|
||||||
|
base:
|
||||||
|
'*':
|
||||||
|
- bind
|
||||||
|
bind.sls:
|
||||||
|
bind:
|
||||||
|
configured_acls:
|
||||||
|
client1:
|
||||||
|
- 127.0.0.0/8
|
||||||
|
- 10.20.0.0/16
|
||||||
|
client2:
|
||||||
|
- 10.30.0.0/8
|
||||||
|
configured_zones:
|
||||||
|
my.zone:
|
||||||
|
type: master
|
||||||
|
notify: False
|
||||||
|
update_policy:
|
||||||
|
- "grant core_dhcp name dns_entry_allowed_to_update. ANY"
|
||||||
|
|
||||||
|
example.com:
|
||||||
|
type: master
|
||||||
|
notify: false
|
||||||
|
available_zones:
|
||||||
|
my.zone:
|
||||||
|
file: my.zone.txt
|
||||||
|
soa:
|
||||||
|
class: IN
|
||||||
|
ns: ns1.example.com
|
||||||
|
contact: hostmaster.example.com
|
||||||
|
serial: 2017041001
|
||||||
|
retry: 600
|
||||||
|
ttl: 8600
|
||||||
|
records:
|
||||||
|
A:
|
||||||
|
ns1: 1.2.3.4
|
||||||
|
mx1:
|
||||||
|
- 1.2.3.228
|
||||||
|
- 1.2.3.229
|
||||||
|
NS:
|
||||||
|
'@':
|
||||||
|
- ns1
|
||||||
|
example.com:
|
||||||
|
file: example.com.txt
|
||||||
|
soa:
|
||||||
|
class: IN
|
||||||
|
ns: ns1.example.com
|
||||||
|
contact: hostmaster.example.com
|
||||||
|
serial: 2017041001
|
||||||
|
retry: 600
|
||||||
|
ttl: 8600
|
||||||
|
records:
|
||||||
|
A:
|
||||||
|
mx1:
|
||||||
|
- 1.2.3.228
|
||||||
|
- 1.2.3.229
|
||||||
|
- 2.3.4.186
|
||||||
|
cat: 2.3.4.188
|
||||||
|
rat: 1.2.3.231
|
||||||
|
live: 1.2.3.236
|
||||||
|
NS:
|
||||||
|
'@':
|
||||||
|
- rat
|
||||||
|
- cat
|
||||||
|
CNAME:
|
||||||
|
ftp: cat.example.com.
|
||||||
|
www: cat.example.com.
|
||||||
|
mail: mx1.example.com.
|
||||||
|
smtp: mx1.example.com.
|
||||||
|
TXT:
|
||||||
|
'@':
|
||||||
|
- '"some_value"'
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
name: inspec
|
||||||
|
sudo: true
|
||||||
|
reporter: cli
|
||||||
|
inspec_tests:
|
||||||
|
- path: test/integration/default
|
||||||
|
|
||||||
|
suites:
|
||||||
|
- name: bind
|
||||||
|
provisioner:
|
||||||
|
state_top:
|
||||||
|
base:
|
||||||
|
'*':
|
||||||
|
- bind
|
||||||
|
- bind.config
|
11
.travis.yml
Normal file
11
.travis.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
sudo: required
|
||||||
|
cache: bundler
|
||||||
|
language: ruby
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- bundle install
|
||||||
|
|
||||||
|
script: bundle exec kitchen verify
|
21
README.rst
21
README.rst
|
@ -85,3 +85,24 @@ Notes
|
||||||
=====
|
=====
|
||||||
|
|
||||||
* When using views all zones must be configured in views!
|
* When using views all zones must be configured in views!
|
||||||
|
|
||||||
|
Salt Compatibility
|
||||||
|
==================
|
||||||
|
|
||||||
|
Tested with:
|
||||||
|
|
||||||
|
* 2017.7.x
|
||||||
|
* 2018.3.x
|
||||||
|
|
||||||
|
OS Compatibility
|
||||||
|
================
|
||||||
|
|
||||||
|
Tested with:
|
||||||
|
|
||||||
|
* Archlinux
|
||||||
|
* CentOS 7
|
||||||
|
* Debian-8
|
||||||
|
* Debian-9
|
||||||
|
* Fedora-27
|
||||||
|
* Ubuntu-16.04
|
||||||
|
* Ubuntu-18.04
|
||||||
|
|
27
test/integration/default/pkgs_spec.rb
Normal file
27
test/integration/default/pkgs_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
case os[:name]
|
||||||
|
when 'arch'
|
||||||
|
os_packages = %w(
|
||||||
|
bind
|
||||||
|
bind-tools
|
||||||
|
dnssec-tools
|
||||||
|
)
|
||||||
|
when 'redhat', 'centos', 'fedora'
|
||||||
|
os_packages = %w(bind)
|
||||||
|
when 'debian', 'ubuntu'
|
||||||
|
os_packages = %w(
|
||||||
|
bind9
|
||||||
|
bind9utils
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
control 'Bind9 packages' do
|
||||||
|
title 'should be installed'
|
||||||
|
|
||||||
|
os_packages.each do |p|
|
||||||
|
describe package(p) do
|
||||||
|
it { should be_installed }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
17
test/integration/default/service_spec.rb
Normal file
17
test/integration/default/service_spec.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
case os[:name]
|
||||||
|
when 'arch','redhat', 'centos', 'fedora'
|
||||||
|
service = 'named'
|
||||||
|
when 'debian', 'ubuntu'
|
||||||
|
service = 'bind9'
|
||||||
|
end
|
||||||
|
|
||||||
|
control 'Bind9 service' do
|
||||||
|
title 'should be running'
|
||||||
|
|
||||||
|
describe service(service) do
|
||||||
|
it { should be_enabled }
|
||||||
|
it { should be_running }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue