newrelic_rpm 3.7.1.188 → 3.7.2.190.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data.tar.gz.sig +3 -2
  2. data/CHANGELOG +1 -1
  3. data/Guardfile +3 -3
  4. data/README.md +1 -1
  5. data/Rakefile +0 -2
  6. data/init.rb +2 -5
  7. data/lib/new_relic/agent.rb +3 -0
  8. data/lib/new_relic/agent/agent.rb +2 -0
  9. data/lib/new_relic/agent/configuration/default_source.rb +32 -14
  10. data/lib/new_relic/agent/configuration/environment_source.rb +1 -0
  11. data/lib/new_relic/agent/cross_app_monitor.rb +2 -2
  12. data/lib/new_relic/agent/cross_app_tracing.rb +2 -2
  13. data/lib/new_relic/agent/error_collector.rb +1 -1
  14. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +4 -1
  15. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +10 -8
  16. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +11 -6
  17. data/lib/new_relic/agent/javascript_instrumentor.rb +27 -36
  18. data/lib/new_relic/agent/method_tracer.rb +20 -2
  19. data/lib/new_relic/agent/new_relic_service.rb +35 -27
  20. data/lib/new_relic/agent/request_sampler.rb +20 -13
  21. data/lib/new_relic/agent/sampler_collection.rb +4 -0
  22. data/lib/new_relic/agent/stats_engine/stats_hash.rb +4 -4
  23. data/lib/new_relic/agent/system_info.rb +25 -15
  24. data/lib/new_relic/agent/transaction.rb +23 -4
  25. data/lib/new_relic/agent/transaction_sampler.rb +1 -1
  26. data/lib/new_relic/cli/install.rb +1 -1
  27. data/lib/new_relic/control.rb +1 -0
  28. data/lib/new_relic/helper.rb +1 -29
  29. data/lib/new_relic/json_wrapper.rb +92 -0
  30. data/lib/new_relic/language_support.rb +4 -0
  31. data/lib/new_relic/rack/agent_hooks.rb +4 -0
  32. data/lib/new_relic/rack/browser_monitoring.rb +4 -0
  33. data/lib/new_relic/rack/developer_mode.rb +4 -1
  34. data/lib/new_relic/rack/error_collector.rb +5 -0
  35. data/lib/new_relic/rack/transaction_reset.rb +20 -0
  36. data/lib/new_relic/version.rb +1 -1
  37. data/lib/tasks/install.rake +0 -1
  38. data/newrelic_rpm.gemspec +1 -1
  39. data/test/agent_helper.rb +7 -8
  40. data/test/environments/norails/Gemfile +2 -1
  41. data/test/environments/rails21/Gemfile +2 -2
  42. data/test/environments/rails21/config/environment.rb +1 -3
  43. data/test/environments/rails21/config/environments/development.rb +0 -6
  44. data/test/environments/rails22/Gemfile +2 -2
  45. data/test/environments/rails22/config/environment.rb +0 -2
  46. data/test/environments/rails22/config/environments/development.rb +0 -6
  47. data/test/environments/rails23/Gemfile +2 -3
  48. data/test/environments/rails23/config/environment.rb +0 -9
  49. data/test/environments/rails23/config/environments/development.rb +0 -5
  50. data/test/environments/rails30/Gemfile +2 -2
  51. data/test/environments/rails31/Gemfile +2 -2
  52. data/test/environments/rails32/Gemfile +2 -1
  53. data/test/environments/rails40/Gemfile +2 -1
  54. data/test/intentional_fail.rb +1 -2
  55. data/test/multiverse/lib/multiverse/envfile.rb +1 -5
  56. data/test/multiverse/lib/multiverse/suite.rb +10 -27
  57. data/test/multiverse/suites/active_record/ar_method_aliasing.rb +49 -67
  58. data/test/multiverse/suites/agent_only/encoding_handling_test.rb +128 -0
  59. data/test/multiverse/suites/agent_only/marshaling_test.rb +7 -9
  60. data/test/multiverse/suites/agent_only/script/loading.rb +20 -0
  61. data/test/multiverse/suites/agent_only/start_up_test.rb +7 -0
  62. data/test/multiverse/suites/bare/Envfile +3 -0
  63. data/test/multiverse/suites/bare/standalone_instrumentation_test.rb +43 -0
  64. data/test/multiverse/suites/rails/Envfile +0 -2
  65. data/test/multiverse/suites/rails/app/views/views/_a_partial.html.erb +1 -0
  66. data/test/multiverse/suites/rails/app/views/views/index.html.erb +1 -1
  67. data/test/multiverse/suites/rails/error_tracing_test.rb +1 -1
  68. data/test/multiverse/suites/rails/request_statistics_test.rb +9 -4
  69. data/test/multiverse/suites/rails/view_instrumentation_test.rb +111 -106
  70. data/test/multiverse/suites/typhoeus/Envfile +1 -1
  71. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +16 -2
  72. data/test/multiverse/test/multiverse_test.rb +2 -2
  73. data/test/new_relic/agent/agent/connect_test.rb +1 -1
  74. data/test/new_relic/agent/agent/start_test.rb +1 -1
  75. data/test/new_relic/agent/agent/start_worker_thread_test.rb +1 -1
  76. data/test/new_relic/agent/agent_logger_test.rb +3 -7
  77. data/test/new_relic/agent/agent_test.rb +33 -57
  78. data/test/new_relic/agent/apdex_from_server_test.rb +1 -1
  79. data/test/new_relic/agent/audit_logger_test.rb +5 -8
  80. data/test/new_relic/agent/autostart_test.rb +1 -1
  81. data/test/new_relic/agent/browser_token_test.rb +1 -1
  82. data/test/new_relic/agent/busy_calculator_test.rb +2 -4
  83. data/test/new_relic/agent/commands/agent_command_router_test.rb +5 -5
  84. data/test/new_relic/agent/commands/agent_command_test.rb +1 -1
  85. data/test/new_relic/agent/commands/thread_profiler_session_test.rb +6 -6
  86. data/test/new_relic/agent/commands/xray_session_collection_test.rb +10 -10
  87. data/test/new_relic/agent/commands/xray_session_test.rb +1 -1
  88. data/test/new_relic/agent/configuration/default_source_test.rb +4 -4
  89. data/test/new_relic/agent/configuration/environment_source_test.rb +14 -2
  90. data/test/new_relic/agent/configuration/manager_test.rb +3 -3
  91. data/test/new_relic/agent/configuration/orphan_configuration_test.rb +1 -1
  92. data/test/new_relic/agent/configuration/server_source_test.rb +1 -1
  93. data/test/new_relic/agent/configuration/yaml_source_test.rb +2 -2
  94. data/test/new_relic/agent/cpu_sampler_test.rb +1 -1
  95. data/test/new_relic/agent/cross_app_monitor_test.rb +3 -3
  96. data/test/new_relic/agent/cross_app_tracing_test.rb +5 -4
  97. data/test/new_relic/agent/database_test.rb +1 -1
  98. data/test/new_relic/agent/datastores/mongo/metric_generator_test.rb +1 -1
  99. data/test/new_relic/agent/datastores/mongo/metric_translator_test.rb +1 -1
  100. data/test/new_relic/agent/datastores/mongo/obfuscator_test.rb +1 -1
  101. data/test/new_relic/agent/datastores/mongo/statement_formatter_test.rb +2 -2
  102. data/test/new_relic/agent/error_collector/notice_error_test.rb +1 -1
  103. data/test/new_relic/agent/error_collector_test.rb +5 -3
  104. data/test/new_relic/agent/event_listener_test.rb +1 -1
  105. data/test/new_relic/agent/harvester_test.rb +1 -1
  106. data/test/new_relic/agent/http_clients/uri_util_test.rb +1 -1
  107. data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +1 -1
  108. data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +1 -1
  109. data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +1 -1
  110. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +495 -495
  111. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +2 -2
  112. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +1 -1
  113. data/test/new_relic/agent/instrumentation/instrumentation_test.rb +1 -1
  114. data/test/new_relic/agent/instrumentation/metric_frame_test.rb +1 -1
  115. data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +4 -6
  116. data/test/new_relic/agent/instrumentation/queue_time_test.rb +1 -1
  117. data/test/new_relic/agent/instrumentation/rack_test.rb +1 -1
  118. data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +1 -1
  119. data/test/new_relic/agent/instrumentation/sinatra_test.rb +1 -1
  120. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +7 -7
  121. data/test/new_relic/agent/javascript_instrumentor_test.rb +47 -55
  122. data/test/new_relic/agent/memcache_instrumentation_test.rb +1 -1
  123. data/test/new_relic/agent/memory_logger_test.rb +1 -1
  124. data/test/new_relic/agent/method_interrobang_test.rb +2 -3
  125. data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +4 -4
  126. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +1 -1
  127. data/test/new_relic/agent/method_tracer_test.rb +6 -7
  128. data/test/new_relic/agent/method_visibility_test.rb +1 -1
  129. data/test/new_relic/agent/new_relic_service_test.rb +129 -19
  130. data/test/new_relic/agent/obfuscator_test.rb +1 -1
  131. data/test/new_relic/agent/pipe_channel_manager_test.rb +143 -145
  132. data/test/new_relic/agent/pipe_service_test.rb +2 -4
  133. data/test/new_relic/agent/request_sampler_test.rb +23 -19
  134. data/test/new_relic/agent/rpm_agent_test.rb +3 -3
  135. data/test/new_relic/agent/rules_engine_test.rb +1 -1
  136. data/test/new_relic/agent/sampled_buffer_test.rb +1 -1
  137. data/test/new_relic/agent/sampler_collection_test.rb +3 -3
  138. data/test/new_relic/agent/sampler_test.rb +1 -1
  139. data/test/new_relic/agent/shim_agent_test.rb +1 -1
  140. data/test/new_relic/agent/sql_sampler_test.rb +4 -6
  141. data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -1
  142. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +5 -5
  143. data/test/new_relic/agent/stats_engine/samplers_test.rb +2 -2
  144. data/test/new_relic/agent/stats_engine_test.rb +3 -3
  145. data/test/new_relic/agent/stats_hash_test.rb +2 -2
  146. data/test/new_relic/agent/stats_test.rb +1 -1
  147. data/test/new_relic/agent/threading/agent_thread_test.rb +2 -4
  148. data/test/new_relic/agent/threading/backtrace_node_test.rb +1 -1
  149. data/test/new_relic/agent/threading/backtrace_service_test.rb +5 -5
  150. data/test/new_relic/agent/threading/thread_profile_test.rb +1 -1
  151. data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +1 -1
  152. data/test/new_relic/agent/transaction/force_persist_sample_buffer_test.rb +1 -1
  153. data/test/new_relic/agent/transaction/pop_test.rb +1 -1
  154. data/test/new_relic/agent/transaction/slowest_sample_buffer_test.rb +1 -1
  155. data/test/new_relic/agent/transaction/xray_sample_buffer_test.rb +1 -1
  156. data/test/new_relic/agent/transaction_interrobang_test.rb +2 -3
  157. data/test/new_relic/agent/transaction_sample_builder_test.rb +16 -14
  158. data/test/new_relic/agent/transaction_sampler_test.rb +16 -21
  159. data/test/new_relic/agent/transaction_state_test.rb +1 -1
  160. data/test/new_relic/agent/transaction_test.rb +61 -1
  161. data/test/new_relic/agent/transaction_timings_test.rb +1 -1
  162. data/test/new_relic/agent/worker_loop_test.rb +1 -1
  163. data/test/new_relic/agent_test.rb +2 -3
  164. data/test/new_relic/cli/deployments_test.rb +3 -3
  165. data/test/new_relic/coerce_test.rb +1 -1
  166. data/test/new_relic/collection_helper_test.rb +1 -1
  167. data/test/new_relic/control/class_methods_test.rb +2 -2
  168. data/test/new_relic/control/frameworks/rails_test.rb +1 -1
  169. data/test/new_relic/control_test.rb +9 -4
  170. data/test/new_relic/dependency_detection_test.rb +1 -1
  171. data/test/new_relic/dispatcher_test.rb +1 -1
  172. data/test/new_relic/environment_report_test.rb +4 -6
  173. data/test/new_relic/fake_collector.rb +1 -158
  174. data/test/new_relic/framework_test.rb +2 -1
  175. data/test/new_relic/http_client_test_cases.rb +2 -3
  176. data/test/new_relic/json_wrapper_test.rb +77 -0
  177. data/test/new_relic/language_support_test.rb +1 -1
  178. data/test/new_relic/license_test.rb +2 -2
  179. data/test/new_relic/load_test.rb +2 -8
  180. data/test/new_relic/local_environment_test.rb +1 -1
  181. data/test/new_relic/metric_data_test.rb +1 -1
  182. data/test/new_relic/metric_parser/metric_parser_test.rb +1 -1
  183. data/test/new_relic/metric_spec_test.rb +1 -1
  184. data/test/new_relic/multiverse_helpers.rb +26 -30
  185. data/test/new_relic/noticed_error_test.rb +1 -1
  186. data/test/new_relic/rack/agent_hooks_test.rb +1 -1
  187. data/test/new_relic/rack/all_test.rb +1 -1
  188. data/test/new_relic/rack/browser_monitoring_test.rb +4 -2
  189. data/test/new_relic/rack/deferred_instrumentation_test.rb +3 -5
  190. data/test/new_relic/rack/developer_mode_helper_test.rb +1 -1
  191. data/test/new_relic/rack/developer_mode_test.rb +1 -1
  192. data/test/new_relic/rack/error_collector_test.rb +8 -8
  193. data/test/new_relic/rack/transaction_reset_test.rb +35 -0
  194. data/test/new_relic/transaction_analysis/segment_summary_test.rb +2 -2
  195. data/test/new_relic/transaction_analysis_test.rb +1 -1
  196. data/test/new_relic/transaction_sample/composite_segment_test.rb +1 -1
  197. data/test/new_relic/transaction_sample/fake_segment_test.rb +2 -4
  198. data/test/new_relic/transaction_sample/segment_test.rb +3 -7
  199. data/test/new_relic/transaction_sample/summary_segment_test.rb +1 -1
  200. data/test/new_relic/transaction_sample_subtest_test.rb +1 -1
  201. data/test/new_relic/transaction_sample_test.rb +4 -6
  202. data/test/new_relic/version_number_test.rb +1 -1
  203. data/test/performance/lib/performance/instrumentation/gc_stats.rb +1 -1
  204. data/test/performance/lib/performance/json_reporter.rb +1 -1
  205. data/test/performance/suites/marshalling.rb +76 -0
  206. data/test/test_helper.rb +6 -39
  207. metadata +19 -12
  208. metadata.gz.sig +0 -0
  209. data/test/new_relic/helper_test.rb +0 -32
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper'))
6
6
 
