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
@@ -10,7 +10,7 @@ suite_condition("Typhoeus not supported in 1.8.6 and excluded on 1.8.7 non-REE")
10
10
  end
11
11
 
12
12
  gemfile <<-RB
13
- gem 'typhoeus', '~> 0.6.3'
13
+ gem 'typhoeus', '~> 0.6.5'
14
14
  gem 'rack'
15
15
  gem 'json', :platforms => [:rbx, :mri_18]
16
16
  RB
@@ -13,10 +13,16 @@ if NewRelic::Agent::Instrumentation::TyphoeusTracing.is_supported_version?
13
13
  class TyphoeusTest < MiniTest::Unit::TestCase
14
14
  include HttpClientTestCases
15
15
 
16
- USE_SSL_VERIFYPEER_VERSION = NewRelic::VersionNumber.new("0.5.0")
16
+ USE_SSL_VERIFYPEER_VERSION = NewRelic::VersionNumber.new("0.5.0")
17
+
18
+ # Starting in version 0.6.4, Typhoeus supports passing URI instances instead
19
+ # of String URLs. Make sure we don't break that.
20
+ SUPPORTS_URI_OBJECT_VERSION = NewRelic::VersionNumber.new("0.6.4")
21
+
22
+ CURRENT_TYPHOEUS_VERSION = NewRelic::VersionNumber.new(Typhoeus::VERSION)
17
23
 
18
24
  def ssl_option
19
- if NewRelic::VersionNumber.new(Typhoeus::VERSION) >= USE_SSL_VERIFYPEER_VERSION
25
+ if CURRENT_TYPHOEUS_VERSION >= USE_SSL_VERIFYPEER_VERSION
20
26
  { :ssl_verifypeer => false }
21
27
  else
22
28
  { :disable_ssl_peer_verification => true }
@@ -73,6 +79,14 @@ if NewRelic::Agent::Instrumentation::TyphoeusTracing.is_supported_version?
73
79
  assert_equal "External/Multiple/Typhoeus::Hydra/run", last_segment.metric_name
74
80
  end
75
81
  end
82
+
83
+ if CURRENT_TYPHOEUS_VERSION >= SUPPORTS_URI_OBJECT_VERSION
84
+ def test_get_with_uri
85
+ res = get_response(default_uri)
86
+ assert_match %r/<head>/i, body(res)
87
+ assert_externals_recorded_for("localhost", "GET")
88
+ end
89
+ end
76
90
  end
77
91
 
78
92
  else
@@ -47,13 +47,13 @@ class MultiverseTest < Test::Unit::TestCase
47
47
 
48
48
  def test_failed_tests_mean_unsuccessful_exit_code_in_parent_with_fork_execute_mode
49
49
  run = run_suite('two')
50
- assert_not_equal 0, run.exit_status, "Failed test should mean unsucessful " <<
50
+ refute_equal 0, run.exit_status, "Failed test should mean unsucessful " <<
51
51
  "exit status in parent \n" # + run.output
52
52
  end
53
53
 
54
54
  def test_failed_tests_mean_unsucessful_exit_code_in_parent_with_spawn_execute_mode
55
55
  run = run_suite('three')
56
- assert_not_equal 0, run.exit_status, "Failed test in spawn mode should mean unsucessful " <<
56
+ refute_equal 0, run.exit_status, "Failed test in spawn mode should mean unsucessful " <<
57
57
  "exit status in parent \n" # + run.output
58
58
  end
59
59
  end
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..', '..', '..','test
6
6
  require 'new_relic/agent/agent'
7
7
  require 'ostruct'
8
8
 
9
- class NewRelic::Agent::Agent::ConnectTest < Test::Unit::TestCase
9
+ class NewRelic::Agent::Agent::ConnectTest < MiniTest::Unit::TestCase
10
10
  include NewRelic::Agent::Agent::Connect
11
11
  include TransactionSampleTestHelper
12
12
 
@@ -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::Agent::StartTest < Test::Unit::TestCase
6
+ class NewRelic::Agent::Agent::StartTest < MiniTest::Unit::TestCase
7
7
  require 'new_relic/agent/agent'
