[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Matt Robinson
matt at puppetlabs.com
Tue May 10 07:59:43 UTC 2011
The following commit has been merged in the experimental branch:
commit 5bf19e40df5e955c045f7a42a070cdbefecbcbe1
Author: Matt Robinson <matt at puppetlabs.com>
Date: Sat Oct 23 08:04:31 2010 -0700
[#4894] Randomize port on webrick tests
This isn't a great test fix, but it should be enough for now to stop the
sporadic test failures in Hudson where webrick isn't releasing it's port
which causes other tests to fail.
I created ticket #5098 as a reminder to refactor these tests later.
Reviewed-by: Paul Berry
diff --git a/spec/integration/indirector/certificate_revocation_list/rest_spec.rb b/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
index 86f2b01..d831805 100755
--- a/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
+++ b/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
@@ -8,7 +8,11 @@ require 'puppet/network/http/webrick/rest'
describe "Certificate REST Terminus" do
before do
- Puppet[:masterport] = 34343
+# This port randomization is NOT a good pattern for testing, don't copy
+# but it's a quick fix to deal with sporadic test failures in Hudson #4894
+# Ticket #5098 created to fix these tests in the future
+ masterport = rand(100) + 34500
+ Puppet[:masterport] = masterport
Puppet[:server] = "localhost"
# Get a safe temporary file
@@ -19,7 +23,7 @@ describe "Certificate REST Terminus" do
Puppet.settings[:vardir] = @dir
Puppet.settings[:group] = Process.gid
Puppet.settings[:server] = "127.0.0.1"
- Puppet.settings[:masterport] = "34343"
+ Puppet.settings[:masterport] = masterport
Puppet::Util::Cacher.expire
@@ -32,7 +36,7 @@ describe "Certificate REST Terminus" do
ca = Puppet::SSL::CertificateAuthority.new
ca.generate(Puppet[:certname]) unless Puppet::SSL::Certificate.find(Puppet[:certname])
- @params = { :port => 34343, :handlers => [ :certificate_revocation_list ] }
+ @params = { :port => masterport, :handlers => [ :certificate_revocation_list ] }
@server = Puppet::Network::Server.new(@params)
@server.listen
diff --git a/spec/integration/indirector/rest_spec.rb b/spec/integration/indirector/rest_spec.rb
index 14e9e95..e36d793 100755
--- a/spec/integration/indirector/rest_spec.rb
+++ b/spec/integration/indirector/rest_spec.rb
@@ -30,6 +30,10 @@ end
class Puppet::TestIndirectedFoo::Rest < Puppet::Indirector::REST
end
+# This port randomization is NOT a good pattern for testing, don't copy
+# but it's a quick fix to deal with sporadic test failures in Hudson #4894
+# Ticket #5098 created to fix these tests in the future
+masterport = rand(100) + 34300
describe Puppet::Indirector::REST do
before do
@@ -41,7 +45,7 @@ describe Puppet::Indirector::REST do
Puppet.settings[:vardir] = @dir
Puppet.settings[:group] = Process.gid
Puppet.settings[:server] = "127.0.0.1"
- Puppet.settings[:masterport] = "34343"
+ Puppet.settings[:masterport] = masterport
Puppet::SSL::Host.ca_location = :local
@@ -65,7 +69,7 @@ describe Puppet::Indirector::REST do
ca = Puppet::SSL::CertificateAuthority.new
ca.generate(Puppet[:certname]) unless Puppet::SSL::Certificate.find(Puppet[:certname])
- @params = { :port => 34343, :handlers => [ :test_indirected_foo ], :xmlrpc_handlers => [ :status ] }
+ @params = { :port => masterport, :handlers => [ :test_indirected_foo ], :xmlrpc_handlers => [ :status ] }
@server = Puppet::Network::Server.new(@params)
@server.listen
@@ -291,7 +295,7 @@ describe Puppet::Indirector::REST do
before :each do
Puppet[:servertype] = 'mongrel'
- @params = { :port => 34343, :handlers => [ :test_indirected_foo ] }
+ @params = { :port => masterport, :handlers => [ :test_indirected_foo ] }
# Make sure we never get a cert, since mongrel can't speak ssl
Puppet::SSL::Certificate.stubs(:find).returns nil
@@ -312,7 +316,7 @@ describe Puppet::Indirector::REST do
Puppet::Network::HTTP::MongrelREST.any_instance.stubs(:check_authorization).returns(true)
end
- after do
+ after :each do
@server.unlisten
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list