7
- class PipeServiceTest < Test::Unit::TestCase
7
+ class PipeServiceTest < MiniTest::Unit::TestCase
8
8
  def setup
9
9
  NewRelic::Agent::PipeChannelManager.listener.stop
10
10
  NewRelic::Agent::PipeChannelManager.register_report_channel(:pipe_service_test)
@@ -33,9 +33,7 @@ class PipeServiceTest < Test::Unit::TestCase
33
33
  ::NewRelic::Agent.logger.expects(:error) \
34
34
  .with(regexp_matches(/No communication channel to parent process/)).once
35
35
  service = NewRelic::Agent::PipeService.new(:non_existant)
36
- assert_nothing_raised do
37
- service.metric_data({})
38
- end
36
+ service.metric_data({})
39
37
  end
40
38
 
41
39
  if NewRelic::LanguageSupport.can_fork? &&
@@ -7,7 +7,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper
7
7
  require File.expand_path(File.join(File.dirname(__FILE__),'..','data_container_tests'))
8
8
  require 'new_relic/agent/request_sampler'
9
9
 
10
- class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
10
+ class NewRelic::Agent::RequestSamplerTest < MiniTest::Unit::TestCase
11
11
 
12
12
  def setup
13
13
  freeze_time
@@ -38,12 +38,15 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
38
38
  end
