]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(#14755) Stub iptables_version for now so tests run on non-Linux hosts
authorKen Barber <ken@bob.sh>
Wed, 20 Jun 2012 17:26:05 +0000 (18:26 +0100)
committerKen Barber <ken@bob.sh>
Wed, 20 Jun 2012 17:34:55 +0000 (18:34 +0100)
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
spec/unit/puppet/type/firewall_spec.rb

index 899cbb285981ced4582df22b6c81858194940e65..4fab55d0c082cbcf7ef10ef2e24caf8e354cec6f 100644 (file)
@@ -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
index af7d272261cffefe0d66970c5f43d02cc78bfd20..137b199d10d8c3cbc4350fc7b249219cff5fa537 100755 (executable)
@@ -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