From 6ebfc6f20cfd72c2785514ab35484c9575401648 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 1 Apr 2020 17:52:09 +0100 Subject: [PATCH] test(zones_spec): check content of rendered zone files --- .../default/controls/zones_spec.rb | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 test/integration/default/controls/zones_spec.rb diff --git a/test/integration/default/controls/zones_spec.rb b/test/integration/default/controls/zones_spec.rb new file mode 100644 index 0000000..82382ba --- /dev/null +++ b/test/integration/default/controls/zones_spec.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +control 'zones/public.xml configuration' do + title 'should match desired lines' + + describe file('/etc/firewalld/zones/public.xml') do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + its('mode') { should cmp '0644' } + its('content') do + should include <<~ZONE_XML + + Public + For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted. + + + + + + + + + + + + + + + + + + + + + + + + + + ZONE_XML + end + end +end + +control 'zones/rich_public.xml configuration' do + title 'should match desired lines' + + describe file('/etc/firewalld/zones/rich_public.xml') do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + its('mode') { should cmp '0644' } + its('content') do + should include <<~ZONE_XML + + rich_public + Example + + + + + + + + + + + + ZONE_XML + end + end +end