Sha256: 6927520c7823c3384db04a942367c7708b51c4112f8b8d2074ddea3f758ed338

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 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 < Minitest::Test
  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 )

    NewRelic::Agent.instance.stats_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
      expected = NewRelic::Agent::TracedMethodStack.push_frame('dummy')
      Net::HTTP.get(URI.parse('http://www.google.com/index.html')) rescue nil
      NewRelic::Agent::TracedMethodStack.pop_frame(expected, 42)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newrelic_rpm-3.8.1.221 test/new_relic/agent/instrumentation/net_instrumentation_test.rb