0
@@ -59,34 +59,92 @@ describe Puppet::Network::Client::Master, " when retrieving the catalog" do
0
- it "should load the retrieved catalog using YAML" do
0
- @client.stubs(:dostorage)
0
- @client.class.stubs(:facts).returns(@facts)
0
- @master.stubs(:getconfig).returns("myconfig")
0
+ describe "when the catalog format is set to yaml" do
0
+ Puppet.settings.stubs(:value).returns "foo"
0
+ Puppet.settings.stubs(:value).with(:pluginsync).returns false
0
+ Puppet.settings.stubs(:value).with(:configtimeout).returns 10
0
+ Puppet.settings.stubs(:value).with(:factsync).returns false
0
+ Puppet.settings.stubs(:value).with(:catalog_format).returns "yaml"
0
- config = mock 'config'
0
- YAML.expects(:load).with("myconfig").returns(config)
0
+ it "should request a yaml-encoded catalog" do
0
+ @client.stubs(:dostorage)
0
+ @client.class.stubs(:facts).returns(@facts)
0
+ @master.expects(:getconfig).with { |*args| args[1] == "yaml" }
0
- @client.stubs(:setclasses)
0
- config.stubs(:classes)
0
- config.stubs(:to_catalog).returns(config)
0
- config.stubs(:host_config=)
0
- config.stubs(:from_cache).returns(true)
0
+ it "should load the retrieved catalog using YAML" do
0
+ @client.stubs(:dostorage)
0
+ @client.class.stubs(:facts).returns(@facts)
0
+ @master.stubs(:getconfig).returns("myconfig")
0
+ config = mock 'config'
0
+ YAML.expects(:load).with("myconfig").returns(config)
0
+ @client.stubs(:setclasses)
0
+ config.stubs(:classes)
0
+ config.stubs(:to_catalog).returns(config)
0
+ config.stubs(:host_config=)
0
+ config.stubs(:from_cache).returns(true)
0
+ it "should use the cached catalog if the retrieved catalog cannot be converted from YAML" do
0
+ @client.stubs(:dostorage)
0
+ @client.class.stubs(:facts).returns(@facts)
0
+ @master.stubs(:getconfig).returns("myconfig")
0
+ YAML.expects(:load).with("myconfig").raises(ArgumentError)
0
+ @client.expects(:use_cached_config).with(true)
0
- it "should use the cached catalog if the retrieved catalog cannot be converted from YAML" do
0
- @client.stubs(:dostorage)
0
- @client.class.stubs(:facts).returns(@facts)
0
- @master.stubs(:getconfig).returns("myconfig")
0
+ describe "from Marshal" do
0
+ Puppet.settings.stubs(:value).returns "foo"
0
+ Puppet.settings.stubs(:value).with(:pluginsync).returns false
0
+ Puppet.settings.stubs(:value).with(:configtimeout).returns 10
0
+ Puppet.settings.stubs(:value).with(:factsync).returns false
0
+ Puppet.settings.stubs(:value).with(:catalog_format).returns "marshal"
0
- YAML.expects(:load).with("myconfig").raises(ArgumentError)
0
+ it "should load the retrieved catalog using Marshal" do
0
+ @client.stubs(:dostorage)
0
+ @client.class.stubs(:facts).returns(@facts)
0
+ @master.stubs(:getconfig).returns("myconfig")
0
- @client.expects(:use_cached_config).with(true)
0
+ config = mock 'config'
0
+ Marshal.expects(:load).with("myconfig").returns(config)
0
+ @client.stubs(:setclasses)
0
+ config.stubs(:classes)
0
+ config.stubs(:to_catalog).returns(config)
0
+ config.stubs(:host_config=)
0
+ config.stubs(:from_cache).returns(true)
0
+ it "should use the cached catalog if the retrieved catalog cannot be converted from Marshal" do
0
+ @client.stubs(:dostorage)
0
+ @client.class.stubs(:facts).returns(@facts)
0
+ @master.stubs(:getconfig).returns("myconfig")
0
+ Marshal.expects(:load).with("myconfig").raises(ArgumentError)
0
+ @client.expects(:use_cached_config).with(true)
0
it "should set the classes.txt file with the classes listed in the retrieved catalog" do
Comments
No one has commented yet.