Sha256: cf51c7c768488343787432552ae2dc55174e656e74c3100c8fdedb9ebb441f55

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

#!/usr/bin/env ruby
# 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 'net/http'
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
require 'new_relic/agent/cross_app_tracing'

class NewRelic::Agent::Instrumentation::NetInstrumentationTest < Test::Unit::TestCase
  def setup
    NewRelic::Agent.manual_start(
      :"cross_application_tracer.enabled" => false,
      :"transaction_tracer.enabled"       => true,
      :cross_process_id                   => '269975#22824',
      :encoding_key                       => 'gringletoes'
    )

    @socket = fixture_tcp_socket( @response )

    @engine = NewRelic::Agent.instance.stats_engine
    @engine.clear_stats
  end

  def test_scope_stack_integrity_maintained_on_request_failure
    @socket.stubs(:write).raises('fake network error')
    with_config(:"cross_application_tracer.enabled" => true) do
      assert_nothing_raised do
        expected = @engine.push_scope('dummy')
        Net::HTTP.get(URI.parse('http://www.google.com/index.html')) rescue nil
        @engine.pop_scope(expected, 42)
      end
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
newrelic_rpm-3.7.1.188 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.7.1.182 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.7.1.180 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.7.0.177 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.7.0.174.beta test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.9.171 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.8.168 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.8.164 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.7.159 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.7.159.beta test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.7.152 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.6.147 test/new_relic/agent/instrumentation/net_instrumentation_test.rb
newrelic_rpm-3.6.5.130 test/new_relic/agent/instrumentation/net_instrumentation_test.rb