Sha256: 91caf4e0863e76ff42f38f88bd53d0a0c581ece0d9916ad1012f8987e84859ed

Contents?: true

Size: 796 Bytes

Versions: 6

Compression:

Stored size: 796 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 = default_service
        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

6 entries across 6 versions & 2 rubygems

Version Path
newrelic_rpm-3.5.7.59 test/test_contexts.rb
newrelic_rpm-3.5.7.59.beta test/test_contexts.rb
newrelic_rpm-3.5.7.58.beta test/test_contexts.rb
wd_newrelic_rpm-3.5.6 test/test_contexts.rb
newrelic_rpm-3.5.7.57.beta test/test_contexts.rb
newrelic_rpm-3.5.6.55 test/test_contexts.rb