diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-11 16:54:04 -0600 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-02-12 17:08:49 +1100 |
| commit | 5e35166f1b7219d470916d1ee7a4e6852afaf1f9 (patch) | |
| tree | f456f8f846f781084e06ed4a5446a6d060994b70 /spec/unit | |
| parent | af3f3ae93ba1e43ac8231e4cf4e5a1f0ed8f3acb (diff) | |
| download | puppet-5e35166f1b7219d470916d1ee7a4e6852afaf1f9.tar.gz puppet-5e35166f1b7219d470916d1ee7a4e6852afaf1f9.tar.xz puppet-5e35166f1b7219d470916d1ee7a4e6852afaf1f9.zip | |
Fixing #961 - closing the http connection after every xmlrpc call
There were apparently some circumstances that
resulted in the connection not being closed; this just closes
it every time if it's still open after the rpc call is complete.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/network/xmlrpc/client.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/network/xmlrpc/client.rb b/spec/unit/network/xmlrpc/client.rb index 76ef5c799..36e59429c 100755 --- a/spec/unit/network/xmlrpc/client.rb +++ b/spec/unit/network/xmlrpc/client.rb @@ -20,6 +20,28 @@ describe Puppet::Network::XMLRPCClient do @client.report("eh").should == "foo" end + it "should always close the http connection if it is still open after the call" do + http = mock 'http' + @client.stubs(:http).returns http + + http.expects(:started?).returns true + http.expects(:finish) + + @client.report("eh").should == "foo" + end + + it "should always close the http connection if it is still open after a call that raises an exception" do + http = mock 'http' + @client.stubs(:http).returns http + + @client.expects(:call).raises RuntimeError + + http.expects(:started?).returns true + http.expects(:finish) + + lambda { @client.report("eh") }.should raise_error + end + describe "when returning the http instance" do it "should use the http pool to create the instance" do @client.instance_variable_set("@http", nil) |
