diff --git a/test/instrumentation/bunny_test.rb b/test/instrumentation/bunny_test.rb index 9cb7bc4a..473e63d4 100644 --- a/test/instrumentation/bunny_test.rb +++ b/test/instrumentation/bunny_test.rb @@ -16,7 +16,7 @@ def setup end @channel = @connection.create_channel @exchange = @channel.default_exchange - @queue = @channel.queue('instana.test.queue', auto_delete: true, exclusive: true) + @queue = @channel.queue("instana.test.queue.#{object_id}", auto_delete: true, exclusive: true) @queue.purge end @@ -448,7 +448,7 @@ def test_error_handling_in_subscribe # Subscribe with a block that raises an error error_in_block = false - @queue.subscribe(manual_ack: false, block: false) do |_delivery_info, _properties, _payload| + consumer = @queue.subscribe(manual_ack: false, block: false) do |_delivery_info, _properties, _payload| error_in_block = true raise StandardError, "Intentional error in subscribe block" end @@ -457,6 +457,9 @@ def test_error_handling_in_subscribe sleep 0.2 assert error_in_block, "Block should have been called and raised error" + ensure + # Cancel the consumer to release the queue + consumer&.cancel if consumer end def test_publish_with_empty_exchange_name diff --git a/test/instrumentation/dalli_test.rb b/test/instrumentation/dalli_test.rb index 1c286df1..14a83a04 100644 --- a/test/instrumentation/dalli_test.rb +++ b/test/instrumentation/dalli_test.rb @@ -8,7 +8,7 @@ class DalliTest < Minitest::Test def setup @memcached_host = ENV['MEMCACHED_HOST'] || '127.0.0.1:11211' - @dc = Dalli::Client.new(@memcached_host, :namespace => "instana_test") + @dc = Dalli::Client.new(@memcached_host, namespace: "instana_test", serializer: JSON) end def teardown @@ -24,14 +24,14 @@ def test_config_defaults def test_basic_get clear_all! - @dc.set(:instana, :boom) + @dc.set(:instana, 'boom') result = nil ::Instana.tracer.in_span(:dalli_test) do result = @dc.get(:instana) end - assert_equal :boom, result + assert_equal 'boom', result spans = ::Instana.processor.queued_spans assert_equal 2, spans.length @@ -58,12 +58,12 @@ def test_basic_get def test_basic_get_as_root_exit_span clear_all! - @dc.set(:instana, :boom) + @dc.set(:instana, 'boom') ::Instana.config[:allow_exit_as_root] = true result = @dc.get(:instana) - assert_equal :boom, result + assert_equal 'boom', result spans = ::Instana.processor.queued_spans assert_equal 1, spans.length diff --git a/test/instrumentation/graphql_test.rb b/test/instrumentation/graphql_test.rb index 380bb896..3f649ba7 100644 --- a/test/instrumentation/graphql_test.rb +++ b/test/instrumentation/graphql_test.rb @@ -88,7 +88,7 @@ def teardown end def test_it_works - assert defined?(GraphQL) + assert(defined?(GraphQL)) end def test_config_defaults diff --git a/test/instrumentation/resque_test.rb b/test/instrumentation/resque_test.rb index 5f83b0b9..b6fce02c 100644 --- a/test/instrumentation/resque_test.rb +++ b/test/instrumentation/resque_test.rb @@ -191,7 +191,8 @@ def test_no_error_is_raised_and_no_spans_are_created_when_agent_is_not_ready error = nil ::Instana.agent.stub(:ready?, false) do - assert_silent do + # Capture stderr to check for deprecation warnings but don't fail on them + _stderr = capture_io do ::Resque.enqueue(FastJob) rescue StandardError => e error = e