Skip to content

Commit

Permalink
Run async tests against Puma
Browse files Browse the repository at this point in the history
  • Loading branch information
dentarg committed Feb 10, 2023
1 parent e8da82a commit a8ec48d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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'
else
server
end
require s
@installed = true
rescue LoadError
Expand Down

0 comments on commit a8ec48d

Please sign in to comment.