newrelic_rpm 3.6.2.96 → 3.6.3.103.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG +33 -1
  3. data/README.md +7 -7
  4. data/lib/new_relic/agent/agent.rb +51 -22
  5. data/lib/new_relic/agent/agent_logger.rb +22 -11
  6. data/lib/new_relic/agent/configuration/defaults.rb +6 -1
  7. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -6
  8. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
  9. data/lib/new_relic/agent/instrumentation/active_record.rb +8 -48
  10. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +9 -1
  11. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -3
  12. data/lib/new_relic/agent/instrumentation/data_mapper.rb +4 -4
  13. data/lib/new_relic/agent/instrumentation/metric_frame.rb +10 -8
  14. data/lib/new_relic/agent/instrumentation/padrino.rb +32 -0
  15. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +52 -0
  16. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +56 -0
  17. data/lib/new_relic/agent/instrumentation/sinatra.rb +113 -48
  18. data/lib/new_relic/agent/new_relic_service.rb +6 -0
  19. data/lib/new_relic/agent/pipe_channel_manager.rb +13 -8
  20. data/lib/new_relic/agent/request_sampler.rb +205 -0
  21. data/lib/new_relic/agent/sampler.rb +0 -1
  22. data/lib/new_relic/agent/stats_engine/samplers.rb +0 -1
  23. data/lib/new_relic/agent/stats_engine/transactions.rb +12 -16
  24. data/lib/new_relic/agent/transaction.rb +27 -4
  25. data/lib/new_relic/agent/transaction_sample_builder.rb +47 -6
  26. data/lib/new_relic/agent/transaction_sampler.rb +0 -5
  27. data/lib/new_relic/agent.rb +17 -0
  28. data/lib/new_relic/build.rb +2 -2
  29. data/lib/new_relic/coerce.rb +3 -1
  30. data/lib/new_relic/rack/agent_hooks.rb +17 -3
  31. data/lib/new_relic/rack/browser_monitoring.rb +8 -3
  32. data/lib/new_relic/rack/error_collector.rb +2 -0
  33. data/lib/new_relic/transaction_sample/segment.rb +0 -23
  34. data/lib/new_relic/transaction_sample.rb +0 -9
  35. data/lib/new_relic/version.rb +1 -1
  36. data/test/agent_helper.rb +204 -0
  37. data/test/config/newrelic.yml +0 -1
  38. data/test/config/test_control.rb +3 -1
  39. data/test/multiverse/suites/agent_only/key_transactions_test.rb +8 -5
  40. data/test/multiverse/suites/agent_only/logging_test.rb +1 -1
  41. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +7 -8
  42. data/test/multiverse/suites/datamapper/Envfile +7 -0
  43. data/test/multiverse/suites/datamapper/datamapper_test.rb +105 -0
  44. data/test/multiverse/suites/padrino/Envfile +16 -0
  45. data/test/multiverse/suites/padrino/config/newrelic.yml +24 -0
  46. data/test/multiverse/suites/padrino/padrino_test.rb +54 -0
  47. data/test/multiverse/suites/rails/Envfile +5 -5
  48. data/test/multiverse/suites/rails/app.rb +1 -0
  49. data/test/multiverse/suites/rails/request_statistics_test.rb +118 -0
  50. data/test/multiverse/suites/sinatra/Envfile +8 -2
  51. data/test/multiverse/suites/sinatra/ignoring_test.rb +185 -0
  52. data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +92 -0
  53. data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +0 -3
  54. data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +89 -0
  55. data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +120 -0
  56. data/test/new_relic/agent/agent_logger_test.rb +149 -56
  57. data/test/new_relic/agent/agent_test.rb +23 -0
  58. data/test/new_relic/agent/agent_test_controller_test.rb +8 -1
  59. data/test/new_relic/agent/autostart_test.rb +10 -6
  60. data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +36 -31
  61. data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +7 -0
  62. data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +20 -4
  63. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +20 -9
  64. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +23 -19
  65. data/test/new_relic/agent/instrumentation/sequel_test.rb +118 -79
  66. data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +55 -0
  67. data/test/new_relic/agent/instrumentation/sinatra_test.rb +60 -11
  68. data/test/new_relic/agent/method_tracer_test.rb +7 -4
  69. data/test/new_relic/agent/new_relic_service_test.rb +6 -0
  70. data/test/new_relic/agent/pipe_channel_manager_test.rb +6 -2
  71. data/test/new_relic/agent/request_sampler_test.rb +159 -0
  72. data/test/new_relic/agent/stats_engine/samplers_test.rb +1 -5
  73. data/test/new_relic/agent/stats_engine_test.rb +14 -0
  74. data/test/new_relic/agent/transaction_sample_builder_test.rb +43 -6
  75. data/test/new_relic/agent/transaction_sampler_test.rb +31 -1
  76. data/test/new_relic/agent/transaction_test.rb +29 -0
  77. data/test/new_relic/agent_test.rb +7 -0
  78. data/test/new_relic/coerce_test.rb +13 -0
  79. data/test/new_relic/fake_collector.rb +31 -1
  80. data/test/new_relic/metric_spec_test.rb +14 -10
  81. data/test/new_relic/rack/agent_hooks_test.rb +9 -2
  82. data/test/new_relic/rack/browser_monitoring_test.rb +16 -7
  83. data/test/new_relic/rack/developer_mode_test.rb +7 -0
  84. data/test/new_relic/rack/error_collector_test.rb +10 -6
  85. data/test/new_relic/transaction_sample/segment_test.rb +0 -61
  86. data/test/new_relic/transaction_sample_subtest_test.rb +0 -19
  87. data/test/script/ci.sh +14 -0
  88. data/test/test_helper.rb +79 -203
  89. data.tar.gz.sig +0 -0
  90. metadata +50 -18
  91. metadata.gz.sig +0 -0
  92. data/test/multiverse/suites/datamapper/encoding_test.rb +0 -40
  93. data/test/multiverse/suites/sinatra/sinatra_test.rb +0 -143
