From 03c3b2f0e151a308aec7ebe6690c0b1a8ff046b9 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Tue, 13 Oct 2020 17:36:55 -0500 Subject: [PATCH] Improve reliability of non-MRI CI Jobs still occasionally freeze/time-out in test step. 1. Allows jruby-head to fail (as done previously) 2. Actions - change all Ubuntu JRuby OS's to 20.04 (18.04 uses JDK-8, 20.04 uses JDK-11) 3. Integration tests (cluster, pumactl, single) - only run parallel on MRI Rubies 4. `helper.rb` - `TestSkips` - add `JRUBY_HEAD` constant for use with non-parallel conditionals and skips 5. `test_puma_server.rb` - jruby-head - run non-parallel 6. `test_puma_server_ssl.rb` - `TestPumaServerSSLClient` tests - non-parallel on JRuby, add `Errno::ECONNRESET` to client net/https rescue for TruffleRuby 7. `test_puma_server_ssl.rb` - `TestPumaServerSSL#test_http_rejection` - add `Net::ReadTimeout` to client net/https rescue for TruffleRuby Update test_puma_server_ssl.rb --- .github/workflows/non_mri.yml | 9 +++------ test/helper.rb | 2 ++ test/test_integration_cluster.rb | 2 +- test/test_integration_pumactl.rb | 2 +- test/test_integration_single.rb | 2 +- test/test_puma_server.rb | 2 +- test/test_puma_server_ssl.rb | 10 ++++++---- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/non_mri.yml b/.github/workflows/non_mri.yml index d9da839d..96d65481 100644 --- a/.github/workflows/non_mri.yml +++ b/.github/workflows/non_mri.yml @@ -18,16 +18,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-18.04, macos-10.15 ] + os: [ ubuntu-20.04, macos-10.15 ] ruby: [ jruby, jruby-head, truffleruby-head ] no-ssl: [''] include: - #- { os: ubuntu-18.04 , ruby: jruby-head, allow-failure: true } + - { os: ubuntu-20.04 , ruby: jruby-head, allow-failure: true } - { os: ubuntu-20.04 , ruby: jruby, no-ssl: ' no SSL' } exclude: - - { os: ubuntu-20.04 , ruby: jruby } - - { os: ubuntu-20.04 , ruby: jruby-head } - - { os: ubuntu-20.04 , ruby: truffleruby-head } - { os: macos-10.15 , ruby: jruby-head } steps: @@ -59,7 +56,7 @@ jobs: - name: test id: test - timeout-minutes: 20 + timeout-minutes: 15 continue-on-error: ${{ matrix.allow-failure || false }} if: success() # only run if previous steps have succeeded run: bundle exec rake test:all diff --git a/test/helper.rb b/test/helper.rb index 9d0ee4b4..ff6f9d84 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -108,6 +108,8 @@ module TestSkips SIGNAL_LIST = Signal.list.keys.map(&:to_sym) - (Puma.windows? ? [:INT, :TERM] : []) + JRUBY_HEAD = Puma::IS_JRUBY && RUBY_DESCRIPTION =~ /SNAPSHOT/ + # usage: skip_unless_signal_exist? :USR2 def skip_unless_signal_exist?(sig, bt: caller) signal = sig.to_s.sub(/\ASIG/, '').to_sym diff --git a/test/test_integration_cluster.rb b/test/test_integration_cluster.rb index cc5ea3a3..aa8c3537 100644 --- a/test/test_integration_cluster.rb +++ b/test/test_integration_cluster.rb @@ -2,7 +2,7 @@ require_relative "helper" require_relative "helpers/integration" class TestIntegrationCluster < TestIntegration - parallelize_me! + parallelize_me! if ::Puma.mri? def workers ; 2 ; end diff --git a/test/test_integration_pumactl.rb b/test/test_integration_pumactl.rb index 47688067..b784da6d 100644 --- a/test/test_integration_pumactl.rb +++ b/test/test_integration_pumactl.rb @@ -3,7 +3,7 @@ require_relative "helpers/integration" class TestIntegrationPumactl < TestIntegration include TmpPath - parallelize_me! + parallelize_me! if ::Puma.mri? def workers ; 2 ; end diff --git a/test/test_integration_single.rb b/test/test_integration_single.rb index dbbf77b4..569140a9 100644 --- a/test/test_integration_single.rb +++ b/test/test_integration_single.rb @@ -2,7 +2,7 @@ require_relative "helper" require_relative "helpers/integration" class TestIntegrationSingle < TestIntegration - parallelize_me! + parallelize_me! if ::Puma.mri? def workers ; 0 ; end diff --git a/test/test_puma_server.rb b/test/test_puma_server.rb index 3588dc93..5a866d96 100644 --- a/test/test_puma_server.rb +++ b/test/test_puma_server.rb @@ -3,7 +3,7 @@ require "puma/events" require "net/http" class TestPumaServer < Minitest::Test - parallelize_me! + parallelize_me! unless JRUBY_HEAD def setup @host = "127.0.0.1" diff --git a/test/test_puma_server_ssl.rb b/test/test_puma_server_ssl.rb index 1a5cf2e6..e42b663c 100644 --- a/test/test_puma_server_ssl.rb +++ b/test/test_puma_server_ssl.rb @@ -216,7 +216,8 @@ class TestPumaServerSSL < Minitest::Test tcp = Thread.new do req_http = Net::HTTP::Get.new "/", {} - assert_raises(Errno::ECONNREFUSED, EOFError) do + # Net::ReadTimeout - TruffleRuby + assert_raises(Errno::ECONNREFUSED, EOFError, Net::ReadTimeout) do http.start.request(req_http) { |rep| body_http = rep.body } end end @@ -245,7 +246,7 @@ end if ::Puma::HAS_SSL # client-side TLS authentication tests class TestPumaServerSSLClient < Minitest::Test - parallelize_me! + parallelize_me! unless ::Puma.jruby? CERT_PATH = File.expand_path "../examples/puma/client-certs", __dir__ @@ -286,7 +287,8 @@ class TestPumaServerSSLClient < Minitest::Test req = Net::HTTP::Get.new "/", {} http.request(req) end - rescue OpenSSL::SSL::SSLError, EOFError + rescue OpenSSL::SSL::SSLError, EOFError, Errno::ECONNRESET + # Errno::ECONNRESET TruffleRuby client_error = true # closes socket if open, may not close on error http.send :do_finish @@ -302,7 +304,7 @@ class TestPumaServerSSLClient < Minitest::Test assert_equal subject, events.cert.subject.to_s if subject end ensure - server.stop(true) + server.stop(true) if server end def test_verify_fail_if_no_client_cert