Sha256: bfcf28942341b575360cba68d22e2107750ada8bbefcbb3cae2eb64163c0f14f

Contents?: true

Size: 1.5 KB

Versions: 61

Compression:

Stored size: 1.5 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper'))
class NewRelic::Agent::Instrumentation::ControllerInstrumentationTest < Test::Unit::TestCase
  require 'new_relic/agent/instrumentation/controller_instrumentation'
  class TestObject
    include NewRelic::Agent::Instrumentation::ControllerInstrumentation
  end

  def test_detect_upstream_wait_basic
    start_time = Time.now
    object = TestObject.new
    # should return the start time above by default
    object.expects(:newrelic_request_headers).returns({:request => 'headers'}).twice
    object.expects(:parse_frontend_headers).with({:request => 'headers'}).returns(start_time)
    assert_equal(start_time, object.send(:_detect_upstream_wait, start_time))
  end

  def test_detect_upstream_wait_with_upstream
    start_time = Time.now
    runs_at = start_time + 1
    object = TestObject.new
    object.expects(:newrelic_request_headers).returns(true).twice
    object.expects(:parse_frontend_headers).returns(start_time)
    assert_equal(start_time, object.send(:_detect_upstream_wait, runs_at))
  end

  def test_detect_upstream_wait_swallows_errors
    start_time = Time.now
    object = TestObject.new
    # should return the start time above when an error is raised
    object.expects(:newrelic_request_headers).returns({:request => 'headers'}).twice
    object.expects(:parse_frontend_headers).with({:request => 'headers'}).raises("an error")
    assert_equal(start_time, object.send(:_detect_upstream_wait, start_time))
  end
end

Version data entries

61 entries across 61 versions & 4 rubygems

Version Path
wd_newrelic_rpm-3.5.6 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.6.55 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.6.48.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.6.46.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.6.42.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.5.39.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
wd_newrelic_rpm-3.5.5 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.5.38 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.5.540.dev test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.4.35.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.4.34 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.4.33 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.4.31.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.4.29.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
ghazel-newrelic_rpm-3.5.4 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.3.25 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.3.24 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.2.17 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.1.14 test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
newrelic_rpm-3.5.1.14.beta test/new_relic/agent/instrumentation/controller_instrumentation_test.rb