@@ -465,7 +465,6 @@ class NewRelic::Agent::TransactionSamplerTest < Test::Unit::TestCase
465
465
  with_config(:'transaction_tracer.limit_segments' => 2000) do
466
466
  sample = mock('sample')
467
467
  @sampler.expects(:add_samples_to).with([sample]).returns([sample])
468
- sample.expects(:truncate).with(2000)
469
468
  assert_equal([sample], @sampler.harvest([sample]))
470
469
  end
471
470
  end
@@ -935,6 +934,26 @@ class NewRelic::Agent::TransactionSamplerTest < Test::Unit::TestCase
935
934
  assert_equal '97612F92E6194080', @sampler.builder.current_segment[:transaction_guid]
936
935
  end
937
936
 
937
+ def test_large_transaction_trace_harvest
938
+ config = {
939
+ :'transaction_tracer.enabled' => true,
940
+ :'transaction_tracer.transaction_threshold' => 0,
941
+ :'transaction_tracer.limit_segments' => 100
942
+ }
943
+ with_config(config) do
944
+ run_long_sample_trace(110)
945
+
946
+ samples = nil
947
+ assert_nothing_raised do
948
+ samples = @sampler.harvest
949
+ end
950
+ assert_equal(1, samples.size)
951
+
952
+ # Verify that the TT stopped recording after 100 nodes
953
+ assert_equal(100, samples.first.count_segments)
954
+ end
955
+ end
956
+
938
957
  class Dummy
939
958
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
940
959
  def run(n)
@@ -959,6 +978,17 @@ class NewRelic::Agent::TransactionSamplerTest < Test::Unit::TestCase
959
978
 
960
979
  private
961
980
 
981
+ def run_long_sample_trace(n)
982
+ @sampler.notice_transaction(nil, {})
983
+ @sampler.notice_first_scope_push(Time.now.to_f)
984
+ n.times do |i|
985
+ @sampler.notice_push_scope
986
+ yield if block_given?
987
+ @sampler.notice_pop_scope "node#{i}"
988
+ end
989
+ @sampler.notice_scope_empty(@txn, Time.now.to_f)
990
+ end
991
+
962
992
  def run_sample_trace(start = Time.now.to_f, stop = nil)
963
993
  @sampler.notice_transaction(nil, {})
964
994
  @sampler.notice_first_scope_push start
@@ -186,4 +186,33 @@ class NewRelic::Agent::TransactionTest < Test::Unit::TestCase
186
186
  NewRelic::Agent.instance.instance_variable_set(:@transaction_rules,
187
187
  NewRelic::Agent::RulesEngine.new)
