diff --git a/.travis.yml b/.travis.yml index d38f50fd..678d0040 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,5 @@ before_install: rvm: - 2.2.4 - 2.3.0 - - jruby-head + - 2.4.0 + - jruby-9.1.6.0 diff --git a/Gemfile b/Gemfile index bdca91d3..3126232f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,11 @@ source 'https://rubygems.org' gemspec -gem 'rails', '5.0.0' +gem 'rails', '>= 5.0.1' gem "hiredis" gem 'simplecov' gem 'minitest' -gem 'minitest-utils' +#gem 'minitest-utils' gem 'toxiproxy' platforms :rbx do diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index c1437ef2..2ba919d5 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -142,7 +142,7 @@ module Sidekiq end when 'TTIN' Thread.list.each do |thread| - Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}" + Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['sidekiq_label']}" if thread.backtrace Sidekiq.logger.warn thread.backtrace.join("\n") else diff --git a/lib/sidekiq/manager.rb b/lib/sidekiq/manager.rb index 75d10e25..60fc505b 100644 --- a/lib/sidekiq/manager.rb +++ b/lib/sidekiq/manager.rb @@ -10,7 +10,7 @@ module Sidekiq ## # The Manager is the central coordination point in Sidekiq, controlling - # the lifecycle of the Processors and feeding them jobs as necessary. + # the lifecycle of the Processors. # # Tasks: # diff --git a/lib/sidekiq/middleware/server/retry_jobs.rb b/lib/sidekiq/middleware/server/retry_jobs.rb index 26d2888c..79e730a5 100644 --- a/lib/sidekiq/middleware/server/retry_jobs.rb +++ b/lib/sidekiq/middleware/server/retry_jobs.rb @@ -162,7 +162,7 @@ module Sidekiq end def retry_attempts_from(msg_retry, default) - if msg_retry.is_a?(Fixnum) + if msg_retry.is_a?(Integer) msg_retry else default diff --git a/lib/sidekiq/util.rb b/lib/sidekiq/util.rb index 17ec1763..d735ef80 100644 --- a/lib/sidekiq/util.rb +++ b/lib/sidekiq/util.rb @@ -22,6 +22,7 @@ module Sidekiq def safe_thread(name, &block) Thread.new do + Thread.current['sidekiq_label'] = name watchdog(name, &block) end end diff --git a/lib/sidekiq/web/application.rb b/lib/sidekiq/web/application.rb index a572fabb..abb6c433 100644 --- a/lib/sidekiq/web/application.rb +++ b/lib/sidekiq/web/application.rb @@ -274,7 +274,7 @@ module Sidekiq resp = case resp when Array resp - when Fixnum + when Integer [resp, {}, []] else type_header = case action.type diff --git a/sidekiq.gemspec b/sidekiq.gemspec index 6a569fc4..f4245871 100644 --- a/sidekiq.gemspec +++ b/sidekiq.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |gem| gem.add_dependency 'concurrent-ruby', '~> 1.0' gem.add_dependency 'rack-protection', '>= 1.5.0' gem.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.2' - gem.add_development_dependency 'minitest', '~> 5.7', '>= 5.7.0' + gem.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.1' gem.add_development_dependency 'rake', '~> 10.0' gem.add_development_dependency 'rails', '>= 3.2.0' end diff --git a/test/test_cli.rb b/test/test_cli.rb index f6328a21..056a3f56 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -185,7 +185,7 @@ class TestCli < Sidekiq::Test assert_equal './test/config.yml', Sidekiq.options[:config_file] refute Sidekiq.options[:verbose] assert_equal './test/fake_env.rb', Sidekiq.options[:require] - assert_equal nil, Sidekiq.options[:environment] + assert_nil Sidekiq.options[:environment] assert_equal 50, Sidekiq.options[:concurrency] assert_equal '/tmp/sidekiq-config-test.pid', Sidekiq.options[:pidfile] assert_equal '/tmp/sidekiq.log', Sidekiq.options[:logfile] @@ -373,7 +373,7 @@ class TestCli < Sidekiq::Test @tmp_log_path = '/tmp/sidekiq.log' @cli.parse(['sidekiq', '-L', @tmp_log_path, '-r', './test/fake_env.rb']) @mock_thread = MiniTest::Mock.new - @mock_thread.expect(:[], 'interrupt_test', ['label']) + @mock_thread.expect(:[], 'interrupt_test', ['sidekiq_label']) end after do diff --git a/test/test_client.rb b/test/test_client.rb index 9b828b3c..d902c13f 100644 --- a/test/test_client.rb +++ b/test/test_client.rb @@ -159,7 +159,7 @@ class TestClient < Sidekiq::Test chain.add Stopper end - assert_equal nil, client.push('class' => MyWorker, 'args' => [0]) + assert_nil client.push('class' => MyWorker, 'args' => [0]) assert_match(/[0-9a-f]{12}/, client.push('class' => MyWorker, 'args' => [1])) client.push_bulk('class' => MyWorker, 'args' => [[0], [1]]).each do |jid| assert_match(/[0-9a-f]{12}/, jid) diff --git a/test/test_logging.rb b/test/test_logging.rb index efddf091..c2b01b33 100644 --- a/test/test_logging.rb +++ b/test/test_logging.rb @@ -5,30 +5,30 @@ require 'sidekiq/logging' class TestLogging < Sidekiq::Test describe Sidekiq::Logging do describe "#with_context" do - def context + def ctx Sidekiq::Logging.logger.formatter.context end it "has no context by default" do - context.must_equal nil + assert_nil ctx end it "can add a context" do Sidekiq::Logging.with_context "xx" do - context.must_equal " xx" + assert_equal " xx", ctx end - context.must_equal nil + assert_nil ctx end it "can use multiple contexts" do Sidekiq::Logging.with_context "xx" do - context.must_equal " xx" + assert_equal " xx", ctx Sidekiq::Logging.with_context "yy" do - context.must_equal " xx yy" + assert_equal " xx yy", ctx end - context.must_equal " xx" + assert_equal " xx", ctx end - context.must_equal nil + assert_nil ctx end end end diff --git a/test/test_middleware.rb b/test/test_middleware.rb index e11ad0cf..4bb5b2bf 100644 --- a/test/test_middleware.rb +++ b/test/test_middleware.rb @@ -112,7 +112,7 @@ class TestMiddleware < Sidekiq::Test final_action = nil chain.invoke { final_action = true } - assert_equal nil, final_action + assert_nil final_action assert_equal [], recorder end end diff --git a/test/test_retry_exhausted.rb b/test/test_retry_exhausted.rb index e9d7bf4d..f356bfff 100644 --- a/test/test_retry_exhausted.rb +++ b/test/test_retry_exhausted.rb @@ -117,7 +117,7 @@ class TestRetryExhausted < Sidekiq::Test assert old_worker.exhausted_called? assert_equal raised_error.message, old_worker.exhausted_job['error_message'] - assert_equal nil, new_worker.exhausted_exception + assert_nil new_worker.exhausted_exception end it 'allows a global default handler' do