8
8
  include NewRelic::Agent::Agent::Start
9
9
 
@@ -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::Agent::StartWorkerThreadTest < Test::Unit::TestCase
6
+ class NewRelic::Agent::Agent::StartWorkerThreadTest < MiniTest::Unit::TestCase
7
7
  require 'new_relic/agent/agent'
8
8
  include NewRelic::Agent::Agent::StartWorkerThread
9
9
 
@@ -20,7 +20,7 @@ class ArrayLogDevice
20
20
  end
21
21
 
22
22
 
23
- class AgentLoggerTest < Test::Unit::TestCase
23
+ class AgentLoggerTest < MiniTest::Unit::TestCase
24
24
 
25
25
  LEVELS = [:fatal, :error, :warn, :info, :debug]
26
26
 
@@ -91,9 +91,7 @@ class AgentLoggerTest < Test::Unit::TestCase
91
91
  def test_wont_log_if_agent_not_enabled
92
92
  with_config(:agent_enabled => false) do
93
93
  logger = NewRelic::Agent::AgentLogger.new
94
- assert_nothing_raised do
95
- logger.warn('hi there')
96
- end
94
+ logger.warn('hi there')
97
95
 
98
96
  assert_kind_of NewRelic::Agent::NullLogger, logger.instance_variable_get( :@log )
99
97
  end
@@ -250,9 +248,7 @@ class AgentLoggerTest < Test::Unit::TestCase
250
248
 
251
249
  logger = NewRelic::Agent::AgentLogger.new
252
250
  with_config(:agent_enabled => false) do
253
- assert_nothing_raised do
254
- logger.debug('hi!')
255
- end
251
+ logger.debug('hi!')
256
252
  end
257
253
  ensure
258
254
  Kernel.module_eval do
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper
6
6
 
7
7
  module NewRelic
8
8
  module Agent
9
- class AgentTest < Test::Unit::TestCase
9
+ class AgentTest < MiniTest::Unit::TestCase
10
10
  include NewRelic::TestHelpers::Exceptions
11
11
 
12
12
  def setup
@@ -115,9 +115,7 @@ module NewRelic
115
115
  @agent.service.stubs(:transaction_sample_data).raises("wat")
116
116
  @agent.transaction_sampler.expects(:merge!).with(traces)
117
117
 
118
- assert_nothing_raised do
119
- @agent.send :harvest_and_send_transaction_traces
120
- end
118
+ @agent.send :harvest_and_send_transaction_traces
121
119
  end
122
120
 
123
121
  def test_harvest_and_send_errors_merges_back_on_failure
@@ -127,9 +125,7 @@ module NewRelic
127
125
  @agent.service.stubs(:error_data).raises('wat')
128
126
  @agent.error_collector.expects(:merge!).with(errors)
129
127
 
130
- assert_nothing_raised do
131
- @agent.send :harvest_and_send_errors
132
- end
128
+ @agent.send :harvest_and_send_errors
133
129
  end
134
130
 
135
131
  # This test asserts nothing about correctness of logging data from multiple
@@ -142,20 +138,18 @@ module NewRelic
142
138
  nthreads = 10
143
139
  nmetrics = 100
144
140
 
145
- assert_nothing_raised do
146
- nthreads.times do |tid|
147
- t = Thread.new do
148
- nmetrics.times do |mid|
149
- @agent.stats_engine.get_stats("m#{mid}").record_data_point(1)
150
- end
141
+ nthreads.times do |tid|
142
+ t = Thread.new do
143
+ nmetrics.times do |mid|
144
+ @agent.stats_engine.get_stats("m#{mid}").record_data_point(1)
151
145
  end
152
- t.abort_on_exception = true
153
- threads << t
154
146
  end
155
-
156
- 100.times { @agent.send(:harvest_and_send_timeslice_data) }
157
- threads.each { |t| t.join }
147
+ t.abort_on_exception = true
148
+ threads << t
158
149
  end
150
+
151
+ 100.times { @agent.send(:harvest_and_send_timeslice_data) }
152
+ threads.each { |t| t.join }
159
153
  end
160
154
 
161
155
  def test_handle_for_agent_commands