188
188
  end
189
+
190
+ def test_end_fires_a_transaction_finished_event
191
+ name, duration = nil
192
+ NewRelic::Agent.subscribe(:transaction_finished) do |*args|
193
+ name = args.shift
194
+ duration = args.shift
195
+ end
196
+
197
+ NewRelic::Agent::Transaction.start(:controller)
198
+ NewRelic::Agent.set_transaction_name('foo/1/bar/22')
199
+ NewRelic::Agent::Transaction.freeze_name
200
+ NewRelic::Agent::Transaction.stop('txn')
201
+
202
+ assert_equal 'Controller/foo/1/bar/22', name
203
+ assert_kind_of Float, duration
204
+ end
205
+
206
+ def test_end_fires_a_transaction_finished_event_with_overview_metrics
207
+ options = nil
208
+ NewRelic::Agent.subscribe(:transaction_finished) do |_, _, opts|
209
+ options = opts
210
+ end
211
+
212
+ NewRelic::Agent::Transaction.start(:controller)
213
+ NewRelic::Agent.record_metric("HttpDispatcher", 2.1)
214
+ NewRelic::Agent::Transaction.stop('txn')
215
+
216
+ assert_equal 2.1, options[:web_duration]
217
+ end
189
218
  end
@@ -380,6 +380,13 @@ module NewRelic
380
380
  end
381
381
  end
382
382
 
383
+ def test_eventing_helpers
384
+ called = false
385
+ NewRelic::Agent.subscribe(:boo) { called = true }
386
+ NewRelic::Agent.notify(:boo)
387
+ assert called
388
+ end
389
+
383
390
  private
384
391
 
385
392
  def mocked_agent
@@ -47,6 +47,19 @@ class CoerceTest < Test::Unit::TestCase
47
47
  float("not valid", "HERE")
48
48
  end
49
49
 
50
+ def test_float_coerce_with_infinite_value_logs_and_returns_0_0
51
+ expects_logging(:warn, all_of(includes("TestingInfinity"), includes("Float"), includes("'Infinity'")), anything)
52
+ infinity = 1337807.0/0.0
53
+ result = float(infinity, "TestingInfinity")
54
+ assert_equal 0.0, result
55
+ end
56
+
57
+ def test_float_coerce_with_nan_value_logs_and_returns_0_0
58
+ expects_logging(:warn, all_of(includes("TestingNaN"), includes("Float"), includes("'NaN'")), anything)
59
+ nan = 0.0/0.0
60
+ result = float(nan, "TestingNaN")
61
+ assert_equal 0.0, result
62
+ end
50
63
 
51
64
  def test_string_coerce
52
65
  assert_equal "1", string(1)
@@ -25,7 +25,8 @@ module NewRelic
25
25
  'sql_trace_data' => [200, {'return_value' => nil}],
26
26
  'transaction_sample_data' => [200, {'return_value' => nil}],
27
27
  'error_data' => [200, {'return_value' => nil}],
28
- 'shutdown' => [200, {'return_value' => nil}]
28
+ 'shutdown' => [200, {'return_value' => nil}],
29
+ 'analytic_event_data' => [200, {'return_value' => nil}]
29
30
  }
30
31
  reset
31
32
  end
@@ -195,6 +196,8 @@ module NewRelic
195
196
  SqlTraceDataPost.new(opts)
196
197
  when 'transaction_sample_data'
197
198
  TransactionSampleDataPost.new(opts)
199
+ when 'analytic_event_data'
200
+ AnalyticEventDataPost.new(opts)
198
201
  else
199
202
  new(opts)
200
203
  end
@@ -244,6 +247,15 @@ module NewRelic
244
247
  @body[1][0][2]
245
248
  end
246
249
  end
250
+ class AnalyticEventDataPost < AgentPost
251
+
252
+ def initialize(opts={})
253
+ opts[:run_id] = opts[:body].shift
254
+ opts[:body] = opts[:body].shift
255
+
256
+ super
257
+ end
258
+ end
247
259
  end
248
260
 
249
261
  # might we need this? I'll just leave it here for now
@@ -346,6 +358,24 @@ if $0 == __FILE__
346
358
  assert_equal ['error'], post.body
347
359
  end
348
360
 
