summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-04-21 01:13:49 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-04-22 14:39:40 +1000
commitd06bd3ede2a5ba0017e90e2937092a986d5b356c (patch)
tree24a5adab88c28642c15b652b7e9805e69d9e9aaa
parentb694b3c0696cc9bd0f109bf0a7c790f592bc6180 (diff)
downloadpuppet-d06bd3ede2a5ba0017e90e2937092a986d5b356c.tar.gz
puppet-d06bd3ede2a5ba0017e90e2937092a986d5b356c.tar.xz
puppet-d06bd3ede2a5ba0017e90e2937092a986d5b356c.zip
Finishing class renames
I missed some of the Catalog mentions, and its constant changed. I've also added tests so this will get caught next time. Signed-off-by: Luke Kanies <luke@madstop.com>
-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