Sha256: 7e90e176df8c2fcb404ee3b3d42972dff8b79543d3f0213c2213465f24eb7673

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

# 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 File.expand_path(File.join(File.dirname(__FILE__),'..', '..','..','test_helper'))
require 'new_relic/agent/vm/mri_vm'

unless NewRelic::LanguageSupport.jruby?
  module NewRelic
    module Agent
      module VM
        class MriVMTest < Minitest::Test
          def setup
            @snap = Snapshot.new
            @vm = MriVM.new
          end

          def test_gather_gc_time_sets_gc_total_time_if_gc_profiler_is_enabled
            NewRelic::LanguageSupport.stubs(:gc_profiler_enabled?).returns(true)
            @vm.gather_gc_time(@snap)
            refute_nil @snap.gc_total_time
          end

          def test_gather_gc_time_does_not_set_gc_total_time_if_gc_profiler_is_disabled
            NewRelic::LanguageSupport.stubs(:gc_profiler_enabled?).returns(false)
            @vm.gather_gc_time(@snap)
            assert_nil @snap.gc_total_time
          end

          def test_gather_stats_records_gc_time_if_available
            NewRelic::Agent.instance.monotonic_gc_profiler.stubs(:total_time_s).returns(999)
            NewRelic::LanguageSupport.stubs(:gc_profiler_enabled?).returns(true)
            @vm.gather_stats(@snap)
            assert_equal(999, @snap.gc_total_time)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-4.1.0.333 test/new_relic/agent/vm/mri_vm_test.rb
newrelic_rpm-4.0.0.332 test/new_relic/agent/vm/mri_vm_test.rb