@@ -165,9 +159,7 @@ module NewRelic
165
159
 
166
160
  def test_check_for_and_handle_agent_commands_with_error
167
161
  @agent.service.expects(:get_agent_commands).raises('bad news')
168
- assert_nothing_raised do
169
- @agent.send :check_for_and_handle_agent_commands
170
- end
162
+ @agent.send :check_for_and_handle_agent_commands
171
163
  end
172
164
 
173
165
  def test_harvest_and_send_for_agent_commands
@@ -226,9 +218,7 @@ module NewRelic
226
218
  @agent.service.stubs(:metric_data).raises('wat')
227
219
  @agent.stats_engine.expects(:merge!).with(timeslices)
228
220
 
229
- assert_nothing_raised do
230
- @agent.send(:harvest_and_send_timeslice_data)
231
- end
221
+ @agent.send(:harvest_and_send_timeslice_data)
232
222
  end
233
223
 
234
224
  def test_connect_retries_on_timeout
@@ -365,32 +355,7 @@ module NewRelic
365
355
  @agent.send(:harvest_from_container, container, 'digglewumpus')
366
356
  end
367
357
 
368
- def send_data_from_container
369
- service = @agent.service
370
- items = [1, 2, 3]
371
- service.expects(:dummy_endpoint).with(items)
372
- @agent.send(:send_data_from_container, stub, 'dummy_endpoint', items)
373
- end
374
-
375
- def send_data_from_container_with_unrecoverable_server_error
376
- service = @agent.service
377
- container = mock('data container')
378
- container.expects(:merge!).never
379
- items = [1, 2, 3]
380
- service.expects(:dummy_endpoint).raises(UnrecoverableServerException)
381
- @agent.send(:send_data_from_container, container, 'dummy_endpoint', items)
382
- end
383
-
384
- def send_data_from_container_with_other_error
385
- service = @agent.service
386
- items = [1, 2, 3]
387
- container = mock('data container')
388
- container.expects(:merge!).with(items)
389
- service.expects(:dummy_endpoint).raises('other errors')
390
- @agent.send(:send_data_from_container, container, 'dummy_endpoint', items)
391
- end
392
-
393
- def harvest_and_send_from_container
358
+ def test_harvest_and_send_from_container
394
359
  container = mock('data container')
395
360
  items = [1, 2, 3]
396
361
  container.expects(:harvest!).returns(items)
@@ -399,7 +364,7 @@ module NewRelic
399
364
  @agent.send(:harvest_and_send_from_container, container, 'dummy_endpoint')
400
365
  end
401
366
 
402
- def harvest_and_send_from_container_does_not_harvest_if_nothing_to_send
367
+ def test_harvest_and_send_from_container_does_not_harvest_if_nothing_to_send
403
368
  container = mock('data container')
404
369
  items = []
405
370
  container.expects(:harvest!).returns(items)
@@ -408,7 +373,7 @@ module NewRelic
408
373
  @agent.send(:harvest_and_send_from_container, container, 'dummy_endpoint')
409
374
  end
410
375
 
411
- def harvest_and_send_from_container_resets_on_harvest_failure
376
+ def test_harvest_and_send_from_container_resets_on_harvest_failure
412
377
  container = mock('data container')
413
378
  container.stubs(:harvest!).raises('an error')
414
379
  container.expects(:reset!)
@@ -416,7 +381,15 @@ module NewRelic
416
381
  @agent.send(:harvest_and_send_from_container, container, 'dummy_endpoint')
417
382
  end
418
383
 
419
- def harvest_and_send_from_container_does_not_merge_on_unrecoverable_failure
384
+ def test_harvest_and_send_from_container_does_not_merge_on_serialization_failure
385
+ container = mock('data container')
386
+ container.stubs(:harvest!).returns([1,2,3])
387
+ @agent.service.stubs(:dummy_endpoint).raises(SerializationError)
388
+ container.expects(:merge!).never
389
+ @agent.send(:harvest_and_send_from_container, container, 'dummy_endpoint')
390
+ end
391
+
392
+ def test_harvest_and_send_from_container_does_not_merge_on_unrecoverable_failure
420
393
  container = mock('data container')