39
39
  end
40
40
 
41
+ EVENT_DATA_INDEX = 0
42
+ CUSTOM_ATTRIBUTES_INDEX = 1
43
+
41
44
  def test_custom_parameters_in_event_are_normalized_to_string_keys
42
45
  with_sampler_config do
43
46
  generate_request('whatever', :custom_params => {:bing => 2, 1 => 3})
44
- txn_event = @sampler.samples.first
45
- assert_equal 2, txn_event['bing']
46
- assert_equal 3, txn_event['1']
47
+ custom_attrs = single_sample[CUSTOM_ATTRIBUTES_INDEX]
48
+ assert_equal 2, custom_attrs['bing']
49
+ assert_equal 3, custom_attrs['1']
47
50
  end
48
51
  end
49
52
 
@@ -51,16 +54,16 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
51
54
  def test_includes_custom_parameters_in_event
52
55
  with_sampler_config do
53
56
  generate_request('whatever', :custom_params => {'bing' => 2})
54
- txn_event = @sampler.samples.first
55
- assert_equal 2, txn_event['bing']
57
+ custom_attrs = single_sample[CUSTOM_ATTRIBUTES_INDEX]
58
+ assert_equal 2, custom_attrs['bing']
56
59
  end
57
60
  end
58
61
 
59
62
  def test_doesnt_include_custom_parameters_in_event_when_configured_not_to