361
+ def test_analytic_event_data
362
+ events = [
363
+ {
364
+ 'type' => 'Transaction',
365
+ 'name' => 'Controller/foo/bar',
366
+ 'duration' => '718',
367
+ 'timestamp' => 1368489547.888435
368
+ }
369
+ ]
370
+ response = invoke('analytic_event_data', [33, events])
371
+
372
+ assert_nil response['return_value']
373
+ post = @collector.agent_data[0]
374
+ assert_equal 'analytic_event_data', post.action
375
+ assert_equal events, post.body
376
+ assert_equal 33, post.run_id.to_i
377
+ end
378
+
349
379
  def test_shutdown
350
380
  response = invoke('shutdown?run_id=1')
351
381
 
@@ -43,24 +43,28 @@ class NewRelic::MetricSpecTest < Test::Unit::TestCase
43
43
  end
44
44
 
45
45
  # test to make sure the MetricSpec class can serialize to json
46
- def test_json
47
- spec = NewRelic::MetricSpec.new("controller", "metric#find")
46
+ if defined?(::ActiveSupport)
47
+ def test_json
48
+ spec = NewRelic::MetricSpec.new("controller", "metric#find")
48
49
 
49
- import = ::ActiveSupport::JSON.decode(spec.to_json)
50
+ import = ::ActiveSupport::JSON.decode(spec.to_json)
50
51
 
51
- compare_spec(spec, import)
52
+ compare_spec(spec, import)
52
53
 
53
- stats = NewRelic::Agent::Stats.new
54
+ stats = NewRelic::Agent::Stats.new
54
55
 
55
- import = ::ActiveSupport::JSON.decode(stats.to_json)
56
+ import = ::ActiveSupport::JSON.decode(stats.to_json)
56
57
 
57
- compare_stat(stats, import)
58
+ compare_stat(stats, import)
58
59
 
59
- metric_data = NewRelic::MetricData.new(spec, stats, 10)
60
+ metric_data = NewRelic::MetricData.new(spec, stats, 10)
60
61
 
61
- import = ::ActiveSupport::JSON.decode(metric_data.to_json)
62
+ import = ::ActiveSupport::JSON.decode(metric_data.to_json)
62
63
 
63
- compare_metric_data(metric_data, import)
64
+ compare_metric_data(metric_data, import)
65
+ end
66
+ else
67
+ puts "Skipping tests in #{__FILE__} because ActiveSupport is unavailable"
64
68
  end
65
69
 
66
70
  def test_truncate!
@@ -11,12 +11,11 @@ class AgentHooksTest < Test::Unit::TestCase
11
11
  @app = stub_everything
12
12
  @hooks = NewRelic::Rack::AgentHooks.new(@app)
13
13
  @env = {:env => "env"}
14
-
15
- NewRelic::Agent.instance.events.stubs(:notify)
16
14
  end
17
15
 
18
16
  def test_before_call
19
17
  NewRelic::Agent.instance.events.expects(:notify).with(:before_call, @env)
18
+ NewRelic::Agent.instance.events.stubs(:notify).with(:after_call, anything, anything)
20
19
 
21
20
  @hooks.call(@env)
22
21
  end
@@ -25,10 +24,18 @@ class AgentHooksTest < Test::Unit::TestCase
25
24
  result = stub
26
25
  @app.stubs(:call).returns(result)
27
26
 
27
+ NewRelic::Agent.instance.events.stubs(:notify).with(:before_call, anything)
28
28
  NewRelic::Agent.instance.events.expects(:notify).with(:after_call, @env, result)
29
29
 
30
30
  @hooks.call(@env)
31
31
  end
32
32
 
33
+ def test_nested_agent_hooks_still_fire_only_once
34
+ nested = NewRelic::Rack::AgentHooks.new(@hooks)
35
+
36
+ NewRelic::Agent.instance.events.expects(:notify).times(2)
37
+ nested.call(@env)
38
+ end
39
+
33
40
  end
34
41
 
@@ -14,7 +14,7 @@ ENV['RACK_ENV'] = 'test'
14
14
  # benefit from auto-rum, but the truth of the matter is that atm
15
15
  # we only support Rails >= 2.3
16
16
  def middleware_supported?
17
- ::Rails::VERSION::STRING >= '2.3'
17
+ defined?(::Rails) && ::Rails::VERSION::STRING >= '2.3'
18
18
  end
