Sha256: d269c56275d22b90867288d7a6e52a42d2b88bc98b1701fe8ce501772fb54e64

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'new_relic/agent/threading/fake_thread'

class ThreadedTestCase < Test::Unit::TestCase
  def setup
    @original_thread_class = NewRelic::Agent::Threading::AgentThread
    swap_thread_class(FakeThread)
  end

  def teardown
    swap_thread_class(@original_thread_class)
    @original_thread_class = nil

    FakeThread.list.clear
  end

  def default_test
    # no-op to keep quiet....
  end

  private

  def swap_thread_class(klass)
    if NewRelic::Agent::Threading.const_defined?("AgentThread")
      NewRelic::Agent::Threading.send(:remove_const, "AgentThread")
    end
    NewRelic::Agent::Threading.const_set("AgentThread", klass)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.7.159 test/new_relic/agent/threading/threaded_test_case.rb
newrelic_rpm-3.6.7.159.beta test/new_relic/agent/threading/threaded_test_case.rb
newrelic_rpm-3.6.7.152 test/new_relic/agent/threading/threaded_test_case.rb