summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff McCune <jeff@puppetlabs.com>2012-03-29 16:56:26 -0700
committerJeff McCune <jeff@puppetlabs.com>2012-03-29 16:56:26 -0700
commit6b76c338650a3af5270b6578b5e580f801c34a5b (patch)
tree0381cdd227b4e667b4e2937e460391f666cdabc9
parenta1a5f7487d2009c92f68475c60c2fcaadcfe21e4 (diff)
parent6065628493e775e3e6ddb59f272bd36a9e9fe072 (diff)
downloadpuppet-stdlib-6b76c338650a3af5270b6578b5e580f801c34a5b.tar.gz
puppet-stdlib-6b76c338650a3af5270b6578b5e580f801c34a5b.tar.bz2
Merge branch '2.3.x' into 2.4.x
* 2.3.x: (#13439) Fix test failures with Puppet 2.6.x (#13439) refactor spec helper for compatibility with both puppet 2.7 and master
-rw-r--r--spec/spec_helper.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ad736d8..9c69b53 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -63,22 +63,19 @@ RSpec.configure do |config|
config.before :each do
GC.disable
- # these globals are set by Application
- $puppet_application_mode = nil
- $puppet_application_name = nil
# REVISIT: I think this conceals other bad tests, but I don't have time to
# fully diagnose those right now. When you read this, please come tell me
# I suck for letting this float. --daniel 2011-04-21
Signal.stubs(:trap)
- # Set the confdir and vardir to gibberish so that tests
- # have to be correctly mocked.
- Puppet[:confdir] = "/dev/null"
- Puppet[:vardir] = "/dev/null"
+ # We're using send because this is a private method to communicate it
+ # should only be used for tests. We're testing if it's defined to work
+ # with Puppet 2.6.x which does not have the method.
+ if Puppet.settings.private_methods.include? "initialize_everything_for_tests"
+ Puppet.settings.send(:initialize_everything_for_tests)
+ end
- # Avoid opening ports to the outside world
- Puppet.settings[:bindaddress] = "127.0.0.1"
@logs = []
Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
@@ -87,7 +84,12 @@ RSpec.configure do |config|
end
config.after :each do
- Puppet.settings.clear
+ # We're using send because this is a private method to communicate it
+ # should only be used for tests. We're testing if it's defined to work
+ # with Puppet 2.6.x which does not have the method at all.
+ if Puppet.settings.private_methods.include? "clear_everything_for_tests"
+ Puppet.settings.send(:clear_everything_for_tests)
+ end
Puppet::Node::Environment.clear
Puppet::Util::Storage.clear
Puppet::Util::ExecutionStub.reset if Puppet::Util.constants.include? "ExecutionStub"