421
394
  container.stubs(:harvest!).returns([1,2,3])
422
395
  @agent.service.expects(:dummy_endpoint).with([1,2,3]).raises(UnrecoverableServerException)
@@ -424,7 +397,7 @@ module NewRelic
424
397
  @agent.send(:harvest_and_send_from_container, container, 'dummy_endpoint')
425
398
  end
426
399
 
427
- def harvest_and_send_from_container_merges_on_other_failure
400
+ def test_harvest_and_send_from_container_merges_on_other_failure
428
401
  container = mock('data container')
429
402
  container.stubs(:harvest!).returns([1,2,3])
430
403
  @agent.service.expects(:dummy_endpoint).with([1,2,3]).raises('other error')
@@ -443,7 +416,7 @@ module NewRelic
443
416
 
444
417
  error_classes.each do |cls|
445
418
  @agent.service.expects(:dummy_endpoint).with([1]).raises(cls.new)
446
- assert_raise(cls) do
419
+ assert_raises(cls) do
447
420
  @agent.send(:harvest_and_send_from_container, container, 'dummy_endpoint')
448
421
  end
449
422
  end
@@ -457,7 +430,7 @@ module NewRelic
457
430
 
458
431
  error_classes.each do |cls|
459
432
  @agent.service.expects(:get_agent_commands).raises(cls.new)
460
- assert_raise(cls) do
433
+ assert_raises(cls) do
461
434
  @agent.send(:check_for_and_handle_agent_commands)
462
435
  end
463
436
  end
@@ -523,6 +496,9 @@ module NewRelic
523
496
  end
524
497
 
525
498
  def test_revert_to_default_configuration_removes_manual_and_server_source
499
+ manual_source = NewRelic::Agent::Configuration::ManualSource.new(:manual => "source")
500
+ Agent.config.apply_config(manual_source)
501
+
526
502
  server_config = NewRelic::Agent::Configuration::ServerSource.new({})
527
503
  Agent.config.apply_config(server_config, 1)
528
504
 
@@ -539,7 +515,7 @@ module NewRelic
539
515
  end
540
516
  end
541
517
 
542
- class AgentStartingTest < Test::Unit::TestCase
518
+ class AgentStartingTest < MiniTest::Unit::TestCase
543
519
  def test_no_service_if_not_monitoring
544
520
  with_config(:monitor_mode => false) do
545
521
  agent = NewRelic::Agent::Agent.new
@@ -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::ApdexFromServerTest < Test::Unit::TestCase
7
+ class NewRelic::Agent::ApdexFromServerTest < MiniTest::Unit::TestCase
8
8
 
9
9
  def test_true
10
10
  # we need tests in this file - TBD
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper
6
6
  require 'new_relic/agent/audit_logger'
7
7
  require 'new_relic/agent/null_logger'
8
8
 
9
- class AuditLoggerTest < Test::Unit::TestCase
9
+ class AuditLoggerTest < MiniTest::Unit::TestCase
10
10
  def setup
11
11
  NewRelic::Agent.config.apply_config(:'audit_log.enabled' => true)
12
12
 
@@ -73,10 +73,9 @@ class AuditLoggerTest < Test::Unit::TestCase
73
73
  NewRelic::Agent::NullLogger.expects(:new).returns(null_logger)
74
74
  logger = NewRelic::Agent::AuditLogger.new
75
75
  logger.stubs(:ensure_log_path).returns(nil)
76
- assert_nothing_raised do
77
- logger.setup_logger
78
- logger.log_request(@uri, 'whatever', @marshaller)
79
- end
76
+
77
+ logger.setup_logger
78
+ logger.log_request(@uri, 'whatever', @marshaller)
80
79
  end
81
80
 
82
81
  def test_log_request_captures_system_call_errors
@@ -90,9 +89,7 @@ class AuditLoggerTest < Test::Unit::TestCase
90
89
  # This just silences that output to keep the test output uncluttered.
91
90
  Logger::LogDevice.any_instance.stubs(:warn)
92
91
 
