summaryrefslogtreecommitdiff
path: root/test/client
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-14 00:14:56 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-14 00:14:56 +0000
commit19942633b69f04c6789ef08a04d434024e1bc334 (patch)
treeb0890fdaf0a0c4a756ebce9604a516d250bc49f9 /test/client
parent798b3be4cf1d703cd8559414922b296600db9b47 (diff)
downloadpuppet-19942633b69f04c6789ef08a04d434024e1bc334.tar.gz
Adding --enable/--disable locking for puppetd. You can now disable puppetd from running by creating a lock file, which is useful if you are testing a configuration and want puppetd not to run for a bit.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@908 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/client')
-rw-r--r--test/client/master.rb72
1 files changed, 72 insertions, 0 deletions
diff --git a/test/client/master.rb b/test/client/master.rb
new file mode 100644
index 000000000..7ec440cc6
--- /dev/null
+++ b/test/client/master.rb
@@ -0,0 +1,72 @@
+if __FILE__ == $0
+ $:.unshift '..'
+ $:.unshift '../../lib'
+ $puppetbase = "../.."
+end
+
+require 'puppet'
+require 'puppet/client'
+require 'puppet/server'
+require 'test/unit'
+require 'puppettest.rb'
+
+# $Id$
+
+class TestMasterClient < Test::Unit::TestCase
+ include ServerTest
+
+ def mkmaster(file)
+ master = nil
+ # create our master
+ assert_nothing_raised() {
+ # this is the default server setup
+ master = Puppet::Server::Master.new(
+ :File => file,
+ :UseNodes => false,
+ :Local => true
+ )
+ }
+ return master
+ end
+
+ def mkclient(master)
+ client = nil
+ assert_nothing_raised() {
+ client = Puppet::Client::MasterClient.new(
+ :Master => master
+ )
+ }
+
+ return client
+ end
+
+ def test_disable
+ manifest = mktestmanifest
+
+ master = mkmaster(manifest)
+
+ client = mkclient(master)
+
+ assert(! FileTest.exists?(@createdfile))
+
+ assert_nothing_raised {
+ client.disable
+ }
+
+ assert_nothing_raised {
+ client.run
+ }
+
+ assert(! FileTest.exists?(@createdfile), "Disabled client ran")
+
+ assert_nothing_raised {
+ client.enable
+ }
+
+ assert_nothing_raised {
+ client.run
+ }
+
+ assert(FileTest.exists?(@createdfile), "Enabled client did not run")
+ end
+end