summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/defaults.rb4
-rwxr-xr-xspec/integration/defaults.rb57
2 files changed, 59 insertions, 2 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index ba9697411..a1af82f8e 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -175,7 +175,7 @@ module Puppet
Puppet.settings[:storeconfigs] = true
# But then we modify the configuration
- Puppet::Node::Catalog.cache_class = :queue
+ Puppet::Resource::Catalog.cache_class = :queue
else
raise "Cannot disable asynchronous storeconfigs in a running process"
end
@@ -704,7 +704,7 @@ module Puppet
require 'puppet/node/facts'
require 'puppet/resource/catalog'
if value
- Puppet::Node::Catalog.cache_class = :active_record unless Puppet.settings[:async_storeconfigs]
+ Puppet::Resource::Catalog.cache_class = :active_record unless Puppet.settings[:async_storeconfigs]
Puppet::Node::Facts.cache_class = :active_record
Puppet::Node.cache_class = :active_record
end
diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb
index 46b5fd64e..66693818f 100755
--- a/spec/integration/defaults.rb
+++ b/spec/integration/defaults.rb
@@ -92,4 +92,61 @@ describe "Puppet defaults" do
ENV["PATH"].split(File::PATH_SEPARATOR).should be_include("/sbin")
end
end
+
+ describe "when enabling storeconfigs" do
+ before do
+ Puppet::Resource::Catalog.stubs(:cache_class=)
+ Puppet::Node::Facts.stubs(:cache_class=)
+ Puppet::Node.stubs(:cache_class=)
+ end
+
+ it "should set the Catalog cache class to :active_record" do
+ Puppet::Resource::Catalog.expects(:cache_class=).with(:active_record)
+ Puppet.settings[:storeconfigs] = true
+ end
+
+ it "should not set the Catalog cache class to :active_record if asynchronous storeconfigs is enabled" do
+ Puppet::Resource::Catalog.expects(:cache_class=).with(:active_record).never
+ Puppet.settings.expects(:value).with(:async_storeconfigs).returns true
+ Puppet.settings[:storeconfigs] = true
+ end
+
+ it "should set the Facts cache class to :active_record" do
+ Puppet::Node::Facts.expects(:cache_class=).with(:active_record)
+ Puppet.settings[:storeconfigs] = true
+ end
+
+ it "should set the Node cache class to :active_record" do
+ Puppet::Node.expects(:cache_class=).with(:active_record)
+ Puppet.settings[:storeconfigs] = true
+ end
+ end
+
+ describe "when enabling asynchronous storeconfigs" do
+ before do
+ Puppet::Resource::Catalog.stubs(:cache_class=)
+ Puppet::Node::Facts.stubs(:cache_class=)
+ Puppet::Node.stubs(:cache_class=)
+ end
+
+ it "should set storeconfigs to true" do
+ Puppet.settings[:async_storeconfigs] = true
+ Puppet.settings[:storeconfigs].should be_true
+ end
+
+ it "should set the Catalog cache class to :queue" do
+ Puppet::Resource::Catalog.expects(:cache_class=).with(:queue)
+ Puppet.settings[:async_storeconfigs] = true
+ end
+
+ it "should set the Facts cache class to :active_record" do
+ Puppet::Node::Facts.expects(:cache_class=).with(:active_record)
+ Puppet.settings[:storeconfigs] = true
+ end
+
+ it "should set the Node cache class to :active_record" do
+ Puppet::Node.expects(:cache_class=).with(:active_record)
+ Puppet.settings[:storeconfigs] = true
+ end
+ end
end