diff options
author | Luke Kanies <luke@puppetlabs.com> | 2010-04-12 10:26:36 -0700 |
---|---|---|
committer | Luke Kanies <luke@puppetlabs.com> | 2010-04-12 10:26:36 -0700 |
commit | fa64774e60940e1118b5ca496387d2eb0545acb2 (patch) | |
tree | ea8803cca6d025e1fdff5b47640736d4e296709c /spec | |
parent | 797f4122c525c2ff30912a49e1c6887d997054de (diff) | |
download | puppet-fa64774e60940e1118b5ca496387d2eb0545acb2.tar.gz puppet-fa64774e60940e1118b5ca496387d2eb0545acb2.tar.xz puppet-fa64774e60940e1118b5ca496387d2eb0545acb2.zip |
Redeleting puppetmasterd integration test
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/integration/bin/puppetmasterd.rb | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/spec/integration/bin/puppetmasterd.rb b/spec/integration/bin/puppetmasterd.rb deleted file mode 100755 index a9a8321e9..000000000 --- a/spec/integration/bin/puppetmasterd.rb +++ /dev/null @@ -1,155 +0,0 @@ -#!/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 - - Puppet::SSL::Host.instance_eval{ - @value_cache = {} - } - 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 - - bin = File.join(File.dirname(__FILE__), "..", "..", "..", "sbin", "puppetmasterd") - lib = File.join(File.dirname(__FILE__), "..", "..", "..", "lib") - output = %x{/usr/bin/env ruby -I #{lib} #{bin} #{args}}.chomp - end - - def stop - if @pidfile and File.exist?(@pidfile) - pid = File.read(@pidfile).chomp.to_i - Process.kill(:TERM, pid) - 10.times do - break unless File.exist?(@pidfile) - sleep 1 - end - begin - # sigkill and report if process was still running - Process.kill(:KILL, pid) - - raise "Process didn't die from SIGTERM after 10 seconds" - rescue Errno::ESRCH - # process wasn't running. good. - end - - 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" do - start - sleep 6 - - Puppet::Status.indirection.terminus_class = :rest - status = Puppet::Status.find("https://localhost:#{@@port}/production/status/default") - - status.status["is_alive"].should == true - - Puppet::Status.indirection.terminus_class = :local - end - - it "should be serving status information over xmlrpc" do - start - - sleep 6 - - client = Puppet::Network::Client.status.new(:Server => "localhost", :Port => @@port) - - 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" - - describe "when run for the first time" do - before do - @ssldir = File.join(@dir, 'ssl') - FileUtils.rm_r(@ssldir) if File.exists?(@ssldir) - end - - describe "with noop" do - it "should create its ssl directory" do - File.directory?(@ssldir).should be_false - start(' --noop') - File.directory?(@ssldir).should be_true - end - end - - describe "without noop" do - it "should create its ssl directory" do - File.directory?(@ssldir).should be_false - start - File.directory?(@ssldir).should be_true - end - end - end -end |