summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorChristian Hofstaedtler <hofstaedtler@inqnet.at>2009-04-28 13:30:48 +0000
committerJames Turnbull <james@lovedthanlost.net>2009-05-02 09:13:29 +1000
commitd85d73c570a60891607d2ce5b42dba4617f4ca6c (patch)
tree7debe0a95267268606bbbe810e7b05d7d4215e58 /spec/unit
parentd6be4e1206e9285dee9fc4d8cde9608c029d4001 (diff)
downloadpuppet-d85d73c570a60891607d2ce5b42dba4617f4ca6c.tar.gz
puppet-d85d73c570a60891607d2ce5b42dba4617f4ca6c.tar.xz
puppet-d85d73c570a60891607d2ce5b42dba4617f4ca6c.zip
puppetmasterd can now run as a standard Rack application (config.ru-style)
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/application/puppetmasterd.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/unit/application/puppetmasterd.rb b/spec/unit/application/puppetmasterd.rb
index 5b193ebbf..df6f87895 100644
--- a/spec/unit/application/puppetmasterd.rb
+++ b/spec/unit/application/puppetmasterd.rb
@@ -131,6 +131,14 @@ describe "PuppetMaster" do
@puppetmasterd.run_setup
end
+ it "should set syslog as the log destination if --rack" do
+ @puppetmasterd.options.stubs(:[]).with(:rack).returns(:true)
+
+ Puppet::Log.expects(:newdestination).with(:syslog)
+
+ @puppetmasterd.run_setup
+ end
+
it "should print puppet config if asked to in Puppet config" do
@puppetmasterd.stubs(:exit)
Puppet.settings.stubs(:print_configs?).returns(true)
@@ -255,6 +263,8 @@ describe "PuppetMaster" do
@puppetmasterd.run_preinit
@server = stub_everything 'server'
Puppet::Network::Server.stubs(:new).returns(@server)
+ @app = stub_everything 'app'
+ Puppet::Network::HTTP::Rack.stubs(:new).returns(@app)
Puppet::SSL::Host.stubs(:localhost)
Puppet::SSL::CertificateAuthority.stubs(:ca?)
Process.stubs(:uid).returns(1000)
@@ -325,6 +335,37 @@ describe "PuppetMaster" do
@puppetmasterd.main
end
+ describe "with --rack" do
+ confine "Rack is not available" => Puppet.features.rack?
+
+ it "it should create the app with REST and XMLRPC support" do
+ @puppetmasterd.options.stubs(:[]).with(:rack).returns(:true)
+
+ Puppet::Network::HTTP::Rack.expects(:new).with { |args|
+ args[:xmlrpc_handlers] == [:Status, :FileServer, :Master, :Report, :Filebucket] and
+ args[:protocols] == [:rest, :xmlrpc]
+ }
+
+ @puppetmasterd.main
+ end
+
+ it "it should not start a daemon" do
+ @puppetmasterd.options.stubs(:[]).with(:rack).returns(:true)
+
+ @daemon.expects(:start).never
+
+ @puppetmasterd.main
+ end
+
+ it "it should return the app" do
+ @puppetmasterd.options.stubs(:[]).with(:rack).returns(:true)
+
+ app = @puppetmasterd.main
+ app.should equal(@app)
+ end
+
+ end
+
end
end
end