From 85ab45fcb13ec0da3eb74c316369f1a9d1fbcba8 Mon Sep 17 00:00:00 2001 From: Ken Barber Date: Tue, 25 Oct 2011 10:10:42 +0100 Subject: [PATCH] (#10263) Fix tests on Puppet 2.6.x Due to the lack of Puppet::Test::LogCollector class, tests fail on puppet 2.6.x. Instead of just using the class, I'm testing its existance first and only using it if it exists. Otherwise, I'm going to fall back to 2.6.x methodology. This seems to make tests work on 2.6.7 (and up) and 2.7.1 (and up) which is sufficient for now. --- spec/spec_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 79fda18..8e9fbdb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -54,7 +54,13 @@ RSpec.configure do |config| Puppet.settings[:bindaddress] = "127.0.0.1" @logs = [] - Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs)) + # This tests allows the spec_helper to be >2.6.7 and >2.7.1 compatible + # as the Puppet::Test::LogCollector facility wasn't available until 2.7.x + if Puppet.const_defined?("Test") and Puppet::Test.const_defined?("LogCollector") + Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs)) + else + Puppet::Util::Log.newdestination(@logs) + end @log_level = Puppet::Util::Log.level end -- 2.45.2