93
- assert_nothing_raised do
94
- logger.log_request(@uri, 'whatever', @marshaller)
95
- end
92
+ logger.log_request(@uri, 'whatever', @marshaller)
96
93
  end
97
94
 
98
95
  def test_prepares_data_with_identity_encoder
@@ -5,7 +5,7 @@
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
6
6
  require 'new_relic/agent/autostart'
7
7
 
8
- class AutostartTest < Test::Unit::TestCase
8
+ class AutostartTest < MiniTest::Unit::TestCase
9
9
 
10
10
  def test_typically_the_agent_should_autostart
11
11
  assert ::NewRelic::Agent::Autostart.agent_should_start?
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper
6
6
  require 'new_relic/agent/browser_token'
7
7
 
8
8
  module NewRelic::Agent
9
- class BrowserTokenTest < Test::Unit::TestCase
9
+ class BrowserTokenTest < MiniTest::Unit::TestCase
10
10
  def assert_token(expected, cookies)
11
11
  request = stub(:cookies => cookies)
12
12
  assert_equal(expected, BrowserToken.get_token(request))
@@ -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::BusyCalculatorTest < Test::Unit::TestCase
6
+ class NewRelic::Agent::BusyCalculatorTest < MiniTest::Unit::TestCase
7
7
  attr_reader :now
8
8
  def setup
9
9
  @now = Time.now.to_f
@@ -92,9 +92,7 @@ class NewRelic::Agent::BusyCalculatorTest < Test::Unit::TestCase
92
92
 
93
93
  def test_finishing_without_starting_doesnt_raise
94
94
  NewRelic::Agent::TransactionState.clear
95
- assert_nothing_raised do
96
- NewRelic::Agent::BusyCalculator.dispatcher_finish
97
- end
95
+ NewRelic::Agent::BusyCalculator.dispatcher_finish
98
96
  end
99
97
 
100
98
  end
@@ -8,7 +8,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','data_contai
8
8
  require 'new_relic/agent/commands/agent_command_router'
9
9
  require 'new_relic/agent/commands/xray_session'
10
10
 
11
- class AgentCommandRouterTest < Test::Unit::TestCase
11
+ class AgentCommandRouterTest < MiniTest::Unit::TestCase
12
12
 
13
13
  DEFAULT_ARGS = {
14
14
  "profile_id" => 42
@@ -147,7 +147,7 @@ class AgentCommandRouterTest < Test::Unit::TestCase
147
147
  advance_time(1.1)
148
148
  result = agent_commands.harvest!
149
149
 
150
- assert_not_empty result
150
+ refute_empty result
151
151
  end
152
152
 
153
153
  def test_can_stop_multiple_times_safely
@@ -157,7 +157,7 @@ class AgentCommandRouterTest < Test::Unit::TestCase
157
157
  agent_commands.thread_profiler_session.stop(true)
158
158
 
159
159
  result = agent_commands.harvest!
160
- assert_not_empty result
160
+ refute_empty result
161
161
  end
162
162
 
163
163
  def test_transmits_after_forced_stop
@@ -166,7 +166,7 @@ class AgentCommandRouterTest < Test::Unit::TestCase
166
166
  agent_commands.thread_profiler_session.stop(true)
167
167
 
168
168
  result = agent_commands.harvest!
169
- assert_not_empty result
169
+ refute_empty result
170
170
  end
171
171
 
172
172
  def test_harvest_following_before_shutdown_with_no_profile
@@ -180,7 +180,7 @@ class AgentCommandRouterTest < Test::Unit::TestCase
180
180
 
181
181
  @events.notify(:before_shutdown)
182
182
  result = agent_commands.harvest!
183
- assert_not_empty result
183
+ refute_empty result
184
184
  end
185
185
 
186
186
  def test_harvest_with_xray_sessions_in_progress
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_h
6
6
  require 'new_relic/agent/commands/agent_command'
7
7
 
8
8
  module NewRelic::Agent::Commands
9
- class AgentCommandTest < Test::Unit::TestCase
9
+ class AgentCommandTest < MiniTest::Unit::TestCase
10
10
  ID = 123
11
11
  NAME = 'nuke_it_from_orbit'
12
12
  ARGUMENTS = { "profile_id" => 42 }