summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-07-19 15:19:10 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:50:15 -0700
commit3093047e07bdc69222c26d11aff50353f64c977d (patch)
treef162577bbae7c1175571e404bbadccb3c0004abe /spec
parent57d62179d248b8a7982921e2c60f5d9e9e0a8ba9 (diff)
downloadpuppet-3093047e07bdc69222c26d11aff50353f64c977d.tar.gz
puppet-3093047e07bdc69222c26d11aff50353f64c977d.tar.xz
puppet-3093047e07bdc69222c26d11aff50353f64c977d.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> (cherry picked from commit 185a666018c0cf0b2c497f655f942a82cd22e49e)
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/network/client_spec.rb41
-rwxr-xr-xspec/unit/network/http_pool_spec.rb75
2 files changed, 4 insertions, 112 deletions
diff --git a/spec/unit/network/client_spec.rb b/spec/unit/network/client_spec.rb
deleted file mode 100755
index 861f33033..000000000
--- a/spec/unit/network/client_spec.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env rspec
-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 223b16d01..c86f7a660 100755
--- a/spec/unit/network/http_pool_spec.rb
+++ b/spec/unit/network/http_pool_spec.rb
@@ -4,15 +4,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
@@ -54,71 +48,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