summaryrefslogtreecommitdiffstats
path: root/spec/integration/node
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-11 13:01:42 -0500
committerLuke Kanies <luke@madstop.com>2008-04-11 13:01:42 -0500
commitfb05ef3c96038d67a46eb142202af186ad6cb0b3 (patch)
tree148e8b882e5c8104c4f3fa8ecc4288e8608f812d /spec/integration/node
parentb49fb68f768e8b98c555ef0ae08a7bd22f5d36bd (diff)
parentb49fd495622b15f96faf944db1e70cbe9e7fe7c4 (diff)
Merge branch '0.24.x'
Diffstat (limited to 'spec/integration/node')
-rwxr-xr-xspec/integration/node/catalog.rb38
-rwxr-xr-xspec/integration/node/facts.rb45
2 files changed, 83 insertions, 0 deletions
diff --git a/spec/integration/node/catalog.rb b/spec/integration/node/catalog.rb
new file mode 100755
index 000000000..ca14c2ea8
--- /dev/null
+++ b/spec/integration/node/catalog.rb
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+#
+# Created by Luke Kanies on 2007-4-8.
+# Copyright (c) 2008. 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)
+
+ node = mock 'node'
+ node.stub_everything
+
+ Puppet::Node.expects(:find).returns(node)
+ compiler.expects(:compile).with(node).returns nil
+
+ Puppet::Node::Catalog.find("me").should be_nil
+ end
+ end
+end
diff --git a/spec/integration/node/facts.rb b/spec/integration/node/facts.rb
new file mode 100755
index 000000000..c2f876578
--- /dev/null
+++ b/spec/integration/node/facts.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+#
+# Created by Luke Kanies on 2008-4-8.
+# Copyright (c) 2008. All rights reserved.
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Puppet::Node::Facts do
+ describe "when using the indirector" do
+ after { Puppet::Node::Facts.indirection.clear_cache }
+
+ it "should expire any cached node instances when it is saved" do
+ Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml
+ terminus = Puppet::Node::Facts.indirection.terminus(:yaml)
+
+ terminus.expects(:save)
+ Puppet::Node.expects(:expire).with("me")
+
+ facts = Puppet::Node::Facts.new("me")
+ facts.save
+ end
+
+ it "should be able to delegate to the :yaml terminus" do
+ Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml
+
+ # Load now, before we stub the exists? method.
+ Puppet::Node::Facts.indirection.terminus(:yaml)
+
+ file = File.join(Puppet[:yamldir], "facts", "me.yaml")
+ FileTest.expects(:exist?).with(file).returns false
+
+ Puppet::Node::Facts.find("me").should be_nil
+ end
+
+ it "should be able to delegate to the :facter terminus" do
+ Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :facter
+
+ Facter.expects(:to_hash).returns "facter_hash"
+ facts = Puppet::Node::Facts.new("me")
+ Puppet::Node::Facts.expects(:new).with("me", "facter_hash").returns facts
+
+ Puppet::Node::Facts.find("me").should equal(facts)
+ end
+ end
+end