| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Mongrel
Revision: 1034
Author: luislavena
Date: 27 Jul 2008 09:07:37
Changes:Confidence is back: 0 failures on both mswin32 and mingw32
Usage of #process_based_port across tests to Ci on the same computer.
Files:| ... | ...@@ -10,7 +10,7 @@ | |
| 10 | 10 | |
| 11 | 11 | class ConditionalResponseTest < Test::Unit::TestCase |
| 12 | 12 | def setup |
| 13 | @server = HttpServer.new('127.0.0.1', 3501) | |
| 13 | @server = HttpServer.new('127.0.0.1', process_based_port) | |
| 14 | 14 | @server.register('/', Mongrel::DirHandler.new('.')) |
| 15 | 15 | @server.run |
| 16 | 16 |
| ... | ...@@ -38,8 +38,9 @@ | |
| 38 | 38 | |
| 39 | 39 | class RequestProgressTest < Test::Unit::TestCase |
| 40 | 40 | def setup |
| 41 | @port = process_based_port | |
| 41 | 42 | redirect_test_io do |
| 42 | @server = Mongrel::HttpServer.new("127.0.0.1", 9998) | |
| 43 | @server = Mongrel::HttpServer.new("127.0.0.1", @port) | |
| 43 | 44 | end |
| 44 | 45 | @handler = UploadBeginHandler.new |
| 45 | 46 | @server.register("/upload", @handler) |
| ... | ...@@ -51,7 +52,7 @@ | |
| 51 | 52 | end |
| 52 | 53 | |
| 53 | 54 | def test_begin_end_progress |
| 54 | Net::HTTP.get("localhost", "/upload", 9998) | |
| 55 | Net::HTTP.get("localhost", "/upload", @port) | |
| 55 | 56 | assert @handler.request_began |
| 56 | 57 | assert @handler.request_progressed |
| 57 | 58 | assert @handler.request_processed |
| ... | ...@@ -62,7 +63,7 @@ | |
| 62 | 63 | handlers.each { |h| h.reset } |
| 63 | 64 | |
| 64 | 65 | # make the call |
| 65 | Net::HTTP.get("localhost", "/upload", 9998) | |
| 66 | Net::HTTP.get("localhost", "/upload", @port) | |
| 66 | 67 | |
| 67 | 68 | # assert that each one was fired |
| 68 | 69 | handlers.each { |h| |
| ... | ...@@ -88,7 +89,7 @@ | |
| 88 | 89 | # remove handlers to make sure they've all gone away |
| 89 | 90 | @server.unregister("/upload") |
| 90 | 91 | handlers.each { |h| h.reset } |
| 91 | Net::HTTP.get("localhost", "/upload", 9998) | |
| 92 | Net::HTTP.get("localhost", "/upload", @port) | |
| 92 | 93 | handlers.each { |h| |
| 93 | 94 | assert !h.request_began && !h.request_progressed && !h.request_processed |
| 94 | 95 | } |
| ... | ...@@ -9,11 +9,12 @@ | |
| 9 | 9 | class RedirectHandlerTest < Test::Unit::TestCase |
| 10 | 10 | |
| 11 | 11 | def setup |
| 12 | @port = process_based_port | |
| 12 | 13 | redirect_test_io do |
| 13 | @server = Mongrel::HttpServer.new('127.0.0.1', 9998) | |
| 14 | @server = Mongrel::HttpServer.new('127.0.0.1', @port) | |
| 14 | 15 | end |
| 15 | 16 | @server.run |
| 16 | @client = Net::HTTP.new('127.0.0.1', 9998) | |
| 17 | @client = Net::HTTP.new('127.0.0.1', @port) | |
| 17 | 18 | end |
| 18 | 19 | |
| 19 | 20 | def teardown |
| ... | ...@@ -37,8 +37,8 @@ | |
| 37 | 37 | @port = process_based_port |
| 38 | 38 | stats = Mongrel::StatisticsFilter.new(:sample_rate => 1) |
| 39 | 39 | |
| 40 | @config = Mongrel::Configurator.new :host => '127.0.0.1', :port => @port do | |
| 41 | listener do | |
| 40 | @config = Mongrel::Configurator.new :host => '127.0.0.1' do | |
| 41 | listener :port => process_based_port do | |
| 42 | 42 | uri "/", :handler => SimpleHandler.new |
| 43 | 43 | uri "/", :handler => stats |
| 44 | 44 | uri "/404", :handler => Mongrel::Error404Handler.new("Not found") |
| ... | ...@@ -30,10 +30,11 @@ | |
| 30 | 30 | |
| 31 | 31 | def test_base_handler_config |
| 32 | 32 | @config = nil |
| 33 | @port = process_based_port | |
| 33 | 34 | |
| 34 | 35 | redirect_test_io do |
| 35 | 36 | @config = Mongrel::Configurator.new :host => "localhost" do |
| 36 | listener :port => 4501 do | |
| 37 | listener :port => process_based_port do | |
| 37 | 38 | # 2 in front should run, but the sentinel shouldn't since dirhandler processes the request |
| 38 | 39 | uri "/", :handler => plugin("/handlers/testplugin") |
| 39 | 40 | uri "/", :handler => plugin("/handlers/testplugin") |
| ... | ...@@ -64,12 +65,12 @@ | |
| 64 | 65 | assert listener.classifier.uris.include?("/test"), "/test not registered" |
| 65 | 66 | end |
| 66 | 67 | |
| 67 | res = Net::HTTP.get(URI.parse('http://localhost:4501/test')) | |
| 68 | res = Net::HTTP.get(URI.parse("http://localhost:#{@port}/test")) | |
| 68 | 69 | assert res != nil, "Didn't get a response" |
| 69 | 70 | assert $test_plugin_fired == 3, "Test filter plugin didn't run 3 times." |
| 70 | 71 | |
| 71 | 72 | redirect_test_io do |
| 72 | res = Net::HTTP.get(URI.parse('http://localhost:4501/')) | |
| 73 | res = Net::HTTP.get(URI.parse("http://localhost:#{@port}/")) | |
| 73 | 74 | |
| 74 | 75 | assert res != nil, "Didn't get a response" |
| 75 | 76 | assert $test_plugin_fired == 6, "Test filter plugin didn't run 6 times." |
| ... | ...@@ -80,7 +81,7 @@ | |
| 80 | 81 | end |
| 81 | 82 | |
| 82 | 83 | assert_raise Errno::EBADF, Errno::ECONNREFUSED do |
| 83 | res = Net::HTTP.get(URI.parse("http://localhost:4501/")) | |
| 84 | res = Net::HTTP.get(URI.parse("http://localhost:#{@port}/")) | |
| 84 | 85 | end |
| 85 | 86 | end |
| 86 | 87 |