Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to keep open streaming connections with Puma #1858

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Run async tests against Puma
  • Loading branch information
dentarg committed Feb 10, 2023
commit a8ec48da5861970a8dc97706d511093a00417ca7
4 changes: 2 additions & 2 deletions test/integration/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

set :out, nil
get '/async' do
stream(:keep_open) { |o| (settings.out = o) << "hi!" }
stream(:keep_open) { |o| (settings.out = o) << "hi!"; sleep 1 }
end

get '/send' do
Expand Down Expand Up @@ -66,7 +66,7 @@
class Subclass < Sinatra::Base
set :out, nil
get '/subclass/async' do
stream(:keep_open) { |o| (settings.out = o) << "hi!" }
stream(:keep_open) { |o| (settings.out = o) << "hi!"; sleep 1 }
end

get '/subclass/send' do
Expand Down
2 changes: 1 addition & 1 deletion test/integration_async_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module IntegrationAsyncHelper
def it(message, &block)
base_port = 5100 + Process.pid % 100

%w(rainbows).each_with_index do |server_name, index|
%w(rainbows puma).each_with_index do |server_name, index|
server = IntegrationHelper::BaseServer.new(server_name, base_port + index)
next unless server.installed?

Expand Down
9 changes: 8 additions & 1 deletion test/integration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ def run

def installed?
return @installed unless @installed.nil?
s = server == 'HTTP' ? 'net/http/server' : server
s = case server
when 'HTTP'
'net/http/server'
when 'puma'
'puma/rack/handler'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests output show puma is not installed, skipping integration tests so I think this require is not working as expected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch 😬 Explains why things went so smooth 😆

else
server
end
require s
@installed = true
rescue LoadError
Expand Down