Greetings!
Please review the pull request #78: Feature/2.7.x/9051 storeconfig backend should be configurable opened by (daniel-pittman)
Some more information about the pull request:
- Opened: Wed Aug 31 02:30:06 UTC 2011
- Based on: puppetlabs:2.7.x (28c91040dd06afe0de7aaaf00a1f60ae8d0284a1)
- Requested merge: daniel-pittman:feature/2.7.x/9051-storeconfig-backend-should-be-configurable (f898749946195cc4e27c7502b07a25aa57e5abd9)
Description:
Final fixups to make testing, hopefully, pass everywhere by removing ordering dependencies around the indirector terminus and cache class configuration.
Thanks!
The Pull Request Bot
Diff follows:
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 79fda18..c7ac28c 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -36,6 +36,28 @@ RSpec.configure do |config| config.before :each do GC.disable + # We need to preserve the current state of all our indirection cache and + # terminus classes. This is pretty important, because changes to these + # are global and lead to order dependencies in our testing. + # + # We go direct to the implementation because there is no safe, sane public + # API to manage restoration of these to their default values. This + # should, once the value is proved, be moved to a standard API on the + # indirector. + # + # To make things worse, a number of the tests stub parts of the + # indirector. These stubs have very specific expectations that what + # little of the public API we could use is, well, likely to explode + # randomly in some tests. So, direct access. --daniel 2011-08-30 + $saved_indirection_state = {} + indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections) + indirections.each do |indirector| + $saved_indirection_state[indirector.name] = { + :@terminus_class => indirector.instance_variable_get(:@terminus_class), + :@cache_glass => indirector.instance_variable_get(:@cache_class) + } + end + # these globals are set by Application $puppet_application_mode = nil $puppet_application_name = nil @@ -71,6 +93,15 @@ RSpec.configure do |config| Puppet::Util::Log.close_all Puppet::Util::Log.level = @log_level + # Restore the indirector configuration. See before hook. + indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections) + indirections.each do |indirector| + $saved_indirection_state.fetch(indirector.name, {}).each do |variable, value| + indirector.instance_variable_set(variable, value) + end + end + $saved_indirection_state = nil + GC.enable end end diff --git a/spec/unit/face/node_spec.rb b/spec/unit/face/node_spec.rb index 4c6b801..cb36e58 100755 --- a/spec/unit/face/node_spec.rb +++ b/spec/unit/face/node_spec.rb @@ -145,7 +145,7 @@ describe Puppet::Face[:node, '0.0.1'] do describe "when cleaning cached node" do it "should destroy the cached node" do - Puppet::Node::Yaml.any_instance.expects(:destroy) + Puppet::Node.indirection.expects(:destroy).with(@host) subject.clean_cached_node(@host) end end diff --git a/spec/unit/indirector/resource/active_record_spec.rb b/spec/unit/indirector/resource/active_record_spec.rb index 6f8f3b4..5785756 100755 --- a/spec/unit/indirector/resource/active_record_spec.rb +++ b/spec/unit/indirector/resource/active_record_spec.rb @@ -1,7 +1,10 @@ #!/usr/bin/env rspec require 'spec_helper' -require 'sqlite3' rescue nil +begin + require 'sqlite3' +rescue LoadError +end require 'puppet/rails' require 'puppet/node/facts'
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.