test/instrumentation/sidekiq-client_test.rb in instana-1.209.8 vs test/instrumentation/sidekiq-client_test.rb in instana-1.210.0
- old
+ new
@@ -4,10 +4,23 @@
require 'test_helper'
require 'support/apps/sidekiq/boot'
class SidekiqClientTest < Minitest::Test
def setup
+ @framework_version = Gem::Specification.find_by_name('sidekiq').version
+ @supported_framework_version = @framework_version < Gem::Version.new('5.3')
+ @execute_test_if_framework_version_is_supported = lambda {
+ unless @supported_framework_version
+ skip "Skipping this test because sidekiq version #{@framework_version} is not yet supported!"
+ end
+ }
+ @execute_test_only_if_framework_version_is_not_supported = lambda {
+ if @supported_framework_version
+ skip "Skipping this test because sidekiq version #{@framework_version} is already supported!"
+ end
+ }
+
Sidekiq.configure_client do |config|
config.redis = { url: ENV["REDIS_URL"] }
end
::Sidekiq::Queue.new('some_random_queue').clear
end
@@ -17,10 +30,11 @@
assert ::Instana.config[:'sidekiq-client'].key?(:enabled)
assert_equal true, ::Instana.config[:'sidekiq-client'][:enabled]
end
def test_enqueue
+ @execute_test_if_framework_version_is_supported.call
clear_all!
Instana.tracer.start_or_continue_trace(:sidekiqtests) do
disable_redis_instrumentation
::Sidekiq::Client.push(
'queue' => 'some_random_queue',
@@ -37,9 +51,10 @@
assert_job_enqueued(job)
assert_normal_trace_recorded(job)
end
def test_enqueue_failure
+ @execute_test_if_framework_version_is_supported.call
clear_all!
Instana.tracer.start_or_continue_trace(:sidekiqtests) do
disable_redis_instrumentation
add_sidekiq_exception_middleware