Sha256: 6f009659a1751426e8cd02017ac3cc57cb5a71b07ceaecd8993c632d2aed1e6e

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

module TestContexts
  def with_running_agent

    context 'with running agent' do # this is needed for the nested setups

      setup do
        @log_data = StringIO.new
        @log = Logger.new(@log_data)
        NewRelic::Agent::Agent.instance.service = NewRelic::FakeService.new
        NewRelic::Agent.manual_start :log => @log
        @agent = NewRelic::Agent.instance
        @agent.metric_ids.clear
        @agent.transaction_sampler.send :clear_builder
        @agent.transaction_sampler.reset!
        @agent.stats_engine.clear_stats
      end

      yield

      def teardown
        super
        NewRelic::Agent.shutdown
        @log_data.reset
        NewRelic::Control.instance['dispatcher']=nil
        NewRelic::Control.instance['dispatcher_instance_id']=nil
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-3.5.6.48.beta test/test_contexts.rb
newrelic_rpm-3.5.6.46.beta test/test_contexts.rb
newrelic_rpm-3.5.6.42.beta test/test_contexts.rb