diff options
| author | Max Martin <max@puppetlabs.com> | 2011-04-07 11:29:54 -0700 |
|---|---|---|
| committer | Max Martin <max@puppetlabs.com> | 2011-04-07 11:29:54 -0700 |
| commit | da4457be4dedaed5368bacf81a08f0429e21cd45 (patch) | |
| tree | 5c6149ed872d33f1f6711bac8a5b43f6dbd71a4a /spec/unit/node | |
| parent | 1e4968e82a65b21ad5d075015830ef3f54efee05 (diff) | |
| parent | f7c6db9409e479ec1b54cfa85daa1ee51e5a7ad0 (diff) | |
| download | puppet-da4457be4dedaed5368bacf81a08f0429e21cd45.tar.gz puppet-da4457be4dedaed5368bacf81a08f0429e21cd45.tar.xz puppet-da4457be4dedaed5368bacf81a08f0429e21cd45.zip | |
Merge branch '2.6.next' into 2.6.x
* 2.6.next:
Fix #4339 - Locally save the last report to $lastrunreport
Fix #4339 - Save a last run report summary to $statedir/last_run_summary.yaml
Fixed #3127 - removed legacy debug code
Fixed #3127 - Fixed gem selection regex
(#5437) Invalidate cached TypeCollection when there was an error parsing
(#6937) Adjust formatting of recurse's desc
(#6937) Document the recurse parameter of File type.
(#6893) Document the cron type in the case of specials.
(#5670) Don't trigger refresh from a failed resource
Fixed #6554 - Missing $haveftool if/else conditional in install.rb breaking Ruby 1.9
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/environment_spec.rb | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index 6edcce56c..6109007b9 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -85,28 +85,29 @@ describe Puppet::Node::Environment do @env.known_resource_types.should equal(@collection) end - it "should give to all threads the same collection if it didn't change" do - Puppet::Resource::TypeCollection.expects(:new).with(@env).returns @collection - @env.known_resource_types + it "should give to all threads using the same environment the same collection if the collection isn't stale" do + original_thread_type_collection = Puppet::Resource::TypeCollection.new(@env) + Puppet::Resource::TypeCollection.expects(:new).with(@env).returns original_thread_type_collection + @env.known_resource_types.should equal(original_thread_type_collection) + + original_thread_type_collection.expects(:require_reparse?).returns(false) + Puppet::Resource::TypeCollection.stubs(:new).with(@env).returns @collection t = Thread.new { - @env.known_resource_types.should equal(@collection) + @env.known_resource_types.should equal(original_thread_type_collection) } t.join end - it "should give to new threads a new collection if it isn't stale" do - Puppet::Resource::TypeCollection.expects(:new).with(@env).returns @collection - @env.known_resource_types.expects(:stale?).returns(true) - - Puppet::Resource::TypeCollection.expects(:new).returns @collection + it "should generate a new TypeCollection if the current one requires reparsing" do + old_type_collection = @env.known_resource_types + old_type_collection.stubs(:require_reparse?).returns true + Thread.current[:known_resource_types] = nil + new_type_collection = @env.known_resource_types - t = Thread.new { - @env.known_resource_types.should equal(@collection) - } - t.join + new_type_collection.should be_a Puppet::Resource::TypeCollection + new_type_collection.should_not equal(old_type_collection) end - end [:modulepath, :manifestdir].each do |setting| |
