]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(#14938) Add more test variations for travis testing
authorKen Barber <ken@bob.sh>
Sun, 10 Jun 2012 14:56:17 +0000 (15:56 +0100)
committerKen Barber <ken@bob.sh>
Sun, 10 Jun 2012 17:22:14 +0000 (18:22 +0100)
Include different variations of Puppet to be tested, and fix any pending issues
so all tests pass.

.travis.yml
gemfiles/gemfile.ci
lib/puppet/type/firewall.rb
spec/spec_helper.rb
spec/unit/puppet/provider/iptables_spec.rb

index 8c744b616915ac56d59afb765ea8e314f88fd6e8..d67d3386af021295fc656da298d560ce7b90f3d6 100644 (file)
@@ -1,11 +1,67 @@
 ---
 language: ruby
-rvm:
-  - 1.8.7
-  - 1.9.2
-  - 1.9.3
 script: rake spec
 notifications:
   email: false
 gemfile:
   - gemfiles/gemfile.ci
+rvm:
+  - 1.8.7
+  - 1.9.2
+  - 1.9.3
+env:
+  # Latest 2.7.x & Facter 1.6.x
+  - BUILD_PUPPET_VER=2.7.14 BUILD_FACTER_VER=1.6.9
+  # Latest 2.6.x & Facter 1.6.x
+  - BUILD_PUPPET_VER=2.6.16 BUILD_FACTER_VER=1.6.9
+
+  # Mageia 2
+  - BUILD_PUPPET_VER=2.7.11 BUILD_FACTER_VER=1.6.6
+  # Ubuntu 12.04
+  - BUILD_PUPPET_VER=2.7.11 BUILD_FACTER_VER=1.6.5
+  # openSUSE 12.1
+  - BUILD_PUPPET_VER=2.7.6 BUILD_FACTER_VER=1.6.0
+  # Ubuntu 11.10 & Mandriva 2011 Contrib
+  - BUILD_PUPPET_VER=2.7.1 BUILD_FACTER_VER=1.5.9
+
+  # RHEL 5/6 EPEL
+  - BUILD_PUPPET_VER=2.6.16 BUILD_FACTER_VER=1.6.6
+  # Mageia 1
+  - BUILD_PUPPET_VER=2.6.8 BUILD_FACTER_VER=1.5.8
+  # Ubuntu 11.04 & openSUSE 11.4
+  - BUILD_PUPPET_VER=2.6.4 BUILD_FACTER_VER=1.5.8
+  # Debian 6 Main & Mandriva 2010 Contrib Backports
+  - BUILD_PUPPET_VER=2.6.2 BUILD_FACTER_VER=1.5.7
+matrix:
+  exclude:
+    # Puppet 2.6.x is not compatible with Ruby 1.9.x
+    - rvm: 1.9.2
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.16 BUILD_FACTER_VER=1.6.9
+    - rvm: 1.9.3
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.16 BUILD_FACTER_VER=1.6.9
+    - rvm: 1.9.2
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.16 BUILD_FACTER_VER=1.6.6
+    - rvm: 1.9.3
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.16 BUILD_FACTER_VER=1.6.6
+    - rvm: 1.9.2
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.8 BUILD_FACTER_VER=1.5.8
+    - rvm: 1.9.3
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.8 BUILD_FACTER_VER=1.5.8
+    - rvm: 1.9.2
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.4 BUILD_FACTER_VER=1.5.8
+    - rvm: 1.9.3
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.4 BUILD_FACTER_VER=1.5.8
+    - rvm: 1.9.2
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.2 BUILD_FACTER_VER=1.5.7
+    - rvm: 1.9.3
+      gemfile: gemfiles/gemfile.ci
+      env: BUILD_PUPPET_VER=2.6.2 BUILD_FACTER_VER=1.5.7
index a5f5fb28c3b918996afcf760411d2a4fd95ab7b7..d98382c5d3851c37585fb2cb8b7b4b8fa8ba0097 100644 (file)
@@ -1,14 +1,11 @@
 source 'http://rubygems.org'
 
-# These are the base gems that facter requires for CI testing. This is a
-# duplicate of what the Puppetlabs Jenkins environment was running at the
-# time this file was created.
-gem 'rspec', '2.9.0'
-gem 'rspec-core', '2.9.0'
-gem 'rspec-expectations', '2.9.0'
-gem 'rspec-mocks', '2.9.0'
-gem 'rake', '0.8.7'
-gem 'mocha', '0.10.5'
+gem 'rspec', '2.10.0'
+gem 'rspec-core', '2.10.1'
+gem 'rspec-expectations', '2.10.0'
+gem 'rspec-mocks', '2.10.1'
+gem 'rake', '0.9.2.2'
+gem 'mocha', '0.11.4'
 gem 'diff-lcs', '1.1.3'
-gem 'puppet', '2.7.6'
-gem 'facter', '1.6.3'
+gem 'puppet', ENV['BUILD_PUPPET_VER']
+gem 'facter', ENV['BUILD_FACTER_VER']
index 9d06e48fbe9893a084eb7e4ee79d247665b0c4e8..5cb9b97f0ed2b657d094cb757ec2bd147430a085 100644 (file)
@@ -428,7 +428,7 @@ Puppet::Type.newtype(:firewall) do
     # States should always be sorted. This normalizes the resource states to
     # keep it consistent with the sorted result from iptables-save.
     def should=(values)
-      @should = super(values).sort
+      @should = super(values).sort_by {|sym| sym.to_s}
     end
 
     def is_to_s(value)
index 8e9fbdba42be9f91db35de91c08141195460600f..c9b0b229a8c8d64b57a8008996f1391970283998 100644 (file)
@@ -69,7 +69,9 @@ RSpec.configure do |config|
     Puppet.settings.clear
     Puppet::Node::Environment.clear
     Puppet::Util::Storage.clear
-    Puppet::Util::ExecutionStub.reset
+    if Puppet::Util.const_defined?("ExecutionStub")
+      Puppet::Util::ExecutionStub.reset
+    end
 
     PuppetSpec::Files.cleanup
 
index b06d2144f47894747dbf37c6b5a3c6cf645dcff7..899cbb285981ced4582df22b6c81858194940e65 100644 (file)
@@ -32,16 +32,6 @@ describe 'iptables provider detection' do
     })
     resource.provider.class.to_s.should == "Puppet::Type::Firewall::ProviderIptables"
   end
-
-  it "should raise a default provider error when there are no commands" do
-    # Stub all commands lookups so they return nothing
-    exists.any_instance.stubs(:which).returns false
-
-    # Instantiate a resource instance and make sure it raises an exception
-    lambda { resource = Puppet::Type.type(:firewall).new({
-      :name => '000 test foo' }) }.should raise_error(Puppet::DevError,
-      "Could not find a default provider for firewall")
-  end
 end
 
 describe 'iptables provider' do
@@ -85,7 +75,7 @@ describe 'iptables provider' do
         # If this option is enabled, make sure the parameters exactly match
         if data[:compare_all] then
           it "the parameter hash keys should be the same as returned by rules_to_hash" do
-            resource.keys.sort.should == data[:params].keys.sort
+            resource.keys.should =~ data[:params].keys
           end
         end