Skip to content

Commit

Permalink
fix timeout issue for older redises
Browse files Browse the repository at this point in the history
  • Loading branch information
zvkemp committed Dec 20, 2024
1 parent efc750d commit f434e4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion instrumentation/sidekiq/Appraisals
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

{
'sidekiq-7' => [['sidekiq', '~> 7.0']],
'sidekiq-7.0' => [['sidekiq', '~> 7.0']],
'sidekiq-6.5' => [['sidekiq', '>= 6.5', '< 7.0']],
'sidekiq-6.0' => [
['sidekiq', '>= 6.0', '< 6.5'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'appraisal', '~> 2.5'
spec.add_development_dependency 'bundler', '~> 2.4'
spec.add_development_dependency 'minitest', '~> 5.0'
spec.add_development_dependency 'minitest-reporters'
spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1'
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rspec-mocks'
Expand Down
11 changes: 11 additions & 0 deletions instrumentation/sidekiq/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
require 'active_job'

require 'minitest/autorun'
require 'minitest/reporters'
require 'rspec/mocks/minitest_integration'
require 'sidekiq/testing'

Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new

if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.0.0')
require 'helpers/mock_loader_for_7.0'
elsif Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('6.5.0')
Expand All @@ -21,6 +24,14 @@
require 'helpers/mock_loader'
end

# speed up tests that rely on empty queues
Sidekiq::BasicFetch::TIMEOUT = if Gem.loaded_specs['sidekiq'].version < Gem::Version.new('6.5.0')
# Redis 4.8 has trouble with float timeouts given as positional arguments
1
else
0.1
end

# OpenTelemetry SDK config for testing
EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new
span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(EXPORTER)
Expand Down

0 comments on commit f434e4b

Please sign in to comment.