Sha256: 96b3e46d78ecf497d951f9f2c56c77ac079e5ea155bc1e741e4361f45d09bdca

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 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/transaction_sample/composite_segment'
class NewRelic::TransactionSample::CompositeSegmentTest < Minitest::Test
  def test_composite_segment_creation
    fake_segment = mock_segment
    NewRelic::TransactionSample::CompositeSegment.new([fake_segment])
  end

  def test_detail_segments_equals
    fake_segment = mock_segment
    cs = NewRelic::TransactionSample::CompositeSegment.new([fake_segment])

    # note that this is a bare mock
    # nothing should be called on it, for now
    other_fake_segment = mock('other segment')
    cs.detail_segments = [other_fake_segment]

    assert_equal cs.detail_segments, [other_fake_segment]
  end

  private

  @@seg_count = 0
  def mock_segment
    @@seg_count += 1
    segment = mock('segment ' + @@seg_count.to_s)
    segment.expects(:entry_timestamp).returns(Time.now)
    # note the following 'twice' - different than SummarySegment
    segment.expects(:exit_timestamp).returns(Time.now).twice
    segment.expects(:metric_name).returns('Custom/test/metric')
    segment.expects(:called_segments).returns([])
    segment
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
newrelic_rpm-3.11.2.286 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.11.1.284 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.11.0.283 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.10.0.279 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.9.275 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.8.273 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.7.266 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.6.257 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.5.251 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.4.245 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.3.241 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.2.239 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.1.236 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.9.0.229 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.8.1.221 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.8.0.218 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.7.3.204 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.7.3.199 test/new_relic/transaction_sample/composite_segment_test.rb