Skip to content

Commit a255584

Browse files
authored
Merge pull request #93 from netmanagers/master
Add basic testing scaffold, with travis support
2 parents faddeab + d124994 commit a255584

File tree

6 files changed

+294
-0
lines changed

6 files changed

+294
-0
lines changed

.gitignore

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a packager
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.kitchen
49+
.kitchen.local.yml
50+
51+
# Translations
52+
*.mo
53+
*.pot
54+
55+
# Django stuff:
56+
*.log
57+
local_settings.py
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# dotenv
85+
.env
86+
87+
# virtualenv
88+
.venv
89+
venv/
90+
ENV/
91+
92+
# Spyder project settings
93+
.spyderproject
94+
.spyproject
95+
96+
# Rope project settings
97+
.ropeproject
98+
99+
# mkdocs documentation
100+
/site
101+
102+
# mypy
103+
.mypy_cache/

.kitchen.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
driver:
3+
name: docker
4+
5+
driver_config:
6+
use_sudo: false
7+
privileged: true
8+
provision_command: mkdir -p /run/sshd
9+
run_command: /lib/systemd/systemd
10+
11+
platforms:
12+
- name: debian-8
13+
- name: debian-9
14+
- name: ubuntu-16.04
15+
- name: ubuntu-18.04
16+
- name: fedora-27
17+
- name: centos-7
18+
19+
provisioner:
20+
name: salt_solo
21+
log_level: info
22+
require_chef: false
23+
salt_version: latest
24+
formula: bind
25+
salt_copy_filter:
26+
- .kitchen
27+
- .git
28+
pillars:
29+
top.sls:
30+
base:
31+
'*':
32+
- bind
33+
bind.sls:
34+
bind:
35+
configured_acls:
36+
client1:
37+
- 127.0.0.0/8
38+
- 10.20.0.0/16
39+
client2:
40+
- 10.30.0.0/8
41+
configured_zones:
42+
my.zone:
43+
type: master
44+
notify: False
45+
update_policy:
46+
- "grant core_dhcp name dns_entry_allowed_to_update. ANY"
47+
48+
example.com:
49+
type: master
50+
notify: false
51+
available_zones:
52+
my.zone:
53+
file: my.zone.txt
54+
soa:
55+
class: IN
56+
ns: ns1.example.com
57+
contact: hostmaster.example.com
58+
serial: 2017041001
59+
retry: 600
60+
ttl: 8600
61+
records:
62+
A:
63+
ns1: 1.2.3.4
64+
mx1:
65+
- 1.2.3.228
66+
- 1.2.3.229
67+
NS:
68+
'@':
69+
- ns1
70+
example.com:
71+
file: example.com.txt
72+
soa:
73+
class: IN
74+
ns: ns1.example.com
75+
contact: hostmaster.example.com
76+
serial: 2017041001
77+
retry: 600
78+
ttl: 8600
79+
records:
80+
A:
81+
mx1:
82+
- 1.2.3.228
83+
- 1.2.3.229
84+
- 2.3.4.186
85+
cat: 2.3.4.188
86+
rat: 1.2.3.231
87+
live: 1.2.3.236
88+
NS:
89+
'@':
90+
- rat
91+
- cat
92+
CNAME:
93+
ftp: cat.example.com.
94+
www: cat.example.com.
95+
mail: mx1.example.com.
96+
smtp: mx1.example.com.
97+
TXT:
98+
'@':
99+
- '"some_value"'
100+
101+
verifier:
102+
name: inspec
103+
sudo: true
104+
reporter: cli
105+
inspec_tests:
106+
- path: test/integration/default
107+
108+
suites:
109+
- name: bind
110+
provisioner:
111+
state_top:
112+
base:
113+
'*':
114+
- bind
115+
- bind.config

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
sudo: required
2+
cache: bundler
3+
language: ruby
4+
5+
services:
6+
- docker
7+
8+
before_install:
9+
- bundle install
10+
11+
script: bundle exec kitchen verify

README.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,24 @@ Notes
8585
=====
8686

8787
* When using views all zones must be configured in views!
88+
89+
Salt Compatibility
90+
==================
91+
92+
Tested with:
93+
94+
* 2017.7.x
95+
* 2018.3.x
96+
97+
OS Compatibility
98+
================
99+
100+
Tested with:
101+
102+
* Archlinux
103+
* CentOS 7
104+
* Debian-8
105+
* Debian-9
106+
* Fedora-27
107+
* Ubuntu-16.04
108+
* Ubuntu-18.04
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
case os[:name]
3+
when 'arch'
4+
os_packages = %w(
5+
bind
6+
bind-tools
7+
dnssec-tools
8+
)
9+
when 'redhat', 'centos', 'fedora'
10+
os_packages = %w(bind)
11+
when 'debian', 'ubuntu'
12+
os_packages = %w(
13+
bind9
14+
bind9utils
15+
)
16+
end
17+
18+
control 'Bind9 packages' do
19+
title 'should be installed'
20+
21+
os_packages.each do |p|
22+
describe package(p) do
23+
it { should be_installed }
24+
end
25+
end
26+
end
27+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
case os[:name]
3+
when 'arch','redhat', 'centos', 'fedora'
4+
service = 'named'
5+
when 'debian', 'ubuntu'
6+
service = 'bind9'
7+
end
8+
9+
control 'Bind9 service' do
10+
title 'should be running'
11+
12+
describe service(service) do
13+
it { should be_enabled }
14+
it { should be_running }
15+
end
16+
end
17+

0 commit comments

Comments
 (0)