test/instrumentation/sidekiq-client_test.rb in instana-1.211.0 vs test/instrumentation/sidekiq-client_test.rb in instana-1.212.0

- old
+ new

@@ -4,37 +4,20 @@ 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 def test_config_defaults assert ::Instana.config[:'sidekiq-client'].is_a?(Hash) 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', @@ -51,11 +34,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 @@ -102,10 +84,11 @@ assert_equal :'sidekiq-client', second_span[:n] assert_equal 'some_random_queue', second_span[:data][:'sidekiq-client'][:queue] assert_equal 'SidekiqJobOne', second_span[:data][:'sidekiq-client'][:job] assert_equal "false", second_span[:data][:'sidekiq-client'][:retry] + assert second_span[:data][:'sidekiq-client'][:'redis-url'] assert_equal job['jid'], second_span[:data][:'sidekiq-client'][:job_id] end def assert_failure_trace_recorded spans = ::Instana.processor.queued_spans @@ -122,9 +105,10 @@ assert_equal false, second_span[:stack].nil? assert_equal 'some_random_queue', second_span[:data][:'sidekiq-client'][:queue] assert_equal 'SidekiqJobTwo', second_span[:data][:'sidekiq-client'][:job] assert_equal "false", second_span[:data][:'sidekiq-client'][:retry] + assert second_span[:data][:'sidekiq-client'][:'redis-url'] assert_equal 'Fail to enqueue job', second_span[:data][:log][:message] end SidekiqMiddlewareException = Class.new do def call(*_args)