Sha256: 0cee01d1247804932e6a541f95be5b7b59e34533e6ef87aab9b125a5894e1c1c

Contents?: true

Size: 1.2 KB

Versions: 60

Compression:

Stored size: 1.2 KB

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

require 'test_helper'
require 'ostruct'

class ShoryukenTest < Minitest::Test
  def setup
    clear_all!
    @middleware = Instana::Instrumentation::Shoryuken.new
  end

  def test_start_trace_with_context
    id = Instana::Util.generate_id
    message = OpenStruct.new(
      queue_url: 'http://example.com',
      message_attributes: {
        "X_INSTANA_T" => OpenStruct.new(string_value: id),
        "X_INSTANA_S" => OpenStruct.new(string_value: id),
        "X_INSTANA_L" => OpenStruct.new(string_value: '1')
      }
    )

    @middleware.call(nil, nil, message, nil) {}

    span = ::Instana.processor.queued_spans.first

    assert_equal id, span[:t]
    assert_equal id, span[:p]
    assert_equal 'entry', span[:data][:sqs][:sort]
    assert_equal 'http://example.com', span[:data][:sqs][:queue]
  end

  def test_start_trace
    message = OpenStruct.new(
      queue_url: 'http://example.com'
    )

    @middleware.call(nil, nil, message, nil) {}

    span = ::Instana.processor.queued_spans.first

    assert_nil span[:p]
    assert_equal 'entry', span[:data][:sqs][:sort]
    assert_equal 'http://example.com', span[:data][:sqs][:queue]
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
instana-1.202.0 test/instrumentation/shoryuken_test.rb
instana-1.201.0 test/instrumentation/shoryuken_test.rb
instana-1.201.0.pre1 test/instrumentation/shoryuken_test.rb
instana-1.200.0 test/instrumentation/shoryuken_test.rb
instana-1.200.0.pre1 test/instrumentation/shoryuken_test.rb
instana-1.199.6 test/instrumentation/shoryuken_test.rb
instana-1.199.5 test/instrumentation/shoryuken_test.rb
instana-1.199.4 test/instrumentation/shoryuken_test.rb
instana-1.199.3 test/instrumentation/shoryuken_test.rb
instana-1.199.2 test/instrumentation/shoryuken_test.rb
instana-1.199.1 test/instrumentation/shoryuken_test.rb
instana-1.199.0 test/instrumentation/shoryuken_test.rb
instana-1.198.0 test/instrumentation/shoryuken_test.rb
instana-1.198.0.pre1 test/instrumentation/shoryuken_test.rb
instana-1.197.0 test/instrumentation/shoryuken_test.rb
instana-1.197.0.pre2 test/instrumentation/shoryuken_test.rb
instana-1.197.0.pre1 test/instrumentation/shoryuken_test.rb
instana-1.195.4 test/instrumentation/shoryuken_test.rb
instana-1.195.3 test/instrumentation/shoryuken_test.rb
instana-1.195.2 test/instrumentation/shoryuken_test.rb