From 51ea1b44eaef534ab4d76206b3e9903828d144dd Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 15 Mar 2021 09:10:43 -0500 Subject: [PATCH] Update helper.rb TestSkips, add HAS_UNIX_SOCKET to puma.rb [changelog skip] (#2576) * Update helper.rb TestSkips, add HAS_UNIX_SOCKET to puma.rb * Tests - skip updates * test_integration_cluster.rb - fix some test warnings & RuboCop --- lib/puma.rb | 2 ++ test/helper.rb | 47 ++++++++++++++++----------- test/helpers/integration.rb | 4 +-- test/test_binder.rb | 48 ++++++++++++++-------------- test/test_cli.rb | 22 ++++++------- test/test_config.rb | 22 ++++++------- test/test_http11.rb | 2 +- test/test_integration_cluster.rb | 12 +++---- test/test_integration_pumactl.rb | 10 +++--- test/test_integration_single.rb | 8 ++--- test/test_integration_systemd.rb | 4 +-- test/test_launcher.rb | 10 +++--- test/test_preserve_bundler_env.rb | 2 +- test/test_pumactl.rb | 2 +- test/test_redirect_io.rb | 4 +-- test/test_unix_socket.rb | 2 +- test/test_worker_gem_independence.rb | 2 +- 17 files changed, 106 insertions(+), 97 deletions(-) diff --git a/lib/puma.rb b/lib/puma.rb index 497e22f1..2e74228d 100644 --- a/lib/puma.rb +++ b/lib/puma.rb @@ -23,6 +23,8 @@ module Puma # not in minissl.rb HAS_SSL = const_defined?(:MiniSSL, false) && MiniSSL.const_defined?(:Engine, false) + HAS_UNIX_SOCKET = Object.const_defined? :UNIXSocket + if HAS_SSL require 'puma/minissl' else diff --git a/test/helper.rb b/test/helper.rb index d8afe35d..497eb402 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -91,20 +91,21 @@ end module TestSkips - # usage: skip NO_FORK_MSG unless HAS_FORK - # windows >= 2.6 fork is not defined, < 2.6 fork raises NotImplementedError HAS_FORK = ::Process.respond_to? :fork - NO_FORK_MSG = "Kernel.fork isn't available on #{RUBY_ENGINE} on #{RUBY_PLATFORM}" - - # socket is required by puma - # usage: skip UNIX_SKT_MSG unless UNIX_SKT_EXIST UNIX_SKT_EXIST = Object.const_defined? :UNIXSocket - UNIX_SKT_MSG = "UnixSockets aren't available on the #{RUBY_PLATFORM} platform" + + MSG_FORK = "Kernel.fork isn't available on #{RUBY_ENGINE} on #{RUBY_PLATFORM}" + MSG_UNIX = "UNIXSockets aren't available on the #{RUBY_PLATFORM} platform" + MSG_AUNIX = "Abstract UNIXSockets aren't available on the #{RUBY_PLATFORM} platform" SIGNAL_LIST = Signal.list.keys.map(&:to_sym) - (Puma.windows? ? [:INT, :TERM] : []) JRUBY_HEAD = Puma::IS_JRUBY && RUBY_DESCRIPTION =~ /SNAPSHOT/ + DARWIN = RUBY_PLATFORM.include? 'darwin' + + TRUFFLE = RUBY_ENGINE == 'truffleruby' + # usage: skip_unless_signal_exist? :USR2 def skip_unless_signal_exist?(sig, bt: caller) signal = sig.to_s.sub(/\ASIG/, '').to_sym @@ -113,18 +114,22 @@ module TestSkips end end - # called with one or more params, like skip_on :jruby, :windows + # called with one or more params, like skip_if :jruby, :windows # optional suffix kwarg is appended to the skip message # optional suffix bt should generally not used - def skip_on(*engs, suffix: '', bt: caller) + def skip_if(*engs, suffix: '', bt: caller) engs.each do |eng| skip_msg = case eng - when :darwin then "Skipped on darwin#{suffix}" if RUBY_PLATFORM[/darwin/] - when :jruby then "Skipped on JRuby#{suffix}" if Puma.jruby? - when :truffleruby then "Skipped on TruffleRuby#{suffix}" if RUBY_ENGINE == "truffleruby" - when :windows then "Skipped on Windows#{suffix}" if Puma.windows? - when :ci then "Skipped on ENV['CI']#{suffix}" if ENV["CI"] - when :no_bundler then "Skipped w/o Bundler#{suffix}" if !defined?(Bundler) + when :darwin then "Skipped if darwin#{suffix}" if Puma::IS_OSX + when :jruby then "Skipped if JRuby#{suffix}" if Puma::IS_JRUBY + when :truffleruby then "Skipped if TruffleRuby#{suffix}" if TRUFFLE + when :windows then "Skipped if Windows#{suffix}" if Puma::IS_WINDOWS + when :ci then "Skipped if ENV['CI']#{suffix}" if ENV['CI'] + when :no_bundler then "Skipped w/o Bundler#{suffix}" if !defined?(Bundler) + when :ssl then "Skipped if SSL is supported" if Puma::HAS_SSL + when :fork then "Skipped if Kernel.fork exists" if HAS_FORK + when :unix then "Skipped if UNIXSocket exists" if Puma::HAS_UNIX_SOCKET + when :aunix then "Skipped if abstract UNIXSocket" if Puma.abstract_unix_socket? else false end skip skip_msg, bt if skip_msg @@ -134,10 +139,14 @@ module TestSkips # called with only one param def skip_unless(eng, bt: caller) skip_msg = case eng - when :darwin then "Skip unless darwin" unless RUBY_PLATFORM[/darwin/] - when :jruby then "Skip unless JRuby" unless Puma.jruby? - when :windows then "Skip unless Windows" unless Puma.windows? - when :mri then "Skip unless MRI" unless Puma.mri? + when :darwin then "Skip unless darwin" unless Puma::IS_OSX + when :jruby then "Skip unless JRuby" unless Puma::IS_JRUBY + when :windows then "Skip unless Windows" unless Puma::IS_WINDOWS + when :mri then "Skip unless MRI" unless Puma::IS_MRI + when :ssl then "Skip unless SSL is supported" unless Puma::HAS_SSL + when :fork then MSG_FORK unless HAS_FORK + when :unix then MSG_UNIX unless Puma::HAS_UNIX_SOCKET + when :aunix then MSG_AUNIX unless Puma.abstract_unix_socket? else false end skip skip_msg, bt if skip_msg diff --git a/test/helpers/integration.rb b/test/helpers/integration.rb index 3cdfccf6..b13ef2a3 100644 --- a/test/helpers/integration.rb +++ b/test/helpers/integration.rb @@ -199,10 +199,10 @@ class TestIntegration < Minitest::Test def hot_restart_does_not_drop_connections(num_threads: 1, total_requests: 500) skipped = true - skip_on :jruby, suffix: <<-MSG + skip_if :jruby, suffix: <<-MSG - file descriptors are not preserved on exec on JRuby; connection reset errors are expected during restarts MSG - skip_on :truffleruby, suffix: ' - Undiagnosed failures on TruffleRuby' + skip_if :truffleruby, suffix: ' - Undiagnosed failures on TruffleRuby' skip "Undiagnosed failures on Ruby 2.2" if RUBY_VERSION < '2.3' args = "-w #{workers} -t 0:5 -q test/rackup/hello_with_delay.ru" diff --git a/test/test_binder.rb b/test/test_binder.rb index 05529c7c..af28d821 100644 --- a/test/test_binder.rb +++ b/test/test_binder.rb @@ -102,14 +102,14 @@ class TestBinder < TestBinderBase end def test_localhost_addresses_dont_alter_listeners_for_ssl_addresses - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://localhost:0?#{ssl_query}"], @events assert_empty @binder.listeners end def test_home_alters_listeners_for_ssl_addresses - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl port = UniquePort.call @binder.parse ["ssl://127.0.0.1:#{port}?#{ssl_query}"], @events @@ -127,7 +127,7 @@ class TestBinder < TestBinderBase end def test_correct_zero_port_ssl - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl ssl_regex = %r!ssl://127.0.0.1:(\d+)! @@ -148,7 +148,7 @@ class TestBinder < TestBinderBase end def test_logs_all_localhost_bindings_ssl - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://localhost:0?#{ssl_query}"], @events @@ -163,7 +163,7 @@ class TestBinder < TestBinderBase end def test_allows_both_unix_and_tcp - skip_on :jruby # Undiagnosed thread race. TODO fix + skip_if :jruby # Undiagnosed thread race. TODO fix assert_parsing_logs_uri [:unix, :tcp] end @@ -172,7 +172,7 @@ class TestBinder < TestBinderBase end def test_pre_existing_unix - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix unix_path = tmp_path('.sock') File.open(unix_path, mode: 'wb') { |f| f.puts 'pre existing' } @@ -193,21 +193,21 @@ class TestBinder < TestBinderBase end def test_binder_parses_tlsv1_disabled - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://0.0.0.0:0?#{ssl_query}&no_tlsv1=true"], @events assert ssl_context_for_binder.no_tlsv1 end def test_binder_parses_tlsv1_enabled - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://0.0.0.0:0?#{ssl_query}&no_tlsv1=false"], @events refute ssl_context_for_binder.no_tlsv1 end def test_binder_parses_tlsv1_tlsv1_1_unspecified_defaults_to_enabled - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://0.0.0.0:0?#{ssl_query}"], @events refute ssl_context_for_binder.no_tlsv1 @@ -215,21 +215,21 @@ class TestBinder < TestBinderBase end def test_binder_parses_tlsv1_1_disabled - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://0.0.0.0:0?#{ssl_query}&no_tlsv1_1=true"], @events assert ssl_context_for_binder.no_tlsv1_1 end def test_binder_parses_tlsv1_1_enabled - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://0.0.0.0:0?#{ssl_query}&no_tlsv1_1=false"], @events refute ssl_context_for_binder.no_tlsv1_1 end def test_env_contains_protoenv - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://localhost:0?#{ssl_query}"], @events env_hash = @binder.envs[@binder.ios.first] @@ -240,7 +240,7 @@ class TestBinder < TestBinderBase end def test_env_contains_stderr - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl @binder.parse ["ssl://localhost:0?#{ssl_query}"], @events env_hash = @binder.envs[@binder.ios.first] @@ -303,7 +303,7 @@ class TestBinder < TestBinderBase end def test_listeners_file_unlink_if_unix_listener - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix unix_path = tmp_path('.sock') @binder.parse ["unix://#{unix_path}"], @events @@ -327,7 +327,7 @@ class TestBinder < TestBinderBase # because the check that we do in the code only works if you support UNIX sockets. # This is OK, because systemd obviously only works on Linux. def test_socket_activation_tcp - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix url = "127.0.0.1" port = UniquePort.call sock = Addrinfo.tcp(url, port).listen @@ -335,7 +335,7 @@ class TestBinder < TestBinderBase end def test_socket_activation_tcp_ipv6 - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix url = "::" port = UniquePort.call sock = Addrinfo.tcp(url, port).listen @@ -343,8 +343,8 @@ class TestBinder < TestBinderBase end def test_socket_activation_unix - skip_on :jruby # Failing with what I think is a JRuby bug - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_if :jruby # Failing with what I think is a JRuby bug + skip_unless :unix state_path = tmp_path('.state') sock = Addrinfo.unix(state_path).listen @@ -400,8 +400,8 @@ class TestBinder < TestBinderBase end def assert_parsing_logs_uri(order = [:unix, :tcp]) - skip UNIX_SKT_MSG if order.include?(:unix) && !UNIX_SKT_EXIST - skip 'No ssl support' unless ::Puma::HAS_SSL + skip MSG_UNIX if order.include?(:unix) && !UNIX_SKT_EXIST + skip_unless :ssl unix_path = tmp_path('.sock') prepared_paths = { @@ -429,7 +429,7 @@ end class TestBinderJRuby < TestBinderBase def test_binder_parses_jruby_ssl_options - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl keystore = File.expand_path "../../examples/puma/keystore.jks", __FILE__ ssl_cipher_list = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" @@ -443,7 +443,7 @@ end if ::Puma::IS_JRUBY class TestBinderMRI < TestBinderBase def test_binder_parses_ssl_cipher_filter - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl ssl_cipher_filter = "AES@STRENGTH" @@ -453,7 +453,7 @@ class TestBinderMRI < TestBinderBase end def test_binder_parses_ssl_verification_flags_one - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl input = "&verification_flags=TRUSTED_FIRST" @@ -463,7 +463,7 @@ class TestBinderMRI < TestBinderBase end def test_binder_parses_ssl_verification_flags_multiple - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl input = "&verification_flags=TRUSTED_FIRST,NO_CHECK_TIME" diff --git a/test/test_cli.rb b/test/test_cli.rb index 6c63d730..c175be91 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -67,7 +67,7 @@ class TestCLI < Minitest::Test end def test_control_for_ssl - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl require "net/http" control_port = UniquePort.call @@ -105,8 +105,8 @@ class TestCLI < Minitest::Test end def test_control_clustered - skip NO_FORK_MSG unless HAS_FORK - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :fork + skip_unless :unix url = "unix://#{@tmp_path}" cli = Puma::CLI.new ["-b", "unix://#{@tmp_path2}", @@ -156,7 +156,7 @@ class TestCLI < Minitest::Test end def test_control - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix url = "unix://#{@tmp_path}" cli = Puma::CLI.new ["-b", "unix://#{@tmp_path2}", @@ -183,7 +183,7 @@ class TestCLI < Minitest::Test end def test_control_stop - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix url = "unix://#{@tmp_path}" cli = Puma::CLI.new ["-b", "unix://#{@tmp_path2}", @@ -248,7 +248,7 @@ class TestCLI < Minitest::Test end def test_control_thread_backtraces - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix url = "unix://#{@tmp_path}" cli = Puma::CLI.new ["-b", "unix://#{@tmp_path2}", @@ -330,7 +330,7 @@ class TestCLI < Minitest::Test end def test_control_gc_stats_unix - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix uri = "unix://#{@tmp_path2}" cntl = "unix://#{@tmp_path}" @@ -339,7 +339,7 @@ class TestCLI < Minitest::Test end def test_tmp_control - skip_on :jruby, suffix: " - Unknown issue" + skip_if :jruby, suffix: " - Unknown issue" cli = Puma::CLI.new ["--state", @tmp_path, "--control-url", "auto"] cli.launcher.write_state @@ -356,7 +356,7 @@ class TestCLI < Minitest::Test end def test_state_file_callback_filtering - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork cli = Puma::CLI.new [ "--config", "test/config/state_file_testing_config.rb", "--state", @tmp_path ] cli.launcher.write_state @@ -373,7 +373,7 @@ class TestCLI < Minitest::Test end def test_log_formatter_default_clustered - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork cli = Puma::CLI.new [ "-w 2" ] assert_instance_of Puma::Events::PidFormatter, cli.launcher.events.formatter @@ -386,7 +386,7 @@ class TestCLI < Minitest::Test end def test_log_formatter_custom_clustered - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork cli = Puma::CLI.new [ "--config", "test/config/custom_log_formatter.rb", "-w 2" ] assert_instance_of Proc, cli.launcher.events.formatter diff --git a/test/test_config.rb b/test/test_config.rb index 072a3b33..d4e24436 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -43,7 +43,7 @@ class TestConfigFile < TestConfigFileBase end def test_ssl_configuration_from_DSL - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl conf = Puma::Configuration.new do |config| config.load "test/config/ssl_config.rb" end @@ -60,8 +60,8 @@ class TestConfigFile < TestConfigFileBase end def test_ssl_bind - skip_on :jruby - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_if :jruby + skip_unless :ssl conf = Puma::Configuration.new do |c| c.ssl_bind "0.0.0.0", "9292", { @@ -79,7 +79,7 @@ class TestConfigFile < TestConfigFileBase def test_ssl_bind_jruby skip_unless :jruby - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl cipher_list = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" @@ -104,8 +104,8 @@ class TestConfigFile < TestConfigFileBase def test_ssl_bind_no_tlsv1_1 - skip_on :jruby - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_if :jruby + skip_unless :ssl conf = Puma::Configuration.new do |c| c.ssl_bind "0.0.0.0", "9292", { @@ -123,8 +123,8 @@ class TestConfigFile < TestConfigFileBase end def test_ssl_bind_with_cipher_filter - skip_on :jruby - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_if :jruby + skip_unless :ssl cipher_filter = "!aNULL:AES+SHA" conf = Puma::Configuration.new do |c| @@ -142,8 +142,8 @@ class TestConfigFile < TestConfigFileBase end def test_ssl_bind_with_verification_flags - skip_on :jruby - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_if :jruby + skip_unless :ssl conf = Puma::Configuration.new do |c| c.ssl_bind "0.0.0.0", "9292", { @@ -160,7 +160,7 @@ class TestConfigFile < TestConfigFileBase end def test_ssl_bind_with_ca - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl conf = Puma::Configuration.new do |c| c.ssl_bind "0.0.0.0", "9292", { cert: "/path/to/cert", diff --git a/test/test_http11.rb b/test/test_http11.rb index d8c51e1e..9a1f9d91 100644 --- a/test/test_http11.rb +++ b/test/test_http11.rb @@ -114,7 +114,7 @@ class Http11ParserTest < Minitest::Test end def test_semicolon_in_path - skip_on :jruby # Not yet supported on JRuby, see https://github.com/puma/puma/issues/1978 + skip_if :jruby # Not yet supported on JRuby, see https://github.com/puma/puma/issues/1978 parser = Puma::HttpParser.new req = {} get = "GET /forums/1/path;stillpath/2375?page=1 HTTP/1.1\r\n\r\n" diff --git a/test/test_integration_cluster.rb b/test/test_integration_cluster.rb index 4cb0867b..33bbf6f5 100644 --- a/test/test_integration_cluster.rb +++ b/test/test_integration_cluster.rb @@ -7,7 +7,7 @@ class TestIntegrationCluster < TestIntegration def workers ; 2 ; end def setup - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork super end @@ -25,7 +25,7 @@ class TestIntegrationCluster < TestIntegration end def test_pre_existing_unix - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix File.open(@bind_path, mode: 'wb') { |f| f.puts 'pre existing' } @@ -306,9 +306,7 @@ RUBY cli_server "-w #{workers} --preload test/rackup/write_to_stdout_on_boot.ru" worker_load_count = 0 - while (line = @server.gets) =~ /^Loading app/ - worker_load_count += 1 - end + worker_load_count += 1 while @server.gets =~ /^Loading app/ assert_equal 0, worker_load_count end @@ -321,7 +319,7 @@ RUBY output << line end - assert_match /WARNING: Detected running cluster mode with 1 worker/, output.join + assert_match(/WARNING: Detected running cluster mode with 1 worker/, output.join) end def test_warning_message_not_outputted_when_single_worker_silenced @@ -332,7 +330,7 @@ RUBY output << line end - refute_match /WARNING: Detected running cluster mode with 1 worker/, output.join + refute_match(/WARNING: Detected running cluster mode with 1 worker/, output.join) end private diff --git a/test/test_integration_pumactl.rb b/test/test_integration_pumactl.rb index 23598f03..babf98ca 100644 --- a/test/test_integration_pumactl.rb +++ b/test/test_integration_pumactl.rb @@ -23,7 +23,7 @@ class TestIntegrationPumactl < TestIntegration end def test_stop_tcp - skip_on :jruby, :truffleruby # Undiagnose thread race. TODO fix + skip_if :jruby, :truffleruby # Undiagnose thread race. TODO fix @control_tcp_port = UniquePort.call cli_server "-q test/rackup/sleep.ru --control-url tcp://#{HOST}:#{@control_tcp_port} --control-token #{TOKEN} -S #{@state_path}" @@ -44,7 +44,7 @@ class TestIntegrationPumactl < TestIntegration end def ctl_unix(signal='stop') - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix stderr = Tempfile.new(%w(stderr .log)) cli_server "-q test/rackup/sleep.ru --control-url unix://#{@control_path} --control-token #{TOKEN} -S #{@state_path}", config: "stdout_redirect nil, '#{stderr.path}'", @@ -59,7 +59,7 @@ class TestIntegrationPumactl < TestIntegration end def test_phased_restart_cluster - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork cli_server "-q -w #{workers} test/rackup/sleep.ru --control-url unix://#{@control_path} --control-token #{TOKEN} -S #{@state_path}", unix: true start = Time.now @@ -94,7 +94,7 @@ class TestIntegrationPumactl < TestIntegration end def test_prune_bundler_with_multiple_workers - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork cli_server "-q -C test/config/prune_bundler_with_multiple_workers.rb --control-url unix://#{@control_path} --control-token #{TOKEN} -S #{@state_path}", unix: true @@ -114,7 +114,7 @@ class TestIntegrationPumactl < TestIntegration end def test_kill_unknown - skip_on :jruby + skip_if :jruby # we run ls to get a 'safe' pid to pass off as puma in cli stop # do not want to accidentally kill a valid other process diff --git a/test/test_integration_single.rb b/test/test_integration_single.rb index 5cdb9aad..09e28c79 100644 --- a/test/test_integration_single.rb +++ b/test/test_integration_single.rb @@ -24,7 +24,7 @@ class TestIntegrationSingle < TestIntegration def test_usr2_restart_restores_environment # jruby has a bug where setting `nil` into the ENV or `delete` do not change the # next workers ENV - skip_on :jruby + skip_if :jruby skip_unless_signal_exist? :USR2 initial_reply, new_reply = restart_server_and_listen("-q test/rackup/hello-env.ru") @@ -36,7 +36,7 @@ class TestIntegrationSingle < TestIntegration def test_term_exit_code skip_unless_signal_exist? :TERM - skip_on :jruby # JVM does not return correct exit code for TERM + skip_if :jruby # JVM does not return correct exit code for TERM cli_server "test/rackup/hello.ru" _, status = stop_server @@ -65,7 +65,7 @@ class TestIntegrationSingle < TestIntegration def test_term_not_accepts_new_connections skip_unless_signal_exist? :TERM - skip_on :jruby + skip_if :jruby cli_server 'test/rackup/sleep.ru' @@ -94,7 +94,7 @@ class TestIntegrationSingle < TestIntegration def test_int_refuse skip_unless_signal_exist? :INT - skip_on :jruby # seems to intermittently lockup JRuby CI + skip_if :jruby # seems to intermittently lockup JRuby CI cli_server 'test/rackup/hello.ru' begin diff --git a/test/test_integration_systemd.rb b/test/test_integration_systemd.rb index d5438cba..c3257bc2 100644 --- a/test/test_integration_systemd.rb +++ b/test/test_integration_systemd.rb @@ -6,9 +6,9 @@ require 'sd_notify' class TestIntegrationSystemd < TestIntegration def setup skip "Skipped because Systemd support is linux-only" if windows? || osx? - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix skip_unless_signal_exist? :TERM - skip_on :jruby + skip_if :jruby super diff --git a/test/test_launcher.rb b/test/test_launcher.rb index 3c9a57e9..53ffe2d7 100644 --- a/test/test_launcher.rb +++ b/test/test_launcher.rb @@ -8,7 +8,7 @@ class TestLauncher < Minitest::Test include TmpPath def test_files_to_require_after_prune_is_correctly_built_for_no_extra_deps - skip_on :no_bundler + skip_if :no_bundler dirs = launcher.send(:files_to_require_after_prune) @@ -19,7 +19,7 @@ class TestLauncher < Minitest::Test end def test_files_to_require_after_prune_is_correctly_built_with_extra_deps - skip_on :no_bundler + skip_if :no_bundler conf = Puma::Configuration.new do |c| c.extra_runtime_dependencies ['rdoc'] end @@ -37,7 +37,7 @@ class TestLauncher < Minitest::Test end def test_extra_runtime_deps_directories_is_correctly_built - skip_on :no_bundler + skip_if :no_bundler conf = Puma::Configuration.new do |c| c.extra_runtime_dependencies ['rdoc'] end @@ -48,7 +48,7 @@ class TestLauncher < Minitest::Test end def test_puma_wild_location_is_an_absolute_path - skip_on :no_bundler + skip_if :no_bundler puma_wild_location = launcher.send(:puma_wild_location) assert_match(%r{bin/puma-wild$}, puma_wild_location) @@ -139,7 +139,7 @@ class TestLauncher < Minitest::Test end def test_puma_stats_clustered - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork conf = Puma::Configuration.new do |c| c.app -> {[200, {}, ['']]} diff --git a/test/test_preserve_bundler_env.rb b/test/test_preserve_bundler_env.rb index 162b4205..4a264984 100644 --- a/test/test_preserve_bundler_env.rb +++ b/test/test_preserve_bundler_env.rb @@ -3,7 +3,7 @@ require_relative "helpers/integration" class TestPreserveBundlerEnv < TestIntegration def setup - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork super end diff --git a/test/test_pumactl.rb b/test/test_pumactl.rb index d9949ff8..a88bee05 100644 --- a/test/test_pumactl.rb +++ b/test/test_pumactl.rb @@ -150,7 +150,7 @@ class TestPumaControlCli < TestConfigFileBase end def test_control_ssl - skip 'No ssl support' unless ::Puma::HAS_SSL + skip_unless :ssl host = "127.0.0.1" port = UniquePort.call diff --git a/test/test_redirect_io.rb b/test/test_redirect_io.rb index 144a03af..2172fe15 100644 --- a/test/test_redirect_io.rb +++ b/test/test_redirect_io.rb @@ -28,7 +28,7 @@ class TestRedirectIO < TestIntegration end def test_sighup_redirects_io_single - skip_on :jruby # Server isn't coming up in CI, TODO Fix + skip_if :jruby # Server isn't coming up in CI, TODO Fix cli_args = [ '--redirect-stdout', @out_file_path, @@ -55,7 +55,7 @@ class TestRedirectIO < TestIntegration end def test_sighup_redirects_io_cluster - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork cli_args = [ '-w', '1', diff --git a/test/test_unix_socket.rb b/test/test_unix_socket.rb index 74c158c2..bd6dcfe5 100644 --- a/test/test_unix_socket.rb +++ b/test/test_unix_socket.rb @@ -22,7 +22,7 @@ class TestPumaUnixSocket < Minitest::Test end def test_server - skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + skip_unless :unix sock = UNIXSocket.new @tmp_socket_path sock << "GET / HTTP/1.0\r\nHost: blah.com\r\n\r\n" diff --git a/test/test_worker_gem_independence.rb b/test/test_worker_gem_independence.rb index 1c0699e6..085a0222 100644 --- a/test/test_worker_gem_independence.rb +++ b/test/test_worker_gem_independence.rb @@ -3,7 +3,7 @@ require_relative "helpers/integration" class TestWorkerGemIndependence < TestIntegration def setup - skip NO_FORK_MSG unless HAS_FORK + skip_unless :fork super end