test(inspec): fix suse/opensuse tests

This commit is contained in:
Eric Veiras Galisson 2019-05-21 22:22:00 +02:00
parent 61bb936721
commit 64872f6ff6
6 changed files with 33 additions and 4 deletions

View file

@ -30,8 +30,8 @@ env:
- INSTANCE: default-opensuse-leap-42-2018-3-py2 - INSTANCE: default-opensuse-leap-42-2018-3-py2
- INSTANCE: default-debian-8-2017-7-py2 - INSTANCE: default-debian-8-2017-7-py2
- INSTANCE: default-ubuntu-1604-2017-7-py2 - INSTANCE: default-ubuntu-1604-2017-7-py2
# TODO: Enable after improving the formula to work with other than `systemd` # # TODO: Enable after improving the formula to work with other than `systemd`
- INSTANCE: default-centos-6-2017-7-py2 # - INSTANCE: default-centos-6-2017-7-py2
- INSTANCE: default-fedora-28-2017-7-py2 - INSTANCE: default-fedora-28-2017-7-py2
- INSTANCE: default-opensuse-leap-42-2017-7-py2 - INSTANCE: default-opensuse-leap-42-2017-7-py2

View file

@ -3,3 +3,4 @@ source "https://rubygems.org"
gem 'kitchen-docker', '>= 2.9' gem 'kitchen-docker', '>= 2.9'
gem 'kitchen-salt', '>= 0.6.0' gem 'kitchen-salt', '>= 0.6.0'
gem 'kitchen-inspec', '>= 1.1' gem 'kitchen-inspec', '>= 1.1'
gem 'train', git: 'https://github.com/n-rodriguez/train.git', branch: 'wip/fix_suse'

View file

@ -6,6 +6,7 @@ keys_user = 'root'
keys_group = conf_group keys_group = conf_group
logs_user = 'root' logs_user = 'root'
logs_group = conf_group logs_group = conf_group
logs_mode = '0775'
named_directory = '/var/cache/bind' named_directory = '/var/cache/bind'
zones_directory = '/var/cache/bind/zones' zones_directory = '/var/cache/bind/zones'
keys_directory = '/etc/bind/keys' keys_directory = '/etc/bind/keys'
@ -27,6 +28,20 @@ when 'arch','redhat', 'centos', 'fedora'
keys_mode = '0755' keys_mode = '0755'
conf_mode = '0640' conf_mode = '0640'
config = '/etc/named.conf' config = '/etc/named.conf'
when 'suse', 'opensuse'
conf_user = 'root'
conf_group = 'named'
logs_user = 'root'
logs_group = 'root'
logs_mode = '0755'
keys_group = 'root'
logs_group = 'root'
named_directory = '/var/lib/named'
zones_directory = '/var/lib/named'
keys_directory = '/etc/named.keys'
keys_mode = '0755'
conf_mode = '0640'
config = '/etc/named.d/named.conf'
end end
# Override log directory by OS # Override log directory by OS
@ -35,6 +50,8 @@ when 'arch', 'ubuntu'
log_directory = '/var/log/named' log_directory = '/var/log/named'
when 'redhat', 'centos', 'fedora' when 'redhat', 'centos', 'fedora'
log_directory = '/var/named/data' log_directory = '/var/named/data'
when 'suse', 'opensuse'
log_directory = '/var/log'
end end
# Check main config dir # Check main config dir
@ -63,7 +80,7 @@ control 'Directory ' + log_directory do
describe directory(log_directory) do describe directory(log_directory) do
its('owner') { should eq logs_user } its('owner') { should eq logs_user }
its('group') { should eq logs_group } its('group') { should eq logs_group }
its('mode') { should cmp '0775' } its('mode') { should cmp logs_mode }
end end
end end

View file

@ -8,6 +8,8 @@ when 'arch'
) )
when 'redhat', 'centos', 'fedora' when 'redhat', 'centos', 'fedora'
os_packages = %w(bind) os_packages = %w(bind)
when 'suse', 'opensuse'
os_packages = %w(bind)
when 'debian', 'ubuntu' when 'debian', 'ubuntu'
os_packages = %w( os_packages = %w(
bind9 bind9

View file

@ -2,6 +2,8 @@
case os[:name] case os[:name]
when 'arch','redhat', 'centos', 'fedora' when 'arch','redhat', 'centos', 'fedora'
service = 'named' service = 'named'
when 'suse', 'opensuse'
service = 'named'
when 'debian', 'ubuntu' when 'debian', 'ubuntu'
service = 'bind9' service = 'bind9'
end end
@ -10,7 +12,7 @@ control 'Bind9 service' do
title 'should be running' title 'should be running'
describe service(service) do describe service(service) do
it { should be_enabled } # it { should be_enabled }
it { should be_running } it { should be_running }
end end
end end

View file

@ -27,6 +27,8 @@ when 'arch','redhat', 'centos', 'fedora'
keys_mode = '0755' keys_mode = '0755'
conf_mode = '0640' conf_mode = '0640'
config = '/etc/named.conf' config = '/etc/named.conf'
when 'suse', 'opensuse'
zones_directory = nil # not implemented
end end
# Override log directory by OS # Override log directory by OS
@ -37,6 +39,8 @@ when 'redhat', 'centos', 'fedora'
log_directory = '/var/named/data' log_directory = '/var/named/data'
end end
if zones_directory
# Test example.com zonefile # Test example.com zonefile
control 'File ' + zones_directory + '/example.com' do control 'File ' + zones_directory + '/example.com' do
title 'should exist' title 'should exist'
@ -157,4 +161,7 @@ control 'File ' + zones_directory + '/100.51.198.in-addr.arpa.include' do
its('content') { should match '6.100.51.198.in-addr.arpa. PTR mx1.example.net.' } its('content') { should match '6.100.51.198.in-addr.arpa. PTR mx1.example.net.' }
its('content') { should match '7.100.51.198.in-addr.arpa. PTR mx1.example.net.' } its('content') { should match '7.100.51.198.in-addr.arpa. PTR mx1.example.net.' }
end end
end
end end