Fix JRuby Sinatra Integration Test #1087
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The JRuby Sinatra integration test (
TestIntegration/integration/Default/jruby/builds_and_runs_the_jruby_sinatra_app) was consistently failing with the following symptoms:Application staging completed successfully
All dependencies (JRuby 9.4.8.0, gems) installed correctly
App crashed during startup with health check timeout errors:
Timed out after 1m0s (30 attempts) waiting for startup check to succeed: failed to make TCP connection to 10.255.255.77:8080: connect: connection refusedThe app logged "Invoking start command" but never actually listened on port 8080
Root Cause
The default
rackupcommand (generated by the Ruby buildpack for Rack applications) binds only tolocalhostby default. In Cloud Foundry's container environment, the health check system and router need to connect from outside the container, requiring the application to bind to0.0.0.0(all interfaces).While this works fine for regular Ruby/MRI applications (likely due to differences in how the Ruby runtime handles network binding), JRuby's behavior requires explicit host specification.
Solution
Added a
Procfileto thefixtures/default/sinatra_jruby/test fixture with an explicit start command:The [-o 0.0.0.0] flag ensures the application binds to all network interfaces, allowing Cloud Foundry's health checks and routing to function properly.
Testing
/rubyendpoint