summaryrefslogtreecommitdiffstats
path: root/spec/unit/network
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-09-23 22:31:55 -0500
committerLuke Kanies <luke@madstop.com>2008-09-23 22:31:55 -0500
commit4aeabbbb2163684ff7064198c653cd60d46e5717 (patch)
tree7c3593bde6b7f28f3e20444a576eb37338cced14 /spec/unit/network
parent5b9dd01326a61b9ae89ae978e29a8170f76deb5e (diff)
parent8d5ded09b9c9c944695c015e6e95b10ccebd6fb5 (diff)
Merge branch '0.24.x'
Conflicts: lib/puppet/metatype/container.rb lib/puppet/metatype/instances.rb lib/puppet/metatype/metaparams.rb lib/puppet/metatype/relationships.rb lib/puppet/metatype/schedules.rb
Diffstat (limited to 'spec/unit/network')
-rwxr-xr-xspec/unit/network/client/master.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/unit/network/client/master.rb b/spec/unit/network/client/master.rb
index 754fd0583..f55ba316c 100755
--- a/spec/unit/network/client/master.rb
+++ b/spec/unit/network/client/master.rb
@@ -397,4 +397,46 @@ describe Puppet::Network::Client::Master, " when using the cached catalog" do
@client.catalog.should equal(ral_config)
end
+
+ describe "when calling splay" do
+ it "should do nothing if splay is not enabled" do
+ Puppet.stubs(:[]).with(:splay).returns(false)
+ @client.expects(:rand).never
+ @client.send(:splay)
+ end
+
+ describe "when splay is enabled" do
+ before do
+ Puppet.stubs(:[]).with(:splay).returns(true)
+ Puppet.stubs(:[]).with(:splaylimit).returns(42)
+ end
+
+ it "should sleep for a random time" do
+ @client.expects(:rand).with(42).returns(42)
+ @client.expects(:sleep).with(42)
+ @client.send(:splay)
+ end
+
+ it "should inform that it is splayed" do
+ @client.stubs(:rand).with(42).returns(42)
+ @client.stubs(:sleep).with(42)
+ Puppet.expects(:info)
+ @client.send(:splay)
+ end
+
+ it "should set splay = true" do
+ @client.stubs(:rand).with(42).returns(42)
+ @client.stubs(:sleep).with(42)
+ @client.send(:splay)
+ @client.send(:splayed?).should == true
+ end
+
+ it "should do nothing if already splayed" do
+ @client.stubs(:rand).with(42).returns(42).at_most_once
+ @client.stubs(:sleep).with(42).at_most_once
+ @client.send(:splay)
+ @client.send(:splay)
+ end
+ end
+ end
end