summaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-05-07 12:29:58 -0500
committerLuke Kanies <luke@madstop.com>2008-05-07 12:29:58 -0500
commit330359015602eba83077fccaa708c819d2d78b53 (patch)
treeab124f5ae2a2493218b45b48cb3f07d9c8087f4a /spec/integration
parent8fd68e388aa0b26d2dacc201086960385ff5c834 (diff)
downloadpuppet-330359015602eba83077fccaa708c819d2d78b53.tar.gz
puppet-330359015602eba83077fccaa708c819d2d78b53.tar.xz
puppet-330359015602eba83077fccaa708c819d2d78b53.zip
The master and client now successfully speak xmlrpc using the new system.
The server is actually serving REST, but the client can't use it until we resolve the format and security issues that REST hasn't yet tackled.
Diffstat (limited to 'spec/integration')
-rwxr-xr-xspec/integration/bin/puppetmasterd.rb109
-rwxr-xr-xspec/integration/network/server/webrick.rb2
-rwxr-xr-xspec/integration/ssl/host.rb2
3 files changed, 113 insertions, 0 deletions
diff --git a/spec/integration/bin/puppetmasterd.rb b/spec/integration/bin/puppetmasterd.rb
new file mode 100755
index 000000000..447344472
--- /dev/null
+++ b/spec/integration/bin/puppetmasterd.rb
@@ -0,0 +1,109 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "puppetmasterd" do
+ before do
+ # Get a safe temporary file
+ file = Tempfile.new("puppetmaster_integration_testing")
+ @dir = file.path
+ file.delete
+
+ Dir.mkdir(@dir)
+
+ Puppet.settings[:confdir] = @dir
+ Puppet.settings[:vardir] = @dir
+ Puppet[:certdnsnames] = "localhost"
+
+ @@port = 12345
+ end
+
+ after {
+ stop
+
+ Puppet::SSL::Host.ca_location = :none
+
+ system("rm -rf %s" % @dir)
+ Puppet.settings.clear
+ }
+
+ def arguments
+ rundir = File.join(Puppet[:vardir], "run")
+ @pidfile = File.join(rundir, "testing.pid")
+ args = ""
+ args += " --confdir %s" % Puppet[:confdir]
+ args += " --rundir %s" % rundir
+ args += " --pidfile %s" % @pidfile
+ args += " --vardir %s" % Puppet[:vardir]
+ args += " --certdnsnames %s" % Puppet[:certdnsnames]
+ args += " --masterport %s" % @@port
+ args += " --user %s" % Puppet::Util::SUIDManager.uid
+ args += " --group %s" % Puppet::Util::SUIDManager.gid
+ args += " --autosign true"
+ end
+
+ def start(addl_args = "")
+ Puppet.settings.mkdir(:manifestdir)
+ Puppet.settings.write(:manifest) do |f|
+ f.puts { "notify { testing: }" }
+ end
+
+ args = arguments + addl_args
+
+ output = %x{puppetmasterd #{args}}.chomp
+ end
+
+ def stop
+ if @pidfile and FileTest.exist?(@pidfile)
+ pid = File.read(@pidfile).chomp.to_i
+ Process.kill(:TERM, pid)
+ end
+ end
+
+ it "should create a PID file" do
+ start
+
+ FileTest.exist?(@pidfile).should be_true
+ end
+
+ it "should be serving status information over REST"
+
+ it "should be serving status information over xmlrpc" do
+ start
+
+ sleep 0.5
+
+ client = Puppet::Network::Client.status.new(:Server => "localhost", :Port => @@port)
+
+ FileUtils.mkdir_p(File.dirname(Puppet[:autosign]))
+ File.open(Puppet[:autosign], "w") { |f|
+ f.puts Puppet[:certname]
+ }
+
+ client.cert
+ retval = client.status
+
+ retval.should == 1
+ end
+
+ it "should exit with return code 0 after parsing if --parseonly is set and there are no errors" do
+ start(" --parseonly > /dev/null")
+ sleep(1)
+
+ ps = Facter["ps"].value || "ps -ef"
+ pid = nil
+ %x{#{ps}}.chomp.split(/\n/).each { |line|
+ next if line =~ /^puppet/ # skip normal master procs
+ if line =~ /puppetmasterd.+--manifest/
+ ary = line.split(" ")
+ pid = ary[1].to_i
+ end
+ }
+
+ $?.should == 0
+
+ pid.should be_nil
+ end
+
+ it "should exit with return code 1 after parsing if --parseonly is set and there are errors"
+end
diff --git a/spec/integration/network/server/webrick.rb b/spec/integration/network/server/webrick.rb
index ab9e94605..f2b55ef92 100755
--- a/spec/integration/network/server/webrick.rb
+++ b/spec/integration/network/server/webrick.rb
@@ -28,6 +28,8 @@ describe Puppet::Network::Server do
@tmpfile.delete
Puppet.settings.clear
+ system("rm -rf %s" % @dir)
+
# This is necessary so the terminus instances don't lie around.
Puppet::SSL::Key.indirection.clear_cache
Puppet::SSL::Certificate.indirection.clear_cache
diff --git a/spec/integration/ssl/host.rb b/spec/integration/ssl/host.rb
index 5e457bded..d4834c341 100755
--- a/spec/integration/ssl/host.rb
+++ b/spec/integration/ssl/host.rb
@@ -32,6 +32,8 @@ describe Puppet::SSL::Host do
# This is necessary so the terminus instances don't lie around.
Puppet::SSL::Key.indirection.clear_cache
+ Puppet::SSL::Certificate.indirection.clear_cache
+ Puppet::SSL::CertificateRevocationList.indirection.clear_cache
Puppet::SSL::CertificateRequest.indirection.clear_cache
}