diff options
author | Luke Kanies <luke@madstop.com> | 2008-07-18 00:54:59 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-07-18 16:41:54 +1000 |
commit | d8937acb8c9b108e61330cbac703a17b2eaba9b3 (patch) | |
tree | 2e962357a87a10cd7eb76dadf752dd2b57e0c340 /test | |
parent | a0fa09f6ee562dd1b61fe56dd4b914419d641986 (diff) | |
download | puppet-d8937acb8c9b108e61330cbac703a17b2eaba9b3.tar.gz puppet-d8937acb8c9b108e61330cbac703a17b2eaba9b3.tar.xz puppet-d8937acb8c9b108e61330cbac703a17b2eaba9b3.zip |
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 <luke@madstop.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/network/handler/master.rb | 34 |
1 files changed, 34 insertions, 0 deletions
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 |