Sha256: 602695af3646a66eac8e81dc312cc52fb6ce25a03c56d0489c97ad75fae6e861
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'ostruct' require 'test/unit' require 'moped' require File.expand_path(File.dirname(__FILE__) + '/../lib/newrelic_moped/instrumentation') class FakeOpWithCollection < Struct.new(:collection, :log_inspect) end class FakeOpWithoutCollection < Struct.new(:log_inspect) end class TestInstrumentation < Test::Unit::TestCase include NewRelic::Agent::Instrumentation::ControllerInstrumentation def setup DependencyDetection.detect! NewRelic::Agent.manual_start @engine = NewRelic::Agent.instance.stats_engine @engine.clear_stats @sampler = NewRelic::Agent.instance.transaction_sampler @sampler.enable @sampler.reset! @sampler.start_builder Moped::Node.class_eval do def process_without_newrelic_trace(operation, &callback) # do nothing end end @node = Moped::Node.new("127.0.0.1:27017") end def teardown @sampler.clear_builder end def test_handles_operations_with_collections fake_op = FakeOpWithCollection.new([], "Fake") assert_nothing_raised do @node.process_with_newrelic_trace(fake_op) end end def test_ignores_operations_without_collection fake_op = FakeOpWithoutCollection.new("Fake") assert_nothing_raised do @node.process_with_newrelic_trace(fake_op) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
newrelic_moped-0.0.3 | test/instrumentation_test.rb |