1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

[CI] rescue more errors in teardown & wait_for_server_to_boot methods, RubyGems (#2887)

* test/helpers/integration.rb - updates for exception handling

* test/test_out_of_band_server.rb - fixup teardown

* [CI] tests.yaml - Update RubyGems for Rubies 2.3 - 2.5
This commit is contained in:
MSP-Greg 2022-05-30 17:37:16 -05:00 committed by GitHub
parent f59887602c
commit 3c089fcaba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 6 deletions

View file

@ -85,6 +85,13 @@ jobs:
continue-on-error: true
timeout-minutes: 5
# fixes 'has a bug that prevents `required_ruby_version`'
- name: update rubygems for Ruby 2.3 - 2.5
if: contains('2.3 2.4 2.5', matrix.ruby)
run: gem update --system 3.3.14 --no-document
continue-on-error: true
timeout-minutes: 5
- name: Compile Puma without SSL support
if: matrix.no-ssl == ' no SSL'
shell: bash

View file

@ -22,6 +22,7 @@ class TestIntegration < Minitest::Test
def setup
@server = nil
@pid = nil
@ios_to_close = []
@bind_path = tmp_path('.sock')
end
@ -35,8 +36,12 @@ class TestIntegration < Minitest::Test
if @ios_to_close
@ios_to_close.each do |io|
io.close if io.is_a?(IO) && !io.closed?
io = nil
begin
io.close if io.is_a?(IO) && !io.closed?
rescue
ensure
io = nil
end
end
end
@ -47,8 +52,12 @@ class TestIntegration < Minitest::Test
# wait until the end for OS buffering?
if @server
@server.close unless @server.closed?
@server = nil
begin
@server.close unless @server.closed?
rescue
ensure
@server = nil
end
end
end
@ -114,6 +123,8 @@ class TestIntegration < Minitest::Test
# wait for server to say it booted
# @server and/or @server.gets may be nil on slow CI systems
def wait_for_server_to_boot(log: false)
sleep 0.05 until @server.is_a?(IO)
@server.wait_readable 1
if log
puts "Waiting for server to boot..."
begin
@ -122,7 +133,6 @@ class TestIntegration < Minitest::Test
end until line && line.include?('Ctrl-C')
puts "Server booted!"
else
sleep 0.1 until @server.is_a?(IO)
true until (@server.gets || '').include?('Ctrl-C')
end
end

View file

@ -15,7 +15,15 @@ class TestOutOfBandServer < Minitest::Test
@oob_finished.broadcast
@app_finished.broadcast
@server.stop(true) if @server
@ios.each {|i| i.close unless i.closed?}
@ios.each do |io|
begin
io.close if io.is_a?(IO) && !io.closed?
rescue
ensure
io = nil
end
end
end
def new_connection