summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-11 23:00:29 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-11 23:00:29 +0000
commitcd9ea8056a71279aab384d204d90e24236e7ae57 (patch)
tree21c805a6a9da53b90809566816130ac13540edae /test
parent71793fb3d096b74977b73fffe16bbeb8f45c94b9 (diff)
Adding locking to the master client, so that only one copy of puppetd will be running. This should make it safe to run puppetd manually while it is also running normally.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1107 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/client/master.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/client/master.rb b/test/client/master.rb
index ddca0ba13..d5af1b82d 100644
--- a/test/client/master.rb
+++ b/test/client/master.rb
@@ -83,4 +83,36 @@ class TestMasterClient < Test::Unit::TestCase
assert_equal(Puppet.version.to_s, facts["clientversion"])
end
+
+ # Make sure the client correctly locks itself
+ def test_locking
+ manifest = mktestmanifest
+
+ master = nil
+
+ # First test with a networked master
+ client = Puppet::Client::MasterClient.new(
+ :Server => "localhost"
+ )
+
+ assert_nothing_raised do
+ client.lock do
+ pid = nil
+ assert(pid = client.locked?, "Client is not locked")
+ assert(pid =~ /^\d+$/, "PID is, um, not a pid")
+ end
+ end
+ assert(! client.locked?)
+
+ # Now test with a local client
+ client = mkclient
+
+ assert_nothing_raised do
+ client.lock do
+ pid = nil
+ assert(! client.locked?, "Local client is locked")
+ end
+ end
+ assert(! client.locked?)
+ end
end