summaryrefslogtreecommitdiffstats
path: root/test/network
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-02-02 17:19:07 -0600
committerLuke Kanies <luke@madstop.com>2009-02-06 18:08:43 -0600
commitc0fcb2137e66af8ba60a959faa221034c6832b69 (patch)
tree10f62605333979ea64445dca5d4d66d58237de97 /test/network
parent700e823f7c33eb3c5b4d9e467742fd24f63bbeef (diff)
downloadpuppet-c0fcb2137e66af8ba60a959faa221034c6832b69.tar.gz
puppet-c0fcb2137e66af8ba60a959faa221034c6832b69.tar.xz
puppet-c0fcb2137e66af8ba60a959faa221034c6832b69.zip
Creating and using a new Puppet::Daemon class
This replaces the short-lived EventManager class, all of the service- and timer-related code in puppet.rb, and moves code from agent.rb, server.rb, and other places into one class responsible for starting, stopping, pids, and more. The Daemon module is no longer in existence, so it's been removed from the classes that were using it. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'test/network')
-rwxr-xr-xtest/network/daemon.rb70
1 files changed, 0 insertions, 70 deletions
diff --git a/test/network/daemon.rb b/test/network/daemon.rb
deleted file mode 100755
index 5105c6e4c..000000000
--- a/test/network/daemon.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.dirname(__FILE__) + '/../lib/puppettest'
-
-require 'puppettest'
-require 'puppet/daemon'
-
-class TestDaemon < Test::Unit::TestCase
- include PuppetTest
-
- class FakeDaemon
- include Puppet::Daemon
- end
-
- def test_pidfile
- daemon = FakeDaemon.new
-
- assert_nothing_raised("removing non-existent file failed") do
- daemon.rmpidfile
- end
-
- Puppet[:pidfile] = tempfile()
- assert_nothing_raised "could not lock" do
- daemon.setpidfile
- end
-
- assert(FileTest.exists?(daemon.pidfile),
- "did not create pidfile")
-
- assert_nothing_raised("removing non-existent file failed") do
- daemon.rmpidfile
- end
-
- assert(! FileTest.exists?(daemon.pidfile),
- "did not remove pidfile")
- end
-
- def test_daemonize
- daemon = FakeDaemon.new
- Puppet[:pidfile] = tempfile()
-
- exiter = tempfile()
-
- assert_nothing_raised("Could not fork and daemonize") do
- fork do
- daemon.send(:daemonize)
- # Wait a max of 5 secs
- 50.times do
- if FileTest.exists?(exiter)
- daemon.rmpidfile
- exit(0)
- end
- sleep 0.1
- end
- exit(0)
- end
- end
- sleep(0.1)
- assert(FileTest.exists?(Puppet[:pidfile]),
- "did not create pidfile on daemonize")
-
- File.open(exiter, "w") { |f| f.puts "" }
-
- sleep(0.2)
- assert(! FileTest.exists?(Puppet[:pidfile]),
- "did not remove pidfile on process death")
- end
-end
-
-