summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector/code
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-05 00:07:38 -0500
committerLuke Kanies <luke@madstop.com>2007-10-05 00:07:38 -0500
commit0e336bf62b818aaa31fcc323ab5d31e5eb92eb46 (patch)
tree2f29d3e668aad2cade6059c74cbba60d60873561 /spec/unit/indirector/code
parent1fa591287a4ab921cec628aa0c5bf58d61fbdef2 (diff)
downloadpuppet-0e336bf62b818aaa31fcc323ab5d31e5eb92eb46.tar.gz
puppet-0e336bf62b818aaa31fcc323ab5d31e5eb92eb46.tar.xz
puppet-0e336bf62b818aaa31fcc323ab5d31e5eb92eb46.zip
This commit is focused on getting the 'puppet' executable
to work. As a result, it involves a lot of integration-level testing, and a lot of small design changes to make the code actually work. In particular, indirections can now have default termini, so that configurations and facts default to their code terminus Also, I've removed the ability to manually control whether ast nodes are used. I might need to add it back in later, but if so it will be in the form of a global setting, rather than the previous system of passing it through 10 different classes. Instead, the parser detects whether there are AST nodes defined and requires them if so or ignores them if not. About 75 tests are still failing in the main set of tests, but it's going to be a long slog to get them working -- there are significant design issues around them, as most of the failures are a result of tests trying to emulate both the client and server sides of a connection, which normally would have different fact termini but in this case must have the same terminus just because they're in the same process and are global. The next step, then, is to figure that process out, thus finding a way to make this all work.
Diffstat (limited to 'spec/unit/indirector/code')
-rwxr-xr-xspec/unit/indirector/code/configuration.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/unit/indirector/code/configuration.rb b/spec/unit/indirector/code/configuration.rb
index 8652f342d..5e2aedc7b 100755
--- a/spec/unit/indirector/code/configuration.rb
+++ b/spec/unit/indirector/code/configuration.rb
@@ -39,6 +39,11 @@ describe Puppet::Indirector::Code::Configuration do
compiler.find('node1')
compiler.find('node2')
end
+
+ it "should provide a method for determining if the configuration is networked" do
+ compiler = Puppet::Indirector::Code::Configuration.new
+ compiler.should respond_to(:networked?)
+ end
end
describe Puppet::Indirector::Code::Configuration, " when creating the interpreter" do
@@ -70,7 +75,6 @@ describe Puppet::Indirector::Code::Configuration, " when creating the interprete
Puppet::Parser::Interpreter.expects(:new).with(:Code => code).returns(interp)
@compiler.send(:interpreter).should equal(interp)
end
-
end
describe Puppet::Indirector::Code::Configuration, " when finding nodes" do
@@ -132,10 +136,17 @@ describe Puppet::Indirector::Code::Configuration, " when creating configurations
before do
@compiler = Puppet::Indirector::Code::Configuration.new
@name = "me"
- @node = stub 'node', :merge => nil, :name => @name, :environment => "yay"
+ @node = Puppet::Node.new @name, :environment => "yay"
+ @node.stubs(:merge)
Puppet::Node.stubs(:search).with(@name).returns(@node)
end
+ it "should directly use provided nodes" do
+ Puppet::Node.expects(:search).never
+ @compiler.interpreter.expects(:compile).with(@node)
+ @compiler.find(@node)
+ end
+
it "should pass the found node to the interpreter for compiling" do
config = mock 'config'
@compiler.interpreter.expects(:compile).with(@node)
@@ -149,6 +160,7 @@ describe Puppet::Indirector::Code::Configuration, " when creating configurations
end
it "should benchmark the compile process" do
+ @compiler.stubs(:networked?).returns(true)
@compiler.expects(:benchmark).with do |level, message|
level == :notice and message =~ /^Compiled configuration/
end