From d8937acb8c9b108e61330cbac703a17b2eaba9b3 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 18 Jul 2008 00:54:59 -0500 Subject: You can now select the encoding format when transferring the catalog, with 'yaml' still being the default but 'marshal' being an option. This is because testing has shown drastic performance differences between the two, with up to 70% of compile time being spent in YAML code. Use the 'catalog_format' setting to choose your format, and the setting must be set on the client. Signed-off-by: Luke Kanies --- test/network/handler/master.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test') diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 448667b73..d342af88c 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -56,3 +56,37 @@ class TestMaster < Test::Unit::TestCase @master.getconfig("facts", "yaml", "foo.com") end end + +class TestMasterFormats < Test::Unit::TestCase + def setup + @facts = stub('facts', :save => nil) + Puppet::Node::Facts.stubs(:new).returns(@facts) + + @master = Puppet::Network::Handler.master.new(:Code => "") + @master.stubs(:decode_facts) + + @catalog = stub 'catalog', :extract => "" + Puppet::Node::Catalog.stubs(:find).returns(@catalog) + end + + def test_marshal_can_be_used + @catalog.expects(:extract).returns "myextract" + + Marshal.expects(:dump).with("myextract").returns "eh" + + @master.getconfig("facts", "marshal", "foo.com") + end + + def test_yaml_can_be_used + extract = mock 'extract' + @catalog.expects(:extract).returns extract + + extract.expects(:to_yaml).returns "myaml" + + @master.getconfig("facts", "yaml", "foo.com") + end + + def test_failure_when_non_yaml_or_marshal_is_used + assert_raise(RuntimeError) { @master.getconfig("facts", "blah", "foo.com") } + end +end -- cgit