60
- with_sampler_config('capture_attributes.transaction_events' => false) do
63
+ with_sampler_config('analytics_events.capture_attributes' => false) do
61
64
  generate_request('whatever', :custom_params => {'bing' => 2})
62
- txn_event = @sampler.samples.first
63
- assert_equal nil, txn_event['bing']
65
+ custom_attrs = single_sample[CUSTOM_ATTRIBUTES_INDEX]
66
+ assert_equal nil, custom_attrs['bing']
64
67
  end
65
68
  end
66
69
 
@@ -70,17 +73,22 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
70
73
  :overview_metrics => {'webDuration' => 0.01},
71
74
  :custom_params => {'type' => 'giraffe', 'duration' => 'hippo', 'webDuration' => 'zebra'}
72
75
  )
73
- txn_event = @sampler.samples.first
76
+ txn_event = single_sample[EVENT_DATA_INDEX]
74
77
  assert_equal 'Transaction', txn_event['type']
75
78
  assert_equal 0.1, txn_event['duration']
76
79
  assert_equal 0.01, txn_event['webDuration']
80
+
81
+ custom_attrs = single_sample[CUSTOM_ATTRIBUTES_INDEX]
82
+ assert_equal 'giraffe', custom_attrs['type']
83
+ assert_equal 'hippo', custom_attrs['duration']
84
+ assert_equal 'zebra', custom_attrs['webDuration']
77
85
  end
