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.217.1 test/instrumentation/shoryuken_test.rb
instana-1.217.0 test/instrumentation/shoryuken_test.rb
instana-1.216.0 test/instrumentation/shoryuken_test.rb
instana-1.215.1 test/instrumentation/shoryuken_test.rb
instana-1.215.0 test/instrumentation/shoryuken_test.rb
instana-1.214.4 test/instrumentation/shoryuken_test.rb
instana-1.214.3 test/instrumentation/shoryuken_test.rb
instana-1.214.2 test/instrumentation/shoryuken_test.rb
instana-1.214.1 test/instrumentation/shoryuken_test.rb
instana-1.214.0 test/instrumentation/shoryuken_test.rb
instana-1.213.3 test/instrumentation/shoryuken_test.rb
instana-1.213.2 test/instrumentation/shoryuken_test.rb
instana-1.213.1 test/instrumentation/shoryuken_test.rb
instana-1.213.0 test/instrumentation/shoryuken_test.rb
instana-1.212.0 test/instrumentation/shoryuken_test.rb
instana-1.211.0 test/instrumentation/shoryuken_test.rb
instana-1.210.1 test/instrumentation/shoryuken_test.rb
instana-1.210.0 test/instrumentation/shoryuken_test.rb
instana-1.209.8 test/instrumentation/shoryuken_test.rb
instana-1.209.7 test/instrumentation/shoryuken_test.rb