From 7f67b1c6ea83ba3488869dc9769efd78b28c82b5 Mon Sep 17 00:00:00 2001 From: Daniel Marcotte Date: Thu, 23 Apr 2020 07:07:40 -0700 Subject: [PATCH] Fix tests for JRuby Well, "fix" might overstate it, but we were able to get them passing by backporting test skips that are currently in Puma master upstream. With these skips, not only does tag `4.3.3.` all pass, but so does our custom branch, so we can be pretty confident we haven't broken anything vs. stock Puma. Some notes on test runs: - Invoke with `bundle exec rake test --trace` - Ctrl-C'ing the tests usually left a zombified version running in the background, which would *cause failures on subsequent runs*. Ensure after killing the a test run that no test processes remain in `jps -lm` - `TestThreadPool` tests are flaky in this release, though this was a known issue, and has been recently fixed here: https://github.com/puma/puma/pull/2220 --- test/test_cli.rb | 5 +++-- test/test_launcher.rb | 2 ++ test/test_pumactl.rb | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test_cli.rb b/test/test_cli.rb index d49236246a..830929913e 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -66,6 +66,7 @@ def test_control_for_tcp end def test_control_for_ssl + skip_on :jruby # backported from https://github.com/puma/puma/blob/b0b17f6ffd6a3fc858202a2b0ac1385f45603b18/test/test_cli.rb#L67 app_port = UniquePort.call control_port = UniquePort.call control_host = "127.0.0.1" @@ -97,8 +98,8 @@ def test_control_for_ssl assert_match(expected_stats, Puma.stats) ensure - cli.launcher.stop - t.join + cli.launcher.stop if cli + t.join if t end def test_control_clustered diff --git a/test/test_launcher.rb b/test/test_launcher.rb index 9de31b9152..710bb04d4f 100644 --- a/test/test_launcher.rb +++ b/test/test_launcher.rb @@ -5,6 +5,7 @@ class TestLauncher < Minitest::Test def test_dependencies_and_files_to_require_after_prune_is_correctly_built_for_no_extra_deps skip_on :no_bundler + skip_on :jruby, suffix: " - customizing puma.gemspec to disable the C native extension invalidates this test" deps, dirs = launcher.send(:dependencies_and_files_to_require_after_prune) @@ -17,6 +18,7 @@ def test_dependencies_and_files_to_require_after_prune_is_correctly_built_for_no end def test_dependencies_and_files_to_require_after_prune_is_correctly_built_with_extra_deps + skip_on :jruby, suffix: " - customizing puma.gemspec to disable the C native extension invalidates this test" skip_on :no_bundler conf = Puma::Configuration.new do |c| c.extra_runtime_dependencies ['rdoc'] diff --git a/test/test_pumactl.rb b/test/test_pumactl.rb index 20e56e0ebc..c17dd1e816 100644 --- a/test/test_pumactl.rb +++ b/test/test_pumactl.rb @@ -149,6 +149,7 @@ def test_control_url_and_status end def test_control_ssl + skip_on :jruby # ported from https://github.com/puma/puma/blob/4ef001000e71f987ccfacd28c3cbda614d3717ff/test/test_pumactl.rb#L144 host = "127.0.0.1" port = find_open_port url = "ssl://#{host}:#{port}?#{ssl_query}"