MrDys / blacklight

Blacklight Plugin
http://projectblacklight.org/
Other
1 stars 1 forks source link

Blacklight jetty wrapper should error if it is unable to listen on the configured port #504

Closed MrDys closed 12 years ago

MrDys commented 12 years ago

CODEBASE-319: When the Blacklight jetty instance is run from the tests, it should fail if it is unable to bind to the configured port. Currently, it does not and some specs fail with cryptic responses, e.g.:

$ rake blacklight:spec:with_solr (in /Volumes/Scratch/blacklight-rails3/test_app) JettySolrServer: starting server on i686-darwin9.8.0 executing: java -Djetty.port=8888 -Dsolr.solr.home=/Volumes/Scratch/blacklight-rails3/test_app/jetty/solr -jar start.jar

<JettySolrServer:0x23187a4 @solr_home="/Volumes/Scratch/blacklight-rails3/test_app/jetty/solr", @quiet=true, @jetty_home="/Volumes/Scratch/blacklight-rails3/test_app/jetty", @port=8888, @pid=nil>

Failures:

1) CatalogController index action should have docs and facets for query with results Failure/Error: assigns_response.docs.size.should > 1 NoMethodError: undefined method `docs' for nil:NilClass

/Volumes/Scratch/blacklight-rails3/test_support/spec/controllers/catalog_controller_spec.rb:100

I'm fairly sure the current behavior is not a regression and have marked this as a 3.1 fix accordingly.

MrDys commented 12 years ago

Original reporter: cbeer

MrDys commented 12 years ago

cbeer: Duplicate of CODEBASE-320

MrDys commented 12 years ago

cbeer: Batch move to 3.0.1

MrDys commented 12 years ago

jrochkind: There is NO GOOD WAY to get it to do this that I can find. I spent a couple hours on it on Thursday.

The ONLY way I could figure out to do this is to redirect the jetty log to a file, and then actually scan it for "error binding to port" messages, or an ultimate success message. This would make it impossible to provide the current option to send log to console too (well, I guess you could send it both places with a 'tee'). But it all starts getting complicated and ugly, I personally don't feel like/have time to do it.

This problem was the same in Rails2 version as far as I can tell.

There is no way I can find to get jetty/solr to quit on startup if port is already bound. All it does is log the error in it's log file. This was, I'm pretty sure, identical in rails2.

On 4/29/2011 3:35 PM, Chris Beer (JIRA) wrote:

Blacklight jetty wrapper should error if it is unable to listen on the configured port

              Key: CODEBASE-319
              URL: http://jira.projectblacklight.org/jira/browse/CODEBASE-319
          Project: Blacklight Plugin
       Issue Type: Improvement
         Reporter: Chris Beer
         Assignee: Jonathan Rochkind
          Fix For: 3.1

When the Blacklight jetty instance is run from the tests, it should fail if it is unable to bind to the configured port. Currently, it does not and some specs fail with cryptic responses, e.g.:

$ rake blacklight:spec:with_solr (in /Volumes/Scratch/blacklight-rails3/test_app) JettySolrServer: starting server on i686-darwin9.8.0 executing: java -Djetty.port=8888 -Dsolr.solr.home=/Volumes/Scratch/blacklight-rails3/test_app/jetty/solr -jar start.jar

<JettySolrServer:0x23187a4 @solr_home="/Volumes/Scratch/blacklight-rails3/test_app/jetty/solr", @quiet=true, @jetty_home="/Volumes/Scratch/blacklight-rails3/test_app/jetty", @port=8888, @pid=nil>

Failures:

1) CatalogController index action should have docs and facets for query with results Failure/Error: assigns_response.docs.size.should> 1 NoMethodError: undefined method `docs' for nil:NilClass

/Volumes/Scratch/blacklight-rails3/test_support/spec/controllers/catalog_controller_spec.rb:100

I'm fairly sure the current behavior is not a regression and have marked this as a 3.1 fix accordingly.