Sha256: d24eab20a947c5e7c9407b83974f7c5b95a36598c689137164d919654f3ca763

Contents?: true

Size: 1.88 KB

Versions: 14

Compression:

Stored size: 1.88 KB

Contents

# Copyright (c) 2015 AppNeta, Inc.
# All rights reserved.

require 'minitest_helper'

class AutoTraceTest  < Minitest::Test
  def setup
    @tm = TraceView::Config[:tracing_mode]
  end

  def teardown
    TraceView::Config[:tracing_mode] = @tm
  end

  def test_entry_layers
    TraceView.entry_layer?('delayed_job-worker').must_equal true
    TraceView.entry_layer?('sidekiq-worker').must_equal true
    TraceView.entry_layer?('resque-worker').must_equal true
    TraceView.entry_layer?('rabbitmq-consumer').must_equal true
    TraceView.entry_layer?('asdf-worker').must_equal false
  end

  def test_entry_layers_supports_symbols
    TraceView.entry_layer?(:'delayed_job-worker').must_equal true
    TraceView.entry_layer?(:'resque-worker').must_equal true
    TraceView.entry_layer?(:'rabbitmq-consumer').must_equal true
    TraceView.entry_layer?(:asdfworker).must_equal false
  end

  def test_trace_when_default_tm_dj
    TraceView::Config[:tracing_mode] = :through

    TV::API.start_trace('delayed_job-worker') do
      TraceView.tracing?.must_equal true
    end
  end

  def test_trace_when_default_tm_sidekiq
    TraceView::Config[:tracing_mode] = :through

    TV::API.start_trace('sidekiq-worker') do
      TraceView.tracing?.must_equal true
    end
  end

  def test_trace_when_default_tm_resque
    TraceView::Config[:tracing_mode] = :through

    TV::API.start_trace('resque-worker') do
      TraceView.tracing?.must_equal true
    end
  end

  def test_trace_when_default_tm_rabbitmq
    TraceView::Config[:tracing_mode] = :through

    TV::API.start_trace('rabbitmq-consumer') do
      TraceView.tracing?.must_equal true
    end
  end

  def test_dont_trace_when_never
    TraceView::Config[:tracing_mode] = :never

    TV::API.start_trace('delayed_job-worker') do
      TraceView.tracing?.must_equal false
    end

    TV::API.start_trace('asdf') do
      TraceView.tracing?.must_equal false
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
traceview-3.8.3-java test/support/auto_tracing_test.rb
traceview-3.8.3 test/support/auto_tracing_test.rb
traceview-3.8.2-java test/support/auto_tracing_test.rb
traceview-3.8.2 test/support/auto_tracing_test.rb
traceview-3.8.1-java test/support/auto_tracing_test.rb
traceview-3.8.1 test/support/auto_tracing_test.rb
traceview-3.8.0-java test/support/auto_tracing_test.rb
traceview-3.8.0 test/support/auto_tracing_test.rb
traceview-3.7.1-java test/support/auto_tracing_test.rb
traceview-3.7.1 test/support/auto_tracing_test.rb
traceview-3.7.0-java test/support/auto_tracing_test.rb
traceview-3.7.0 test/support/auto_tracing_test.rb
traceview-3.6.0-java test/support/auto_tracing_test.rb
traceview-3.6.0 test/support/auto_tracing_test.rb