78
86
  end
79
87
 
80
88
  def test_samples_on_transaction_finished_event_includes_overview_metrics
81
89
  with_sampler_config do
82
90
  generate_request('name', :overview_metrics => {:foo => :bar})
83
- assert_equal :bar, @sampler.samples.first[:foo]
91
+ assert_equal :bar, single_sample[EVENT_DATA_INDEX][:foo]
84
92
  end
85
93
  end
86
94
 
@@ -186,11 +194,7 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
186
194
  end
187
195
 
188
196
  def with_sampler_config(options = {})
189
- defaults =
190
- {
191
- :'analytics_events.max_samples_stored' => 100
192
- }
193
-
197
+ defaults = { :'analytics_events.max_samples_stored' => 100 }
194
198
  defaults.merge!(options)
195
199
  with_config(defaults) do
196
200
  @event_listener.notify( :finished_configuring )
@@ -198,9 +202,9 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
198
202
  end
199
203
  end
200
204
 
201
- def assert_is_valid_transaction_sample( sample )
202
- assert_kind_of Hash, sample
203
- assert_equal 'Transaction', sample['type']
205
+ def single_sample
206
+ assert_equal 1, @sampler.samples.size
207
+ @sampler.samples.first
204
208
  end
205
209
 
206
210
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path('../../../test_helper', __FILE__)
6
6
 
7
- class NewRelic::Agent::RpmAgentTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::RpmAgentTest < MiniTest::Unit::TestCase
8
8
  def setup
9
9
  NewRelic::Agent.manual_start
10
10
  @agent = NewRelic::Agent.instance
@@ -17,13 +17,13 @@ class NewRelic::Agent::RpmAgentTest < Test::Unit::TestCase
17
17
 
18
18
  def test_agent_setup
19
19
  assert(NewRelic::Agent.instance.class == NewRelic::Agent::Agent)
20
- assert_raise(RuntimeError) do
20
+ assert_raises(RuntimeError) do
21
21
  NewRelic::Control.instance.init_plugin(:agent_enabled => false)
22
22
  end
23
23
  end
24
24
 
25
25
  def test_public_apis
26
- assert_raise(RuntimeError) do
26
+ assert_raises(RuntimeError) do
27
27
  NewRelic::Agent.set_sql_obfuscator(:unknown) { |sql| puts sql }
28
28
  end
29
29
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
6
6
 
7
- class RulesEngineTest < Test::Unit::TestCase
7
+ class RulesEngineTest < MiniTest::Unit::TestCase
8
8
  def setup
9
9
  @engine = NewRelic::Agent::RulesEngine.new
10
10
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
6
6
 
7
- class NewRelic::Agent::SampledBufferTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::SampledBufferTest < MiniTest::Unit::TestCase
8
8
  def test_should_keep_all_samples_up_to_capacity
