summaryrefslogtreecommitdiffstats
path: root/test/network/client/master.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-18 23:45:30 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-18 23:45:30 +0000
commit6f83d4daab56385df9a1625cf8ffc64b6a8958f7 (patch)
tree96f5d3eb98f0e61396e02256b2071170fb65c88e /test/network/client/master.rb
parent7d1f7606c38ad7b32651e8bc98e2258feda99294 (diff)
downloadpuppet-6f83d4daab56385df9a1625cf8ffc64b6a8958f7.tar.gz
puppet-6f83d4daab56385df9a1625cf8ffc64b6a8958f7.tar.xz
puppet-6f83d4daab56385df9a1625cf8ffc64b6a8958f7.zip
Fixing #501 -- there is now a splay option, disabled by default and when running under --test
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2528 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/network/client/master.rb')
-rwxr-xr-xtest/network/client/master.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/network/client/master.rb b/test/network/client/master.rb
index 1e14d9ce2..edd91cf30 100755
--- a/test/network/client/master.rb
+++ b/test/network/client/master.rb
@@ -3,6 +3,7 @@
$:.unshift("../../lib") if __FILE__ =~ /\.rb$/
require 'puppettest'
+require 'mocha'
class TestMasterClient < Test::Unit::TestCase
include PuppetTest::ServerTest
@@ -674,6 +675,37 @@ end
newfacts.delete("memorysize")
assert(! client.send(:facts_changed?, newfacts), "Dynamic facts resulted in a false positive")
end
+
+ def test_splay
+ client = mkclient
+
+ # Make sure we default to no splay
+ client.expects(:sleep).never
+
+ assert_nothing_raised("Failed to call splay") do
+ client.send(:splay)
+ end
+
+ # Now set it to true and make sure we get the right value
+ client = mkclient
+ client.expects(:sleep)
+
+ Puppet[:splay] = true
+ assert_nothing_raised("Failed to call sleep when splay is true") do
+ client.send(:splay)
+ end
+
+ time = Puppet::Util::Storage.cache(:configuration)[:splay_time]
+ assert(time, "Splay time was not cached")
+
+ # Now try it again
+ client = mkclient
+ client.expects(:sleep).with(time)
+
+ assert_nothing_raised("Failed to call sleep when splay is true with a cached value") do
+ client.send(:splay)
+ end
+ end
end
# $Id$