Sha256: cf30cbee24f592c8f70df914f08607c5aac7b8c0d831c3f5de395355effcd19d

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.

require 'minitest_helper'

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

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

  def test_trace_when_default_tm_dj
    AppOpticsAPM::API.start_trace('delayed_job-worker') do
      AppOpticsAPM.tracing?.must_equal true
    end
  end

  def test_trace_when_default_tm_sidekiq
    AppOpticsAPM::API.start_trace('sidekiq-worker') do
      AppOpticsAPM.tracing?.must_equal true
    end
  end

  def test_trace_when_default_tm_resque
    AppOpticsAPM::API.start_trace('resque-worker') do
      AppOpticsAPM.tracing?.must_equal true
    end
  end

  def test_trace_when_default_tm_rabbitmq
    AppOpticsAPM::API.start_trace('rabbitmq-consumer') do
      AppOpticsAPM.tracing?.must_equal true
    end
  end

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appoptics_apm-4.0.3 test/support/auto_tracing_test.rb
appoptics_apm-4.0.2 test/support/auto_tracing_test.rb
appoptics_apm-4.0.1-x86_64-linux test/support/auto_tracing_test.rb