9
9
  buffer = NewRelic::Agent::SampledBuffer.new(100)
10
10
  all = []
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
6
6
 
7
- class SamplerCollectionTest < Test::Unit::TestCase
7
+ class SamplerCollectionTest < MiniTest::Unit::TestCase
8
8
 
9
9
  class DummySampler
10
10
  attr_reader :id
@@ -45,7 +45,7 @@ class SamplerCollectionTest < Test::Unit::TestCase
45
45
 
46
46
  def test_add_sampler_swallows_exceptions_during_sampler_creation
47
47
  DummySampler.stubs(:new).raises(StandardError)
48
- assert_nothing_raised { @collection.add_sampler(DummySampler) }
48
+ @collection.add_sampler(DummySampler)
49
49
  assert_equal(0, @collection.to_a.size)
50
50
  end
51
51
 
@@ -61,7 +61,7 @@ class SamplerCollectionTest < Test::Unit::TestCase
61
61
  @collection.add_sampler(DummySampler2)
62
62
  good_sampler, bad_sampler = @collection.to_a
63
63
  bad_sampler.stubs(:poll).raises('boo')
64
- assert_nothing_raised { @collection.poll_samplers }
64
+ @collection.poll_samplers
65
65
  assert_equal(1, @collection.to_a.size)
66
66
  assert_equal([good_sampler], @collection.to_a)
67
67
  end
@@ -3,7 +3,7 @@
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper'))
6
- class NewRelic::Agent::SamplerTest < Test::Unit::TestCase
6
+ class NewRelic::Agent::SamplerTest < MiniTest::Unit::TestCase
7
7
  require 'new_relic/agent/sampler'
8
8
 
9
9
  def test_inherited_should_append_subclasses_to_sampler_classes
@@ -5,7 +5,7 @@
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
6
6
  module NewRelic
7
7
  module Agent
8
- class ShimAgentTest < Test::Unit::TestCase
8
+ class ShimAgentTest < MiniTest::Unit::TestCase
9
9
 
10
10
  def setup
11
11
  super
@@ -5,7 +5,7 @@
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
6
6
  require File.expand_path(File.join(File.dirname(__FILE__),'..','data_container_tests'))
7
7
 
8
- class NewRelic::Agent::SqlSamplerTest < Test::Unit::TestCase
8
+ class NewRelic::Agent::SqlSamplerTest < MiniTest::Unit::TestCase
9
9
  def setup
10
10
  agent = NewRelic::Agent.instance
11
11
  stats_engine = NewRelic::Agent::StatsEngine.new
@@ -36,7 +36,7 @@ class NewRelic::Agent::SqlSamplerTest < Test::Unit::TestCase
36
36
  def test_notice_first_scope_push
37
37
  assert_nil @sampler.transaction_data
38
38
  @sampler.notice_first_scope_push nil
39
- assert_not_nil @sampler.transaction_data
39
+ refute_nil @sampler.transaction_data
40
40
  @sampler.notice_scope_empty('txn')
41
41
  assert_nil @sampler.transaction_data
42
42
  end
@@ -52,7 +52,7 @@ class NewRelic::Agent::SqlSamplerTest < Test::Unit::TestCase
52
52
  @sampler.notice_sql "select * from test2", "Database/test2/select", nil, 1.3
53
53
  # this sql will not be captured
54
54
  @sampler.notice_sql "select * from test", "Database/test/select", nil, 0
55
- assert_not_nil @sampler.transaction_data
55
+ refute_nil @sampler.transaction_data
56
56
  assert_equal 2, @sampler.transaction_data.sql_data.size
57
57
  end
58
58
 
@@ -235,9 +235,7 @@ class NewRelic::Agent::SqlSamplerTest < Test::Unit::TestCase
235
235
  @sampler.harvest_slow_sql(data)
236
236
  sql_traces = @sampler.harvest!
237
237
 
238
- assert_nothing_raised do
239
- Marshal.dump(sql_traces)
240
- end
238
+ Marshal.dump(sql_traces)
241
239
  end
242
240
  end
243
241
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
6
6
 
7
- class NewRelic::Agent::StatsEngine::GCProfilerTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::StatsEngine::GCProfilerTest < MiniTest::Unit::TestCase
8
8
  def test_init_profiler_for_rails_bench