19
19
 
20
20
  if middleware_supported?
@@ -83,13 +83,17 @@ EOL
83
83
  end
84
84
 
85
85
  def test_should_only_instrument_successfull_html_requests
86
- assert app.should_instrument?(200, {'Content-Type' => 'text/html'})
87
- assert !app.should_instrument?(500, {'Content-Type' => 'text/html'})
88
- assert !app.should_instrument?(200, {'Content-Type' => 'text/xhtml'})
86
+ assert app.should_instrument?({}, 200, {'Content-Type' => 'text/html'})
87
+ assert !app.should_instrument?({}, 500, {'Content-Type' => 'text/html'})
88
+ assert !app.should_instrument?({}, 200, {'Content-Type' => 'text/xhtml'})
89
89
  end
90
90
 
91
91
  def test_should_not_instrument_when_content_disposition
92
- assert !app.should_instrument?(200, {'Content-Type' => 'text/html', 'Content-Disposition' => 'attachment; filename=test.html'})
92
+ assert !app.should_instrument?({}, 200, {'Content-Type' => 'text/html', 'Content-Disposition' => 'attachment; filename=test.html'})
93
+ end
94
+
95
+ def test_should_not_instrument_when_already_did
96
+ assert !app.should_instrument?({NewRelic::Rack::BrowserMonitoring::ALREADY_INSTRUMENTED_KEY => true}, 200, {'Content-Type' => 'text/html'})
93
97
  end
94
98
 
95
99
  def test_insert_timing_header_right_after_open_head_if_no_meta_tags
@@ -100,6 +104,12 @@ EOL
100
104
  TestApp.doc = nil
101
105
  end
102
106
 
107
+ def test_insert_header_should_mark_environment
108
+ get '/'
109
+ assert last_request.env.key?(NewRelic::Rack::BrowserMonitoring::ALREADY_INSTRUMENTED_KEY)
110
+ TestApp.doc = nil
111
+ end
112
+
103
113
  def test_insert_timing_header_right_before_head_close_if_ua_compatible_found
104
114
  TestApp.doc = <<-EOL
105
115
  <html>
@@ -152,6 +162,5 @@ EOL
152
162
  end
153
163
  end
154
164
  else
155
- warn "Skipping rum auto instrumentation tests"
165
+ puts "Skipping tests in #{__FILE__} because Rails is unavailable (or too old)"
156
166
  end
157
-
@@ -3,6 +3,9 @@
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
5
  # ENV['SKIP_RAILS'] = 'true'
6
+
7
+ if defined?(::Rails)
8
+
6
9
  require File.expand_path(File.join(File.dirname(__FILE__),'..', '..',
7
10
  'test_helper'))
8
11
  require 'rack/test'
@@ -82,3 +85,7 @@ class DeveloperModeTest < Test::Unit::TestCase
82
85
  }]
83
86
  end
84
87
  end
88
+
89
+ else
90
+ puts "Skipping tests in #{__FILE__} because Rails is unavailable"
91
+ end
@@ -62,13 +62,17 @@ module NewRelic::Rack
62
62
  'noticed an error that should have been ignored')
63
63
  end
64
64
 
65
- def test_ignore_errors_from_ignored_actions
66
- assert_raise RuntimeError do
67
- get '/ignored'
68
- end
65
+ if defined?(::Rails)
66
+ def test_ignore_errors_from_ignored_actions
67
+ assert_raise RuntimeError do
68
+ get '/ignored'
69
+ end
69
70
 
70
- assert(NewRelic::Agent.instance.error_collector.errors.empty?,
71
- 'noticed an error that should have been ignored')
71
+ assert(NewRelic::Agent.instance.error_collector.errors.empty?,
72
+ 'noticed an error that should have been ignored')
73
+ end
74
+ else
75
+ puts "Skipping tests in #{__FILE__} because Rails is unavailable"
72
76
  end
73
77
 
74
78
  def test_handles_parameter_parsing_exceptions
@@ -220,67 +220,6 @@ class NewRelic::TransactionSample::SegmentTest < Test::Unit::TestCase
220
220
  s.add_called_segment(fake_segment)
221
221
 
222
222
  assert_equal(2, s.count_segments)
