Skip to content

Commit

Permalink
fix(rubocop): add fixes using rubocop -a --safe [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Dec 21, 2019
1 parent 0dd9bd3 commit 9d2966f
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 146 deletions.
51 changes: 26 additions & 25 deletions test/integration/default/controls/config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Set defaults, use debian as base

conf_user = 'bind'
Expand All @@ -17,7 +18,7 @@

# Override by OS
case os[:name]
when 'arch','redhat', 'centos', 'fedora', 'amazon'
when 'arch', 'redhat', 'centos', 'fedora', 'amazon'
conf_user = 'named'
conf_group = 'named'
keys_group = 'root'
Expand All @@ -28,8 +29,8 @@
keys_mode = '0755'
conf_mode = '0640'
config = '/etc/named.conf'
when 'suse', 'opensuse'
conf_user = 'root'
when 'suse', 'opensuse'
conf_user = 'root'
conf_group = 'named'
logs_user = 'root'
logs_group = 'root'
Expand All @@ -47,11 +48,11 @@
# Override log directory by OS
case os[:name]
when 'arch', 'ubuntu'
log_directory = '/var/log/named'
log_directory = '/var/log/named'
when 'redhat', 'centos', 'fedora', 'amazon'
log_directory = '/var/named/data'
log_directory = '/var/named/data'
when 'suse', 'opensuse'
log_directory = '/var/log'
log_directory = '/var/log'
end

# Check main config dir
Expand Down Expand Up @@ -101,28 +102,28 @@
# RHEL: Doesn't use .options and has rfc1912.zones
# Debian: Uses .options
case os[:name]
when 'arch','redhat', 'centos', 'fedora', 'amazon'
when 'arch', 'redhat', 'centos', 'fedora', 'amazon'
control 'File ' + config do
title 'should exist'
title 'should exist'
describe file(config) do
its('owner') { should eq conf_user }
its('owner') { should eq conf_user }
its('group') { should eq conf_group }
its('mode') { should cmp conf_mode }
its('content') { should match /^include\ "\/etc\/named\.rfc1912\.zones";/ }
its('content') { should match /^include\ "\/etc\/named\.conf\.local";/ }
end
its('content') { should match %r{^include\ "/etc/named\.rfc1912\.zones";} }
its('content') { should match %r{^include\ "/etc/named\.conf\.local";} }
end
end
when 'ubuntu', 'debian'
control 'File ' + config do
title 'should exist'
title 'should exist'
describe file(config) do
its('owner') { should eq conf_user }
its('owner') { should eq conf_user }
its('group') { should eq conf_group }
its('mode') { should cmp conf_mode }
its('content') { should match /^include\ "\/etc\/bind\/named\.conf\.local";/ }
its('content') { should match /^include\ "\/etc\/bind\/named\.conf\.options";/ }
end
its('content') { should match %r{^include\ "/etc/bind/named\.conf\.local";} }
its('content') { should match %r{^include\ "/etc/bind/named\.conf\.options";} }
end
end
end

# If debian check the .options file
Expand Down Expand Up @@ -154,20 +155,20 @@
# the #{foo} is a ruby string expansion so we can use the variables
# defined above
# Match example.com zone from the pillar
its('content') { should match /^zone\ "example\.com"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/example\.com";\n\ \ \n\ \ update-policy\ {\n\ \ \ \ grant\ core_dhcp\ name\ dns_entry_allowed_to_update\.\ ANY;\n\ \ \};\n\ \ notify\ no;\n\};/ }
its('content') { should match %r{^zone\ "example\.com"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/example\.com";\n\ \ \n\ \ update-policy\ {\n\ \ \ \ grant\ core_dhcp\ name\ dns_entry_allowed_to_update\.\ ANY;\n\ \ \};\n\ \ notify\ no;\n\};} }
# Match example.net from pillar
its('content') { should match /^zone\ "example\.net"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/example\.net";\n\ \ \n\ \ notify\ no;\n\};/ }
its('content') { should match %r{^zone\ "example\.net"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/example\.net";\n\ \ \n\ \ notify\ no;\n\};} }
# Match example.org from pillar
its('content') { should match /^zone\ "example\.org"\ {\n\ \ type\ slave;\n\ \ file\ "#{zones_directory}\/";\n\ \ \n\ \ notify\ no;\n\ \ masters\ \{\n\ \ \ \ 192\.0\.2\.1;\n\ \ \ \ 192\.0\.2\.2;\n\ \ \};\n\};/ }
its('content') { should match %r{^zone\ "example\.org"\ {\n\ \ type\ slave;\n\ \ file\ "#{zones_directory}/";\n\ \ \n\ \ notify\ no;\n\ \ masters\ \{\n\ \ \ \ 192\.0\.2\.1;\n\ \ \ \ 192\.0\.2\.2;\n\ \ \};\n\};} }
# Match 113.0.203 reverse zone from pillar
its('content') { should match /^zone\ "113\.0\.203\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/113\.0\.203\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};/ }
its('content') { should match %r{^zone\ "113\.0\.203\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/113\.0\.203\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};} }
# Match 100.51.198 reverse zone from pillar
its('content') { should match /^zone\ "100\.51\.198\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/100\.51\.198\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};/ }
its('content') { should match %r{^zone\ "100\.51\.198\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/100\.51\.198\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};} }
# Match logging
its('content') { should match /^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}\/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};/ }
its('content') { should match %r{^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};} }
# Match acl1
its('content') { should match /acl\ client1\ \{\n\ \ 127\.0\.0\.0\/8;\n\ \ 10\.20\.0\.0\/16;\n\};/ }
its('content') { should match %r{acl\ client1\ \{\n\ \ 127\.0\.0\.0/8;\n\ \ 10\.20\.0\.0/16;\n\};} }
# Match acl2
its('content') { should match /^acl\ client2\ \{\n\ \ 10\.30\.0\.0\/8;\n\};/ }
its('content') { should match %r{^acl\ client2\ \{\n\ \ 10\.30\.0\.0/8;\n\};} }
end
end
14 changes: 7 additions & 7 deletions test/integration/default/controls/pkgs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# frozen_string_literal: true

case os[:name]
when 'arch'
os_packages = %w(
os_packages = %w[
bind
bind-tools
dnssec-tools
)
]
when 'redhat', 'centos', 'fedora', 'amazon'
os_packages = %w(bind)
os_packages = %w[bind]
when 'suse', 'opensuse'
os_packages = %w(bind)
os_packages = %w[bind]
when 'debian', 'ubuntu'
os_packages = %w(
os_packages = %w[
bind9
bind9utils
)
]
end

control 'Bind9 packages' do
Expand All @@ -26,4 +27,3 @@
end
end
end

5 changes: 3 additions & 2 deletions test/integration/default/controls/service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

case os[:name]
when 'arch','redhat', 'centos', 'fedora', 'amazon'
when 'arch', 'redhat', 'centos', 'fedora', 'amazon'
service = 'named'
when 'suse', 'opensuse'
service = 'named'
Expand All @@ -12,7 +13,7 @@
title 'should be running'

describe service(service) do
# it { should be_enabled }
# it { should be_enabled }
it { should be_running }
end
end
Loading

0 comments on commit 9d2966f

Please sign in to comment.