9
9
  return unless defined?(::GC) && ::GC.respond_to?(:collections)
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
6
6
 
7
- class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::MetricStatsTest < MiniTest::Unit::TestCase
8
8
  def setup
9
9
  NewRelic::Agent.manual_start
10
10
  @engine = NewRelic::Agent.instance.stats_engine
@@ -23,12 +23,12 @@ class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
23
23
  s2 = @engine.get_stats "a"
24
24
  s3 = @engine.get_stats "b"
25
25
 
26
- assert_not_nil s1
27
- assert_not_nil s2
28
- assert_not_nil s3
26
+ refute_nil s1
27
+ refute_nil s2
28
+ refute_nil s3
29
29
 
30
30
  assert s1 == s2
31
- assert_not_same(s1, s3)
31
+ refute_same(s1, s3)
32
32
  end
33
33
 
34
34
  def test_harvest
@@ -5,7 +5,7 @@
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..', '..','..','test_helper'))
6
6
  require 'new_relic/agent/samplers/cpu_sampler'
7
7
 
8
- class NewRelic::Agent::StatsEngine::SamplersTest < Test::Unit::TestCase
8
+ class NewRelic::Agent::StatsEngine::SamplersTest < MiniTest::Unit::TestCase
9
9
 
10
10
  class OurSamplers
11
11
  include NewRelic::Agent::StatsEngine::Samplers
@@ -85,7 +85,7 @@ class NewRelic::Agent::StatsEngine::SamplersTest < Test::Unit::TestCase
85
85
  def test_memory__windows
86
86
  return if defined? JRuby
87
87
  NewRelic::Agent::Samplers::MemorySampler.any_instance.stubs(:platform).returns 'win32'
88
- assert_raise NewRelic::Agent::Sampler::Unsupported do
88
+ assert_raises NewRelic::Agent::Sampler::Unsupported do
89
89
  NewRelic::Agent::Samplers::MemorySampler.new
90
90
  end
91
91
  end
@@ -5,7 +5,7 @@
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..', 'test_helper'))
6
6
  require File.expand_path(File.join(File.dirname(__FILE__),'..','data_container_tests'))
7
7
 
8
- class NewRelic::Agent::StatsEngineTest < Test::Unit::TestCase
8
+ class NewRelic::Agent::StatsEngineTest < MiniTest::Unit::TestCase
9
9
  def setup
10
10
  NewRelic::Agent.manual_start
11
11
  @engine = NewRelic::Agent::StatsEngine.new
@@ -69,8 +69,8 @@ class NewRelic::Agent::StatsEngineTest < Test::Unit::TestCase
69
69
 
70
70
  disney = @engine.lookup_stats("disney")
71
71
 
72
- assert_not_same orlando_disney, anaheim_disney
73
- assert_not_equal orlando_disney, anaheim_disney
72
+ refute_same orlando_disney, anaheim_disney
73
+ refute_equal orlando_disney, anaheim_disney
74
74
  assert_equal 1, orlando_disney.call_count
75
75
  assert_equal 1, anaheim_disney.call_count
76
76
  assert_equal 2, disney.call_count
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..', '..','test_helper'))
6
6
 
7
- class NewRelic::Agent::StatsHashTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::StatsHashTest < MiniTest::Unit::TestCase
8
8
  def setup
9
9
  @hash = NewRelic::Agent::StatsHash.new
10
10
  NewRelic::Agent.instance.error_collector.errors.clear
@@ -141,7 +141,7 @@ class NewRelic::Agent::StatsHashTest < Test::Unit::TestCase
141
141
 
142
142
  @hash.record(DEFAULT_SPEC, 1)
143
143
 
144
- assert_has_error NewRelic::Agent::StatsHash::CorruptedDefaultProcError
144
+ assert_has_error NewRelic::Agent::StatsHash::StatsHashLookupError
145
145
  end
146
146
 
147
147
  # We can only fix up the default proc on Rubies that let us set it
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..', '..', 'test_helper'))
6
6
 
7
- class NewRelic::Agent::StatsTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::StatsTest < MiniTest::Unit::TestCase
8
8
  def mock_plusequals(first, second, method, first_value, second_value)
9
9
  first.expects(method).returns(first_value)
10
10
  second.expects(method).returns(second_value)
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_h
6
6
  require 'new_relic/agent/threading/agent_thread'
7
7
 
8
8
  module NewRelic::Agent::Threading
