Sha256: ce05912fae517b9a1a5477d0fee779087fc9721381e1eef8221b218c0120833b

Contents?: true

Size: 1.51 KB

Versions: 10

Compression:

Stored size: 1.51 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__, "..", "..", "..", "..", "test_helper"))
require 'new_relic/agent/vm/rubinius_vm'

if NewRelic::LanguageSupport.rubinius?
  class NewRelic::Agent::VM::RubiniusVMTest < Minitest::Test
    def test_normal_usage
      with_stats({ :gc => {
        :full  => { :count => 1 },
        :young => { :count => 2 }
      }})

      has_major_minor(1, 2)
    end

    def test_missing_full
      with_stats({ :gc => {
        :young => { :count => 2 }
      }})

      has_major_minor(nil, 2)
    end

    def test_missing_full_count
      with_stats({ :gc => {
        :full  => { },
        :young => { :count => 2 }
      }})

      has_major_minor(nil, 2)
    end

    def test_missing_young
      with_stats({ :gc => {
        :full => { :count => 1 }
      }})

      has_major_minor(1, nil)
    end

    def test_missing_young_count
      with_stats({ :gc => {
        :full  => { :count => 1},
        :young => { }
      }})

      has_major_minor(1, nil)
    end

    def test_missing_gc
      with_stats({})
      has_major_minor(nil, nil)
    end

    def with_stats(stats)
      GC.stubs(:stat).returns(stats)
    end

    def has_major_minor(major, minor)
      snapshot = NewRelic::Agent::VM::RubiniusVM.new.snapshot
      assert_equal(major, snapshot.major_gc_count)
      assert_equal(minor, snapshot.minor_gc_count)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.9.275 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.8.273 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.7.266 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.6.257 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.5.251 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.4.245 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.3.241 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.2.239 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.1.236 test/new_relic/agent/vm/rubinius_vm_test.rb
newrelic_rpm-3.9.0.229 test/new_relic/agent/vm/rubinius_vm_test.rb