From 8327e6bc3991d179bc4430dea4dca1bbe11a5998 Mon Sep 17 00:00:00 2001 From: Ken Barber Date: Wed, 20 Jun 2012 18:26:05 +0100 Subject: [PATCH] (#14755) Stub iptables_version for now so tests run on non-Linux hosts Without a stub some tests fail on non-Linux hosts. This is because they are expecting a particular version of iptables to exist which isn't always true. The right answer for the provider is to actually allow the fact to be set per test, but for now we are doing a global override just to make tests pass. --- spec/unit/puppet/provider/iptables_spec.rb | 3 +++ spec/unit/puppet/type/firewall_spec.rb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/spec/unit/puppet/provider/iptables_spec.rb b/spec/unit/puppet/provider/iptables_spec.rb index 899cbb2..4fab55d 100644 --- a/spec/unit/puppet/provider/iptables_spec.rb +++ b/spec/unit/puppet/provider/iptables_spec.rb @@ -46,6 +46,9 @@ describe 'iptables provider' do before :each do Puppet::Type::Firewall.stubs(:defaultprovider).returns provider provider.stubs(:command).with(:iptables_save).returns "/sbin/iptables-save" + + # Stub iptables version + Facter.fact(:iptables_version).stubs(:value).returns("1.4.2") end it 'should be able to get a list of existing rules' do diff --git a/spec/unit/puppet/type/firewall_spec.rb b/spec/unit/puppet/type/firewall_spec.rb index af7d272..137b199 100755 --- a/spec/unit/puppet/type/firewall_spec.rb +++ b/spec/unit/puppet/type/firewall_spec.rb @@ -12,6 +12,9 @@ describe firewall do Puppet::Type::Firewall.stubs(:defaultprovider).returns @provider @resource = @class.new({:name => '000 test foo'}) + + # Stub iptables version + Facter.fact(:iptables_version).stubs(:value).returns("1.4.2") end it 'should have :name be its namevar' do -- 2.45.2