9
- class AgentThreadTest < Test::Unit::TestCase
9
+ class AgentThreadTest < MiniTest::Unit::TestCase
10
10
 
11
11
  def test_sets_label
12
12
  t = AgentThread.new("labelled") {}
@@ -92,9 +92,7 @@ module NewRelic::Agent::Threading
92
92
  def test_scrub_backtrace_handles_errors_during_backtrace
93
93
  dummy_thread = stub
94
94
  dummy_thread.stubs(:backtrace).raises(StandardError.new('nah'))
95
- assert_nothing_raised do
96
- AgentThread.scrub_backtrace(dummy_thread, true)
97
- end
95
+ AgentThread.scrub_backtrace(dummy_thread, true)
98
96
  end
99
97
 
100
98
  def test_scrub_backtrace_handles_nil_backtrace
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_h
6
6
  require 'new_relic/agent/threading/backtrace_node'
7
7
 
8
8
  module NewRelic::Agent::Threading
9
- class BacktraceNodeTest < Test::Unit::TestCase
9
+ class BacktraceNodeTest < MiniTest::Unit::TestCase
10
10
  SINGLE_LINE = "irb.rb:69:in `catch'"
11
11
 
12
12
  def setup
@@ -10,7 +10,7 @@ require 'new_relic/agent/threading/threaded_test_case'
10
10
  if NewRelic::Agent::Threading::BacktraceService.is_supported?
11
11
 
12
12
  module NewRelic::Agent::Threading
13
- class BacktraceServiceTest < Test::Unit::TestCase
13
+ class BacktraceServiceTest < MiniTest::Unit::TestCase
14
14
  include ThreadedTestCase
15
15
 
16
16
  def setup
@@ -87,7 +87,7 @@ if NewRelic::Agent::Threading::BacktraceService.is_supported?
87
87
 
88
88
  assert(profile1)
89
89
  assert(profile2)
90
- assert_not_same(profile1, profile2)
90
+ refute_same(profile1, profile2)
91
91
  end
92
92
 
93
93
  def test_harvest_passes_on_original_args_to_new_thread_profiles
@@ -461,7 +461,7 @@ if NewRelic::Agent::Threading::BacktraceService.is_supported?
461
461
  end
462
462
 
463
463
  def assert_has_default_period
464
- assert_equal 0.1, @service.worker_loop.period
464
+ assert_in_delta(0.1, @service.worker_loop.period, 0.001)
465
465
  end
466
466
 
467
467
  def fake_last_poll_took(last_poll_length)
@@ -504,7 +504,7 @@ if NewRelic::Agent::Threading::BacktraceService.is_supported?
504
504
 
505
505
  # These tests do not use ThreadedTestCase as FakeThread is synchronous and
506
506
  # prevents the detection of concurrency issues.
507
- class BacktraceServiceConcurrencyTest < Test::Unit::TestCase
507
+ class BacktraceServiceConcurrencyTest < MiniTest::Unit::TestCase
508
508
  def setup
509
509
  NewRelic::Agent.instance.stats_engine.clear_stats
510
510
  @service = BacktraceService.new
@@ -535,7 +535,7 @@ if NewRelic::Agent::Threading::BacktraceService.is_supported?
535
535
  end
536
536
  else
537
537
  module NewRelic::Agent::Threading
538
- class BacktraceServiceUnsupportedTest < Test::Unit::TestCase
538
+ class BacktraceServiceUnsupportedTest < MiniTest::Unit::TestCase
539
539
  def test_is_not_supported?
540
540
  assert_false BacktraceService.is_supported?
541
541
  end
@@ -11,7 +11,7 @@ require 'new_relic/agent/threading/threaded_test_case'
11
11
  if NewRelic::Agent::Threading::BacktraceService.is_supported?
12
12
 
13
13
  module NewRelic::Agent::Threading
14
- class ThreadProfileTest < Test::Unit::TestCase
14
+ class ThreadProfileTest < MiniTest::Unit::TestCase
15
15
  include ThreadedTestCase
16
16
 
17
17
  def setup
@@ -5,7 +5,7 @@
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
6
6
 
7
7
  class NewRelic::Agent::Transaction
8
- class DeveloperModeSampleBufferTest < Test::Unit::TestCase
8
+ class DeveloperModeSampleBufferTest < MiniTest::Unit::TestCase
9
9
  def setup
10
10
  @buffer = DeveloperModeSampleBuffer.new
11
11
  end