summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-07-19 15:19:10 -0700
committerNick Lewis <nick@puppetlabs.com>2011-07-19 15:47:03 -0700
commit185a666018c0cf0b2c497f655f942a82cd22e49e (patch)
tree79210fb8bfcd0df1350b115f4c52480e41874337 /spec/unit
parent21c5929aae899e559e9a813c48424da4fcbec54b (diff)
downloadpuppet-185a666018c0cf0b2c497f655f942a82cd22e49e.tar.gz
puppet-185a666018c0cf0b2c497f655f942a82cd22e49e.tar.xz
puppet-185a666018c0cf0b2c497f655f942a82cd22e49e.zip
Remove Puppet::Network::HttpPool keep_alive handling
Keep alive has been disabled since 2008, and seems to have caused problems when it was enabled before then. Since there doesn't seem to be any push to get it working again, just remove it to simplify this code. This also allows us to entirely remove the usage of Puppet::Util::Cacher from HttpPool. Paired-With: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/network/client_spec.rb45
-rwxr-xr-xspec/unit/network/http_pool_spec.rb75
2 files changed, 4 insertions, 116 deletions
diff --git a/spec/unit/network/client_spec.rb b/spec/unit/network/client_spec.rb
deleted file mode 100755
index 102a053c0..000000000
--- a/spec/unit/network/client_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env rspec
-#
-# Created by Luke Kanies on 2008-3-24.
-# Copyright (c) 2008. All rights reserved.
-
-require 'spec_helper'
-
-require 'puppet/network/client'
-
-describe Puppet::Network::Client do
- before do
- Puppet.settings.stubs(:use).returns(true)
- Puppet::Network::HttpPool.stubs(:cert_setup)
- end
-
- describe "when keep-alive is enabled" do
- before do
- Puppet::Network::HttpPool.stubs(:keep_alive?).returns true
- end
- it "should start the http client up on creation" do
- http = mock 'http'
- http.stub_everything
- http.expects(:start)
- Net::HTTP.stubs(:new).returns http
-
- # Pick a random subclass...
- Puppet::Network::Client.runner.new :Server => Puppet[:server]
- end
- end
-
- describe "when keep-alive is disabled" do
- before do
- Puppet::Network::HttpPool.stubs(:keep_alive?).returns false
- end
- it "should not start the http client up on creation" do
- http = mock 'http'
- http.stub_everything
- http.expects(:start).never
- Net::HTTP.stubs(:new).returns http
-
- # Pick a random subclass...
- Puppet::Network::Client.runner.new :Server => Puppet[:server]
- end
- end
-end
diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb
index 32c7a90fe..1961f3029 100755
--- a/spec/unit/network/http_pool_spec.rb
+++ b/spec/unit/network/http_pool_spec.rb
@@ -8,15 +8,9 @@ require 'puppet/network/http_pool'
describe Puppet::Network::HttpPool do
after do
- Puppet::Util::Cacher.expire
- Puppet::Network::HttpPool.clear_http_instances
Puppet::Network::HttpPool.instance_variable_set("@ssl_host", nil)
end
- it "should have keep-alive disabled" do
- Puppet::Network::HttpPool::HTTP_KEEP_ALIVE.should be_false
- end
-
it "should use the global SSL::Host instance to get its certificate information" do
host = mock 'host'
Puppet::SSL::Host.expects(:localhost).with.returns host
@@ -58,71 +52,10 @@ describe Puppet::Network::HttpPool do
Puppet::Network::HttpPool.http_instance("me", 54321).open_timeout.should == 120
end
- describe "and http keep-alive is enabled" do
- before do
- Puppet::Network::HttpPool.stubs(:keep_alive?).returns true
- end
-
- it "should cache http instances" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- old = Puppet::Network::HttpPool.http_instance("me", 54321)
- Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
- end
-
- it "should have a mechanism for getting a new http instance instead of the cached instance" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- old = Puppet::Network::HttpPool.http_instance("me", 54321)
- Puppet::Network::HttpPool.http_instance("me", 54321, true).should_not equal(old)
- end
-
- it "should close existing, open connections when requesting a new connection" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- old = Puppet::Network::HttpPool.http_instance("me", 54321)
- old.expects(:started?).returns(true)
- old.expects(:finish)
- Puppet::Network::HttpPool.http_instance("me", 54321, true)
- end
-
- it "should have a mechanism for clearing the http cache", :fails_on_windows => true do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- old = Puppet::Network::HttpPool.http_instance("me", 54321)
- Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
- old = Puppet::Network::HttpPool.http_instance("me", 54321)
- Puppet::Network::HttpPool.clear_http_instances
- Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
- end
-
- it "should close open http connections when clearing the cache" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- one = Puppet::Network::HttpPool.http_instance("me", 54321)
- one.expects(:started?).returns(true)
- one.expects(:finish).returns(true)
- Puppet::Network::HttpPool.clear_http_instances
- end
-
- it "should not close unopened http connections when clearing the cache" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- one = Puppet::Network::HttpPool.http_instance("me", 54321)
- one.expects(:started?).returns(false)
- one.expects(:finish).never
- Puppet::Network::HttpPool.clear_http_instances
- end
- end
-
- describe "and http keep-alive is disabled" do
- before do
- Puppet::Network::HttpPool.stubs(:keep_alive?).returns false
- end
-
- it "should not cache http instances" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
- old = Puppet::Network::HttpPool.http_instance("me", 54321)
- Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
- end
- end
-
- after do
- Puppet::Network::HttpPool.clear_http_instances
+ it "should not cache http instances" do
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
+ old = Puppet::Network::HttpPool.http_instance("me", 54321)
+ Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
end
end