diff options
| author | Luke Kanies <luke@madstop.com> | 2008-04-08 18:21:18 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-04-08 18:21:18 -0500 |
| commit | bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc (patch) | |
| tree | d79ae6e23667f0a1b201537914a025c9f677aa74 /spec/integration/node | |
| parent | 644d6baae132a097170631f90521e878e31a5a0a (diff) | |
| download | puppet-bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc.tar.gz puppet-bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc.tar.xz puppet-bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc.zip | |
Intermediate commit.
This commit adds a Request instance into the indirection,
pushing it all the way to the terminus instances. It's
a big commit because it requires modifying every terminus class.
There are still some thorny design issues. In particular, who
should be responsible for making the request object? I've tried
having both the indirection class and the Indirector module creating
it, and both have their issues.
Also, the Catalog class previously allowed passing Node instances
directly to the find method, which is now no longer possible because
the Request class would treat the node as the instance being found.
We need the request class to have two modes, one when it's passed an
instance and one when it's passed a key.
Diffstat (limited to 'spec/integration/node')
| -rwxr-xr-x | spec/integration/node/catalog.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/integration/node/catalog.rb b/spec/integration/node/catalog.rb new file mode 100755 index 000000000..d0ddfd8aa --- /dev/null +++ b/spec/integration/node/catalog.rb @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +# +# Created by Luke Kanies on 2007-10-18. +# Copyright (c) 2007. All rights reserved. + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Node::Catalog do + describe "when using the indirector" do + after { Puppet::Node::Catalog.indirection.clear_cache } + + it "should be able to delegate to the :yaml terminus" do + Puppet::Node::Catalog.indirection.stubs(:terminus_class).returns :yaml + + # Load now, before we stub the exists? method. + Puppet::Node::Catalog.indirection.terminus(:yaml) + + file = File.join(Puppet[:yamldir], "catalog", "me.yaml") + FileTest.expects(:exist?).with(file).returns false + Puppet::Node::Catalog.find("me").should be_nil + end + + it "should be able to delegate to the :compiler terminus" do + Puppet::Node::Catalog.indirection.stubs(:terminus_class).returns :compiler + + # Load now, before we stub the exists? method. + compiler = Puppet::Node::Catalog.indirection.terminus(:compiler) + + compiler.expects(:compile).with("me").returns nil + + Puppet::Node::Catalog.find("me").should be_nil + end + end +end |
