From: Colleen Murphy Date: Mon, 27 Oct 2014 20:36:46 +0000 (-0700) Subject: Update tests for EL 7 X-Git-Tag: 1.2.0~1^2~2^2^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ed5dd3e5d0870fe8fe2925c9e5215f18813e7791;p=puppet-modules%2Fpuppetlabs-firewall.git Update tests for EL 7 Without this patch, unit tests make no distinction between EL < 7 and EL 7. This is a problem because the iptables save exec is different between the two operating systems, so the tests will fail for EL 7. This patch fixes the problem by updating the tests to include the new exec command for EL 7. --- diff --git a/spec/unit/puppet/util/firewall_spec.rb b/spec/unit/puppet/util/firewall_spec.rb index e586487..4d6f92c 100644 --- a/spec/unit/puppet/util/firewall_spec.rb +++ b/spec/unit/puppet/util/firewall_spec.rb @@ -143,13 +143,22 @@ describe 'Puppet::Util::Firewall' do subject.persist_iptables(proto) end - it 'should exec for CentOS identified from operatingsystem' do + it 'should exec for CentOS 6 identified from operatingsystem and operatingsystemrelease' do allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil) allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS') + allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('6.5') expect(subject).to receive(:execute).with(%w{/sbin/service iptables save}) subject.persist_iptables(proto) end + it 'should exec for CentOS 7 identified from operatingsystem and operatingsystemrelease' do + allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil) + allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS') + allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('7.0.1406') + expect(subject).to receive(:execute).with(%w{/usr/libexec/iptables/iptables.init save}) + subject.persist_iptables(proto) + end + it 'should exec for Archlinux identified from osfamily' do allow(Facter.fact(:osfamily)).to receive(:value).and_return('Archlinux') expect(subject).to receive(:execute).with(['/bin/sh', '-c', '/usr/sbin/iptables-save > /etc/iptables/iptables.rules'])