3
require File.dirname(__FILE__) + '/../../spec_helper'
5
describe "puppetmasterd" do
7
# Get a safe temporary file
8
file = Tempfile.new("puppetmaster_integration_testing")
14
Puppet.settings[:confdir] = @dir
15
Puppet.settings[:vardir] = @dir
16
Puppet[:certdnsnames] = "localhost"
24
Puppet::SSL::Host.ca_location = :none
26
system("rm -rf %s" % @dir)
31
rundir = File.join(Puppet[:vardir], "run")
32
@pidfile = File.join(rundir, "testing.pid")
34
args += " --confdir %s" % Puppet[:confdir]
35
args += " --rundir %s" % rundir
36
args += " --pidfile %s" % @pidfile
37
args += " --vardir %s" % Puppet[:vardir]
38
args += " --certdnsnames %s" % Puppet[:certdnsnames]
39
args += " --masterport %s" % @@port
40
args += " --user %s" % Puppet::Util::SUIDManager.uid
41
args += " --group %s" % Puppet::Util::SUIDManager.gid
42
args += " --autosign true"
45
def start(addl_args = "")
46
Puppet.settings.mkdir(:manifestdir)
47
Puppet.settings.write(:manifest) do |f|
48
f.puts { "notify { testing: }" }
51
args = arguments + addl_args
53
bin = File.join(File.dirname(__FILE__), "..", "..", "..", "sbin", "puppetmasterd")
54
output = %x{#{bin} #{args}}.chomp
58
if @pidfile and FileTest.exist?(@pidfile)
59
pid = File.read(@pidfile).chomp.to_i
60
Process.kill(:TERM, pid)
64
it "should create a PID file" do
67
FileTest.exist?(@pidfile).should be_true
70
it "should be serving status information over REST"
72
it "should be serving status information over xmlrpc" do
77
client = Puppet::Network::Client.status.new(:Server => "localhost", :Port => @@port)
79
FileUtils.mkdir_p(File.dirname(Puppet[:autosign]))
80
File.open(Puppet[:autosign], "w") { |f|
81
f.puts Puppet[:certname]
85
retval = client.status
90
it "should exit with return code 0 after parsing if --parseonly is set and there are no errors" do
91
start(" --parseonly > /dev/null")
94
ps = Facter["ps"].value || "ps -ef"
96
%x{#{ps}}.chomp.split(/\n/).each { |line|
97
next if line =~ /^puppet/ # skip normal master procs
98
if line =~ /puppetmasterd.+--manifest/
109
it "should exit with return code 1 after parsing if --parseonly is set and there are errors"