223
- end
224
-
225
- def test_truncate_returns_number_of_elements
226
- s = NewRelic::TransactionSample::Segment.new(Time.now, 'Custom/test/metric', nil)
227
- assert_equal(1, s.truncate(1))
228
- dup = s.dup
229
- s.called_segments = [dup]
230
- assert_equal(2, s.truncate(2))
231
-
232
- s.called_segments = [dup, dup]
233
- assert_equal(3, s.truncate(3))
234
- end
235
-
236
-
237
- def test_truncate_default
238
- s = NewRelic::TransactionSample::Segment.new(Time.now, 'Custom/test/metric', nil)
239
-
240
- assert_equal(1, s.truncate(1))
241
- end
242
-
243
- def test_truncate_with_a_child
244
- s = NewRelic::TransactionSample::Segment.new(Time.now, 'Custom/test/metric', nil)
245
-
246
- fake_segment = mock('segment')
247
- fake_segment.expects(:parent_segment=).with(s)
248
- fake_segment.expects(:truncate).with(1).returns(1)
249
-
250
- s.add_called_segment(fake_segment)
251
-
252
- assert_equal(2, s.truncate(2))
253
- assert_equal([fake_segment], s.called_segments)
254
-
255
- assert_equal(1, s.truncate(1))
256
- assert_equal([], s.called_segments)
257
- end
258
-
259
- def test_truncate_with_multiple_children
260
- s = NewRelic::TransactionSample::Segment.new(Time.now, 'Custom/test/metric', nil)
261
-
262
- fake_segment = mock('segment')
263
- fake_segment.expects(:truncate).with(2).returns(1)
264
-
265
- other_segment = mock('other segment')
266
- other_segment.expects(:truncate).with(1).returns(1)
267
-
268
- s.called_segments = [fake_segment, other_segment]
269
- assert_equal(3, s.truncate(3))
270
- assert_equal([fake_segment, other_segment], s.called_segments)
271
- end
272
-
273
- def test_truncate_removes_elements
274
- s = NewRelic::TransactionSample::Segment.new(Time.now, 'Custom/test/metric', nil)
275
-
276
- fake_segment = mock('segment')
277
- fake_segment.expects(:truncate).with(1).returns(1)
278
-
279
- other_segment = mock('other segment')
280
-
281
- s.called_segments = [fake_segment, other_segment]
282
- assert_equal(2, s.truncate(2))
283
- assert_equal([fake_segment], s.called_segments)
284
223
  end
285
224
 
286
225
  def test_key_equals
@@ -38,23 +38,4 @@ class NewRelic::TransactionSample::SubTest < Test::Unit::TestCase
38
38
  def test_count_the_segments
39
39
  assert_equal 4, @t.count_segments
40
40
  end
41
-
42
- def test_truncate_long_samples
43
- @t.truncate(2)
44
- assert_equal 2, @t.count_segments
45
-
46
- @t = NewRelic::TransactionSample.new
47
-
48
- s1 = @t.create_segment(1.0, "controller")
49
- @t.root_segment.add_called_segment(s1)
50
-
51
- 100.times do
52
- s1.add_called_segment(@t.create_segment(1.0, "segment"))
53
- end
54
- assert_equal 101, @t.count_segments
55
- @t.truncate(2)
56
- assert_equal 2, @t.count_segments
57
- assert_equal 101, @t.params[:segment_count]
58
- end
59
-
60
41
  end
data/test/script/ci.sh CHANGED
@@ -78,6 +78,20 @@ mkdir -p tmp
78
78
  cd tmp
79
79
 
80
80
 
81
+ if [ "x$BRANCH" == "xnorails" ]; then
82
+ if [ "x$RUBY_VERSION" == "x1.8.6" ]; then
83
+ # Bundler 1.1 dropped support for ruby 1.8.6
84
+ bundle -h > /dev/null || gem install bundler -v'~>1.0.0' --no-rdoc --no-ri
85
+ else
86
+ bundle -h > /dev/null || gem install bundler --no-rdoc --no-ri
87
+ fi
88
+
89
+ bundle -v
90
+ bundle --local || bundle
91
+ NO_RAILS=true bundle exec rake --trace test || bundle exec rake --trace test
92
+ exit
93
+ fi
94
+
81
95
  #rpm_test_app_cache=~/.rpm_test_app_cache
82
96
  rpm_test_app_cache=~/workspace/.rpm_test_app_cache
83
97
  (