summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-11 11:34:51 -0500
committerLuke Kanies <luke@madstop.com>2008-04-11 11:34:51 -0500
commit4aaad26509b2dc9bd45782ec45231e6ea53a4a37 (patch)
treee0715ba0328f149bf030b63a9ce30e3fb57a5d26 /spec
parent2925ad1cb9aa820785afca58c4fb6e34274dadd4 (diff)
downloadpuppet-4aaad26509b2dc9bd45782ec45231e6ea53a4a37.tar.gz
puppet-4aaad26509b2dc9bd45782ec45231e6ea53a4a37.tar.xz
puppet-4aaad26509b2dc9bd45782ec45231e6ea53a4a37.zip
Modified the 'master' handler to use the Catalog class to
compile node configurations, rather than using the Configuration handler, which was never used directly. I removed the Configuration handler as a result. Modified the 'master' handler (responsible for sending configurations to clients) to always return Time.now as its compile date, so configurations will always get recompiled.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/indirector/catalog/compiler.rb54
-rwxr-xr-xspec/unit/parser/resource.rb7
2 files changed, 9 insertions, 52 deletions
diff --git a/spec/unit/indirector/catalog/compiler.rb b/spec/unit/indirector/catalog/compiler.rb
index 57bbcdbd0..083a9ced5 100755
--- a/spec/unit/indirector/catalog/compiler.rb
+++ b/spec/unit/indirector/catalog/compiler.rb
@@ -145,10 +145,10 @@ describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do
it "should return the results of compiling as the catalog" do
config = mock 'config'
- result = mock 'result', :to_transportable => :catalog
+ result = mock 'result'
@compiler.interpreter.expects(:compile).with(@node).returns(result)
- @compiler.find(@request).should == :catalog
+ @compiler.find(@request).should equal(result)
end
it "should benchmark the compile process" do
@@ -160,53 +160,3 @@ describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do
@compiler.find(@request)
end
end
-
-describe Puppet::Node::Catalog::Compiler, " when determining a client's available catalog version" do
- before do
- Puppet::Node::Facts.stubs(:find).returns(nil)
- Facter.stubs(:value).returns("whatever")
- @catalog = Puppet::Node::Catalog::Compiler.new
- @name = "johnny"
- end
-
- it "should provide a mechanism for providing the version of a given client's catalog" do
- @catalog.should respond_to(:version)
- end
-
- it "should use the client's Facts version as the available catalog version if it is the most recent" do
- Puppet::Node::Facts.stubs(:version).with(@name).returns(5)
- Puppet::Node.expects(:version).with(@name).returns(3)
- @catalog.interpreter.stubs(:catalog_version).returns(4)
-
- @catalog.version(@name).should == 5
- end
-
- it "should use the client's Node version as the available catalog version if it is the most recent" do
- Puppet::Node::Facts.stubs(:version).with(@name).returns(3)
- Puppet::Node.expects(:version).with(@name).returns(5)
- @catalog.interpreter.stubs(:catalog_version).returns(4)
-
- @catalog.version(@name).should == 5
- end
-
- it "should use the last parse date as the available catalog version if it is the most recent" do
- Puppet::Node::Facts.stubs(:version).with(@name).returns(3)
- Puppet::Node.expects(:version).with(@name).returns(4)
- @catalog.interpreter.stubs(:catalog_version).returns(5)
-
- @catalog.version(@name).should == 5
- end
-
- it "should return a version of 0 if no information on the node can be found" do
- Puppet::Node.stubs(:find_by_any_name).returns(nil)
- @catalog.version(@name).should == 0
- end
-
- it "should indicate when an update is available even if an input has clock skew" do
- pending "Unclear how to implement this"
- end
-
- it "should not indicate an available update when apparent updates are a result of clock skew" do
- pending "Unclear how to implement this"
- end
-end
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 776e9c742..6b2021916 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -64,6 +64,13 @@ describe Puppet::Parser::Resource do
@resource[:one].should == "yay"
end
+ it "should have a method for converting to a ral resource" do
+ trans = mock 'trans', :to_type => "yay"
+ @resource = mkresource
+ @resource.expects(:to_trans).returns trans
+ @resource.to_type.should == "yay"
+ end
+
describe "when initializing" do
before do
@arguments = {:type => "resource", :title => "testing", :scope => stub('scope', :source => mock('source'))}