Sha256: eaeb9cf289226c036692e7b9e76613f9d0b95bcbfc032108abc1122737200931

Contents?: true

Size: 1.23 KB

Versions: 57

Compression:

Stored size: 1.23 KB

Contents

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

require 'test_helper'

class ProcessorTest < Minitest::Test
  def test_queued_spans_empty
    subject = Instana::Processor.new
    assert_equal [], subject.queued_spans
  end

  def test_queued_spans_valid_level
    clear_all!
    subject = Instana::Processor.new

    span_context = Instana::SpanContext.new('9', '8', 0)
    span = Instana::Span.new(:rack, parent_ctx: span_context)
    span2 = Instana::Span.new(:"net-http")

    subject.add_span(span)
    subject.add_span(span2)

    spans = subject.queued_spans
    valid_span, = spans

    assert_equal 1, spans.length
    assert_equal :"net-http", valid_span[:n]
  end

  def test_queued_spans_invalid_type
    subject = Instana::Processor.new
    subject.add_span(false)

    assert_equal [], subject.queued_spans
  end

  def test_send
    ENV['INSTANA_TEST'] = nil

    subject = Instana::Processor.new
    span = Instana::Span.new(:rack)
    subject.add_span(span)

    was_invoked = false

    subject.send do |spans|
      was_invoked = true
      rack_span, = spans

      assert_equal 1, spans.length
      assert_equal :rack, rack_span[:n]
    end

    assert was_invoked
  ensure
    ENV['INSTANA_TEST'] = 'true'
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
instana-1.217.1 test/tracing/processor_test.rb
instana-1.217.0 test/tracing/processor_test.rb
instana-1.216.0 test/tracing/processor_test.rb
instana-1.215.1 test/tracing/processor_test.rb
instana-1.215.0 test/tracing/processor_test.rb
instana-1.214.4 test/tracing/processor_test.rb
instana-1.214.3 test/tracing/processor_test.rb
instana-1.214.2 test/tracing/processor_test.rb
instana-1.214.1 test/tracing/processor_test.rb
instana-1.214.0 test/tracing/processor_test.rb
instana-1.213.3 test/tracing/processor_test.rb
instana-1.213.2 test/tracing/processor_test.rb
instana-1.213.1 test/tracing/processor_test.rb
instana-1.213.0 test/tracing/processor_test.rb
instana-1.212.0 test/tracing/processor_test.rb
instana-1.211.0 test/tracing/processor_test.rb
instana-1.210.1 test/tracing/processor_test.rb
instana-1.210.0 test/tracing/processor_test.rb
instana-1.209.8 test/tracing/processor_test.rb
instana-1.209.7 test/tracing/processor_test.rb