diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2010-07-12 16:23:35 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-13 23:09:36 -0700 |
| commit | 793d7b7cfd2bb1d61a0c0686dc1f8533c8ab13d9 (patch) | |
| tree | 105066086bb1b74416e060d887d90509f088492f /spec | |
| parent | 2edf7fe968ac3d8af9865f65100940747c1fa894 (diff) | |
| download | puppet-793d7b7cfd2bb1d61a0c0686dc1f8533c8ab13d9.tar.gz puppet-793d7b7cfd2bb1d61a0c0686dc1f8533c8ab13d9.tar.xz puppet-793d7b7cfd2bb1d61a0c0686dc1f8533c8ab13d9.zip | |
[#4213] -o option for setting onetime now works properly
When onetime was moved to global defaults, it broke the option handler
using it in agent to manage waitforcert length. Additionally, it
caused --onetime and -o to behave differently. This patch removes
the ordinary option handler defined in agent and moves the logic
for waitforcert to the one location it's used.
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/application/agent_spec.rb | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 079e0adb5..54726c185 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -59,12 +59,6 @@ describe Puppet::Application::Agent do @puppetd.preinit end - it "should set waitforcert to 120" do - @puppetd.preinit - - @puppetd.options[:waitforcert].should == 120 - end - it "should init client to true" do @puppetd.preinit @@ -124,21 +118,22 @@ describe Puppet::Application::Agent do @puppetd.options[:client].should be_false end - it "should set onetime to true with --onetime" do - @puppetd.handle_onetime(nil) - Puppet[:onetime].should be_true + it "should set waitforcert to 0 with --onetime and if --waitforcert wasn't given" do + Puppet[:onetime] = true + Puppet::SSL::Host.any_instance.expects(:wait_for_cert).with(0) + @puppetd.setup_host end - it "should set waitforcert to 0 with --onetime and if --waitforcert wasn't given" do - @puppetd.explicit_waitforcert = false - @puppetd.handle_onetime(nil) - @puppetd.options[:waitforcert].should == 0 + it "should use supplied waitforcert when --onetime is specified" do + Puppet[:onetime] = true + @puppetd.handle_waitforcert(60) + Puppet::SSL::Host.any_instance.expects(:wait_for_cert).with(60) + @puppetd.setup_host end - it "should not reset waitforcert with --onetime when --waitforcert is used" do - @puppetd.explicit_waitforcert = true - @puppetd.handle_onetime(nil) - @puppetd.options[:waitforcert].should_not == 0 + it "should use a default value for waitforcert when --onetime and --waitforcert are not specified" do + Puppet::SSL::Host.any_instance.expects(:wait_for_cert).with(120) + @puppetd.setup_host end it "should set the log destination with --logdest" do @@ -168,13 +163,6 @@ describe Puppet::Application::Agent do @puppetd.handle_waitforcert("42") end - it "should mark explicit_waitforcert to true with --waitforcert" do - @puppetd.options.stubs(:[]=) - - @puppetd.handle_waitforcert("42") - @puppetd.explicit_waitforcert.should be_true - end - it "should set args[:Port] with --port" do @puppetd.handle_port("42") @puppetd.args[:Port].should == "42" @@ -226,10 +214,6 @@ describe Puppet::Application::Agent do @puppetd.options.expects(:[]=).with(:detailed_exitcodes,true) @puppetd.setup_test end - it "should set waitforcert to 0" do - @puppetd.options.expects(:[]=).with(:waitforcert,0) - @puppetd.setup_test - end end it "should call setup_logs" do |
