newrelic_rpm 3.9.6.257 → 3.9.7.266

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +45 -0
  3. data/lib/new_relic/agent.rb +0 -1
  4. data/lib/new_relic/agent/agent.rb +61 -22
  5. data/lib/new_relic/agent/agent_logger.rb +11 -9
  6. data/lib/new_relic/agent/configuration/default_source.rb +25 -2
  7. data/lib/new_relic/agent/cross_app_monitor.rb +15 -53
  8. data/lib/new_relic/agent/cross_app_tracing.rb +11 -3
  9. data/lib/new_relic/agent/custom_event_aggregator.rb +98 -0
  10. data/lib/new_relic/agent/event_buffer.rb +84 -0
  11. data/lib/new_relic/agent/harvester.rb +4 -15
  12. data/lib/new_relic/agent/hostname.rb +1 -9
  13. data/lib/new_relic/agent/inbound_request_monitor.rb +41 -0
  14. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -2
  15. data/lib/new_relic/agent/instrumentation/queue_time.rb +0 -5
  16. data/lib/new_relic/agent/instrumentation/resque.rb +4 -9
  17. data/lib/new_relic/agent/javascript_instrumentor.rb +0 -12
  18. data/lib/new_relic/agent/method_tracer_helpers.rb +3 -1
  19. data/lib/new_relic/agent/new_relic_service.rb +1 -1
  20. data/lib/new_relic/agent/sampled_buffer.rb +13 -41
  21. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +52 -24
  22. data/lib/new_relic/agent/sized_buffer.rb +23 -0
  23. data/lib/new_relic/agent/synthetics_monitor.rb +50 -0
  24. data/lib/new_relic/agent/system_info.rb +28 -0
  25. data/lib/new_relic/agent/transaction.rb +78 -9
  26. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +25 -0
  27. data/lib/new_relic/agent/{request_sampler.rb → transaction_event_aggregator.rb} +53 -19
  28. data/lib/new_relic/agent/transaction_sample_builder.rb +3 -1
  29. data/lib/new_relic/agent/transaction_sampler.rb +10 -0
  30. data/lib/new_relic/agent/transaction_state.rb +1 -9
  31. data/lib/new_relic/coerce.rb +8 -2
  32. data/lib/new_relic/control.rb +0 -1
  33. data/lib/new_relic/local_environment.rb +12 -8
  34. data/lib/new_relic/metric_spec.rb +11 -2
  35. data/lib/new_relic/rack/developer_mode.rb +9 -1
  36. data/lib/new_relic/transaction_sample.rb +4 -10
  37. data/lib/new_relic/version.rb +1 -1
  38. data/newrelic_rpm.gemspec +1 -0
  39. data/test/agent_helper.rb +15 -2
  40. data/test/environments/norails/Gemfile +1 -0
  41. data/test/environments/rails21/Gemfile +1 -0
  42. data/test/environments/rails22/Gemfile +1 -0
  43. data/test/environments/rails23/Gemfile +1 -0
  44. data/test/environments/rails30/Gemfile +1 -0
  45. data/test/environments/rails31/Gemfile +1 -0
  46. data/test/environments/rails32/Gemfile +2 -1
  47. data/test/environments/rails40/Gemfile +2 -1
  48. data/test/environments/rails41/Gemfile +3 -1
  49. data/test/environments/rails42/Gemfile +3 -1
  50. data/test/fixtures/cross_agent_tests/README.md +6 -2
  51. data/test/fixtures/cross_agent_tests/docker_container_id/README.md +6 -0
  52. data/test/fixtures/cross_agent_tests/docker_container_id/cases.json +22 -0
  53. data/test/fixtures/cross_agent_tests/docker_container_id/docker-0.9.1.txt +10 -0
  54. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.0.0.txt +10 -0
  55. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.3.txt +9 -0
  56. data/test/fixtures/cross_agent_tests/docker_container_id/empty.txt +0 -0
  57. data/test/fixtures/cross_agent_tests/docker_container_id/lxc-containers-without-docker.txt +10 -0
  58. data/test/fixtures/cross_agent_tests/proc_meminfo/README.md +7 -0
  59. data/test/fixtures/cross_agent_tests/proc_meminfo/meminfo_4096MB.txt +47 -0
  60. data/test/fixtures/cross_agent_tests/rum_client_config.json +0 -80
  61. data/test/fixtures/cross_agent_tests/synthetics/synthetics.json +317 -0
  62. data/test/multiverse/lib/multiverse/runner.rb +1 -1
  63. data/test/multiverse/lib/multiverse/suite.rb +1 -0
  64. data/test/multiverse/suites/active_record/Envfile +42 -8
  65. data/test/multiverse/suites/active_record/ar_method_aliasing.rb +8 -4
  66. data/test/multiverse/suites/agent_only/audit_log_test.rb +0 -2
  67. data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +1 -2
  68. data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +5 -5
  69. data/test/multiverse/suites/agent_only/encoding_handling_test.rb +2 -0
  70. data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +8 -0
  71. data/test/multiverse/suites/agent_only/synthetics_test.rb +139 -0
  72. data/test/multiverse/suites/delayed_job/Envfile +79 -0
  73. data/test/multiverse/suites/delayed_job/before_suite.rb +33 -0
  74. data/test/multiverse/suites/delayed_job/config/newrelic.yml +18 -0
  75. data/test/multiverse/suites/delayed_job/delayed_job_sampler_test.rb +131 -0
  76. data/test/multiverse/suites/delayed_job/unsupported_backend_test.rb +24 -0
  77. data/test/multiverse/suites/high_security/high_security_test.rb +3 -10
  78. data/test/multiverse/suites/rails/Envfile +4 -4
  79. data/test/multiverse/suites/rails/request_statistics_test.rb +4 -4
  80. data/test/new_relic/agent/agent_test.rb +32 -4
  81. data/test/new_relic/agent/configuration/default_source_test.rb +6 -0
  82. data/test/new_relic/agent/cross_app_monitor_test.rb +23 -29
  83. data/test/new_relic/agent/custom_event_aggregator_test.rb +88 -0
  84. data/test/new_relic/agent/event_buffer_test_cases.rb +152 -0
  85. data/test/new_relic/agent/harvester_test.rb +5 -25
  86. data/test/new_relic/agent/hostname_test.rb +1 -1
  87. data/test/new_relic/agent/inbound_request_monitor_test.rb +49 -0
  88. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +9 -9
  89. data/test/new_relic/agent/instrumentation/queue_time_test.rb +0 -19
  90. data/test/new_relic/agent/javascript_instrumentor_test.rb +0 -45
  91. data/test/new_relic/agent/new_relic_service_test.rb +17 -12
  92. data/test/new_relic/agent/pipe_channel_manager_test.rb +4 -4
  93. data/test/new_relic/agent/sampled_buffer_test.rb +73 -145
  94. data/test/new_relic/agent/sized_buffer_test.rb +29 -0
  95. data/test/new_relic/agent/synthetics_monitor_test.rb +96 -0
  96. data/test/new_relic/agent/system_info_test.rb +19 -3
  97. data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +14 -8
  98. data/test/new_relic/agent/transaction/synthetics_sample_buffer_test.rb +38 -0
  99. data/test/new_relic/agent/{request_sampler_test.rb → transaction_event_aggregator_test.rb} +55 -4
  100. data/test/new_relic/agent/transaction_sampler_test.rb +33 -11
  101. data/test/new_relic/agent/transaction_state_test.rb +0 -1
  102. data/test/new_relic/agent/transaction_test.rb +121 -19
  103. data/test/new_relic/coerce_test.rb +38 -3
  104. data/test/new_relic/control_test.rb +1 -0
  105. data/test/new_relic/fake_collector.rb +6 -2
  106. data/test/new_relic/fake_external_server.rb +2 -6
  107. data/test/new_relic/fake_server.rb +46 -29
  108. data/test/new_relic/http_client_test_cases.rb +71 -2
  109. data/test/new_relic/local_environment_test.rb +78 -0
  110. data/test/new_relic/metric_parser/metric_parser_test.rb +2 -0
  111. data/test/new_relic/metric_spec_test.rb +43 -0
  112. data/test/new_relic/multiverse_helpers.rb +11 -18
  113. data/test/new_relic/rack/browser_monitoring_test.rb +1 -18
  114. data/test/new_relic/rack/developer_mode_test.rb +1 -1
  115. data/test/new_relic/transaction_sample_test.rb +14 -4
  116. data/test/performance/suites/rack_middleware.rb +3 -1
  117. data/test/test_helper.rb +33 -0
  118. metadata +48 -7
  119. metadata.gz.sig +0 -0
  120. data/lib/new_relic/agent/browser_token.rb +0 -41
  121. data/test/multiverse/suites/agent_only/before_suite.rb +0 -7
  122. data/test/new_relic/agent/browser_token_test.rb +0 -56
@@ -54,16 +54,12 @@ module NewRelic
54
54
  result
55
55
  end
56
56
  end
57
-
58
- def fallback_port
59
- # Only use fallback port on the FakeCollector....
60
- nil
61
- end
62
57
  end
63
58
 
64
59
  class FakeSecureExternalServer < FakeExternalServer
65
60
  def initialize
66
- super(0, true)
61
+ super(0)
62
+ self.use_ssl = true
67
63
  end
68
64
  end
69
65
  end
@@ -19,7 +19,7 @@ module NewRelic
19
19
  # Default server options
20
20
  DEFAULT_OPTIONS = {
21
21
  :Logger => ::WEBrick::Log.new('/dev/null'),
22
- :AccessLog => [ ['/dev/null', ''] ]
22
+ :AccessLog => [['/dev/null', '']]
23
23
  }
24
24
 
25
25
  CONFIG_PATH = File.join(File.dirname(__FILE__), "..", "config")
@@ -27,61 +27,78 @@ module NewRelic
27
27
  FAKE_SSL_KEY_PATH = File.join(CONFIG_PATH, "test.cert.key")
28
28
 
29
29
  SSL_OPTIONS = {
30
- :SSLEnable => true,
30
+ :SSLEnable => true,
31
31
  :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
32
- :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.read(FAKE_SSL_KEY_PATH)),
33
- :SSLCertificate => OpenSSL::X509::Certificate.new(File.read(FAKE_SSL_CERT_PATH)),
34
- :SSLCertName => [["CN", "newrelic.com"]]
32
+ :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.read(FAKE_SSL_KEY_PATH)),
33
+ :SSLCertificate => OpenSSL::X509::Certificate.new(File.read(FAKE_SSL_CERT_PATH)),
34
+ :SSLCertName => [["CN", "newrelic.com"]]
35
35
  }
36
36
 
37
- def initialize( port=DEFAULT_PORT, ssl=false )
38
- @thread = nil
39
-
40
- defaults = $DEBUG ? {} : DEFAULT_OPTIONS
41
- @options = defaults.merge( :Port => port )
37
+ def initialize(port=DEFAULT_PORT)
38
+ @port = port
39
+ @thread = nil
40
+ @sever = nil
41
+ @use_ssl = false
42
+ end
42
43
 
43
- @options.merge!(SSL_OPTIONS) if ssl
44
+ def use_ssl=(value)
45
+ @use_ssl = value
46
+ end
44
47
 
45
- @server = WEBrick::HTTPServer.new( @options )
46
- @server.mount "/", ::Rack::Handler.get( :webrick ), app
48
+ def use_ssl?
49
+ @use_ssl
47
50
  end
48
51
 
52
+ def needs_restart?
53
+ @started_options != build_webrick_options
54
+ end
49
55
 
50
- attr_reader :server
56
+ def restart
57
+ stop
58
+ run
59
+ end
51
60
 
52
- # Run the server, returning the Thread it is running in.
53
- def run( port=nil )
54
- return if @thread && @thread.alive?
55
- @server.listen( @options[:BindAddress], port ) if port
56
- @thread = Thread.new( &self.method(:run_server) )
57
- return @thread
61
+ def running?
62
+ @thread && @thread.alive?
58
63
  end
59
64
 
65
+ def run
66
+ return if running?
60
67
 
61
- # Thread routine for running the server.
62
- def run_server
63
- Thread.current.abort_on_exception = true
64
- @server.start
65
- end
68
+ @started_options = build_webrick_options
66
69
 
70
+ @server = WEBrick::HTTPServer.new(@started_options)
71
+ @server.mount "/", ::Rack::Handler.get(:webrick), app
72
+
73
+ @thread = Thread.new(&self.method(:run_server))
74
+ end
67
75
 
68
76
  def stop
69
- return unless @thread.alive?
77
+ return unless running?
70
78
  @server.shutdown
71
79
  @server = nil
72
80
  @thread.join
81
+ @started_options = nil
73
82
  reset
74
83
  end
75
84
 
85
+ def build_webrick_options
86
+ options = DEFAULT_OPTIONS.merge(:Port => @port)
87
+ options.merge!(SSL_OPTIONS) if use_ssl?
88
+ options
89
+ end
90
+
91
+ def run_server
92
+ Thread.current.abort_on_exception = true
93
+ @server.start
94
+ end
76
95
 
77
96
  def ports
78
- @server.listeners.map {|sock| sock.addr[1] }
97
+ @server.listeners.map { |sock| sock.addr[1] }
79
98
  end
80
99
 
81
100
  def port
82
101
  self.ports.first
83
102
  end
84
- alias_method :determine_port, :port
85
-
86
103
  end
87
104
  end
@@ -32,8 +32,7 @@ module HttpClientTestCases
32
32
  $fake_secure_server.run
33
33
 
34
34
  NewRelic::Agent.instance.events.notify(:finished_configuring)
35
-
36
- @engine = NewRelic::Agent.instance.stats_engine
35
+ NewRelic::Agent::CrossAppTracing.instance_variable_set(:@obfuscator, nil)
37
36
  end
38
37
 
39
38
  # Helpers to support shared tests
@@ -476,6 +475,28 @@ module HttpClientTestCases
476
475
  end
477
476
  end
478
477
 
478
+ def test_raw_synthetics_header_is_passed_along_if_present
479
+ with_config(:"cross_application_tracer.enabled" => true) do
480
+ in_transaction do
481
+ state = NewRelic::Agent::TransactionState.tl_get
482
+ state.current_transaction.raw_synthetics_header = "boo"
483
+
484
+ get_response
485
+
486
+ assert_equal "boo", server.requests.last["HTTP_X_NEWRELIC_SYNTHETICS"]
487
+ end
488
+ end
489
+ end
490
+
491
+ def test_no_raw_synthetics_header_if_not_present
492
+ with_config(:"cross_application_tracer.enabled" => true) do
493
+ in_transaction do
494
+ get_response
495
+ refute_includes server.requests.last.keys, "HTTP_X_NEWRELIC_SYNTHETICS"
496
+ end
497
+ end
498
+ end
499
+
479
500
  load_cross_agent_test("cat_map").each do |test_case|
480
501
  # Test cases that don't involve outgoing calls are done elsewhere
481
502
  if test_case['outboundRequests']
@@ -485,6 +506,8 @@ module HttpClientTestCases
485
506
  :'cross_application_tracer.enabled' => true
486
507
  }
487
508
  with_config(config) do
509
+ NewRelic::Agent.instance.events.notify(:finished_configuring)
510
+
488
511
  in_transaction do
489
512
  state = NewRelic::Agent::TransactionState.tl_get
490
513
  state.referring_transaction_info = test_case['inboundPayload']
@@ -513,6 +536,52 @@ module HttpClientTestCases
513
536
  end
514
537
  end
515
538
 
539
+ # These tests only cover receiving, validating, and passing on the synthetics
540
+ # request header to any outgoing HTTP requests. They do *not* cover attaching
541
+ # of appropriate data to analytics events or transaction traces.
542
+ #
543
+ # The tests in agent_only/synthetics_test.rb cover that.
544
+ load_cross_agent_test('synthetics/synthetics').each do |test|
545
+ define_method("test_synthetics_http_#{test['name']}") do
546
+ config = {
547
+ :encoding_key => test['settings']['agentEncodingKey'],
548
+ :trusted_account_ids => test['settings']['trustedAccountIds'],
549
+ :'cross_application_tracer.enabled' => true
550
+ }
551
+
552
+ with_config(config) do
553
+ NewRelic::Agent.instance.events.notify(:finished_configuring)
554
+
555
+ fake_rack_env = {}
556
+ test['inputObfuscatedHeader'].each do |key, value|
557
+ fake_rack_env[http_header_name_to_rack_key(key)] = value
558
+ end
559
+
560
+ in_transaction do
561
+ NewRelic::Agent.agent.events.notify(:before_call, fake_rack_env)
562
+ get_response
563
+
564
+ last_outbound_request = server.requests.last
565
+ header_specs = test['outputExternalRequestHeader']
566
+
567
+ header_specs['expectedHeader'].each do |key, value|
568
+ expected_key = http_header_name_to_rack_key(key)
569
+ assert_equal(value, last_outbound_request[expected_key])
570
+ end
571
+
572
+ header_specs['nonExpectedHeader'].each do |key|
573
+ non_expected_key = http_header_name_to_rack_key(key)
574
+ refute_includes(last_outbound_request.keys, non_expected_key)
575
+ end
576
+ end
577
+ end
578
+ end
579
+ end
580
+
581
+ def http_header_name_to_rack_key(name)
582
+ "HTTP_" + name.upcase.gsub('-', '_')
583
+ end
584
+
516
585
  def make_app_data_payload( *args )
517
586
  obfuscator = NewRelic::Agent::Obfuscator.new('gringletoes')
518
587
  return obfuscator.obfuscate( args.to_json ) + "\n"
@@ -22,4 +22,82 @@ class NewRelic::LocalEnvironmentTest < Minitest::Test
22
22
  end
23
23
  end
24
24
  end
25
+
26
+ def test_not_resque
27
+ combinations = [["notrake", "resque:work", { "QUEUE" => "*" } ],
28
+ ["rake", "notresque:work", { "QUEUE" => "*" } ],
29
+ ["rake", "resque:work", { "BBQ" => "*" } ]]
30
+
31
+ combinations.each do |settings|
32
+ with_resque(*settings) do
33
+ refute_resque(settings)
34
+ end
35
+ end
36
+ end
37
+
38
+ def test_resque
39
+ combinations = [["rake", "resque:work", { "QUEUE" => "*" }],
40
+ ["rake", "resque:work", { "QUEUES" => "*" }]]
41
+
42
+ combinations.each do |settings|
43
+ with_resque(*settings) do
44
+ assert_resque(settings)
45
+ end
46
+ end
47
+ end
48
+
49
+ def test_not_resque_pool
50
+ combinations = [["notresque-pool", nil],
51
+ ["rake", "notresque:pool"]]
52
+
53
+ combinations.each do |settings|
54
+ with_resque_pool(*settings) do
55
+ refute_resque(settings)
56
+ end
57
+ end
58
+ end
59
+
60
+ def test_resque_pool
61
+ combinations = [["resque-pool", nil],
62
+ ["rake", "resque:pool"]]
63
+
64
+ combinations.each do |settings|
65
+ with_resque_pool(*settings) do
66
+ assert_resque(settings)
67
+ end
68
+ end
69
+ end
70
+
71
+ def with_resque(basename, *args)
72
+ env = {}
73
+ env = args.last if args.last.is_a?(Hash)
74
+ argv = args[0..-1]
75
+
76
+ with_constant_defined(:Resque) do
77
+ with_environment(env) do
78
+ with_argv(argv) do
79
+ File.stubs(:basename).returns(basename)
80
+ yield
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ def with_resque_pool(basename, *args)
87
+ with_resque(basename, *args) do
88
+ with_constant_defined(:'Resque::Pool') do
89
+ yield
90
+ end
91
+ end
92
+ end
93
+
94
+ def assert_resque(settings)
95
+ e = NewRelic::LocalEnvironment.new
96
+ assert_equal :resque, e.discovered_dispatcher, settings.inspect
97
+ end
98
+
99
+ def refute_resque(settings)
100
+ e = NewRelic::LocalEnvironment.new
101
+ refute_equal :resque, e.discovered_dispatcher, settings.inspect
102
+ end
25
103
  end
@@ -2,6 +2,8 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
+ require 'conditional_vendored_metric_parser'
6
+
5
7
  require File.expand_path(File.join(File.dirname(__FILE__),'..', '..', 'test_helper'))
6
8
  class NewRelic::MetricParser::MetricParserTest < Minitest::Test
7
9
  class ::AnApplicationClass
@@ -75,8 +75,51 @@ class NewRelic::MetricSpecTest < Minitest::Test
75
75
  assert_equal("b" * 255, spec.scope, "should have shortened the scope")
76
76
  end
77
77
 
78
+ # These next three tests are here only because rpm_site uses our MetricSpec
79
+ # class in silly ways (specifically, it passes in non-String values for
80
+ # name/scope). If we can get rid of those silly usages, we can remove these
81
+ # tests.
82
+
83
+ def test_initialize_can_take_a_nil_name
84
+ spec = NewRelic::MetricSpec.new(nil)
85
+
86
+ assert_equal('', spec.name)
87
+ assert_equal('', spec.scope)
88
+ end
89
+
90
+ def test_initialize_can_take_a_non_string_name
91
+ name = string_wrapper_class.new("name")
92
+
93
+ spec = NewRelic::MetricSpec.new(name)
94
+
95
+ assert_equal('name', spec.name)
96
+ assert_equal('', spec.scope)
97
+ end
98
+
99
+ def test_initialize_can_take_a_non_string_scope
100
+ name = "name"
101
+ scope = string_wrapper_class.new("scope")
102
+
103
+ spec = NewRelic::MetricSpec.new(name, scope)
104
+
105
+ assert_equal('name', spec.name)
106
+ assert_equal('scope', spec.scope)
107
+ end
108
+
78
109
  private
79
110
 
111
+ def string_wrapper_class
112
+ Class.new do
113
+ def initialize(value)
114
+ @value = value
115
+ end
116
+
117
+ def to_s
118
+ @value
119
+ end
120
+ end
121
+ end
122
+
80
123
  def compare_spec(spec, import)
81
124
  assert_equal 2, import.length
82
125
  assert_equal spec.name, import['name']
@@ -32,19 +32,21 @@ module MultiverseHelpers
32
32
  end
33
33
 
34
34
  def setup_agent(opts = {}, &block)
35
- setup_collector
35
+ ensure_fake_collector unless omit_collector?
36
36
 
37
37
  # Give caller a shot to setup before we start
38
- # Don't just yield, as that won't necessary have the intended receiver
38
+ # Don't just yield, as that won't necessarily have the intended receiver
39
39
  # (the test case instance itself)
40
40
  self.instance_exec($collector, &block) if block_given? && self.respond_to?(:instance_exec)
41
41
 
42
+ # It's important that this is called after the insance_exec above, so that
43
+ # test cases have the chance to change settings on the fake collector first
44
+ start_fake_collector unless omit_collector?
45
+
42
46
  trigger_agent_reconnect(opts)
43
47
  end
44
48
 
45
49
  def teardown_agent
46
- reset_collector
47
-
48
50
  # Put the configs back where they belong....
49
51
  NewRelic::Agent.config.reset_to_defaults
50
52
 
@@ -99,24 +101,15 @@ module MultiverseHelpers
99
101
  # This helps so the runner process can decide before spawning the child
100
102
  # whether we want the collector running or not.
101
103
 
102
- def setup_collector(use_ssl=false)
103
- return if omit_collector?
104
-
104
+ def ensure_fake_collector
105
105
  require 'fake_collector'
106
- $collector ||= NewRelic::FakeCollector.new(use_ssl)
106
+ $collector ||= NewRelic::FakeCollector.new
107
107
  $collector.reset
108
- $collector.run
109
-
110
- if (NewRelic::Agent.instance &&
111
- NewRelic::Agent.instance.service &&
112
- NewRelic::Agent.instance.service.collector)
113
- NewRelic::Agent.instance.service.collector.port = $collector.port
114
- end
115
108
  end
116
109
 
117
- def reset_collector
118
- return if omit_collector?
119
- $collector.reset
110
+ def start_fake_collector
111
+ $collector.restart if $collector.needs_restart?
112
+ agent.service.collector.port = $collector.port if agent
120
113
  end
121
114
 
122
115
  def omit_collector?
@@ -66,6 +66,7 @@ EOL
66
66
  :'rum.enabled' => true,
67
67
  :license_key => 'a' * 40,
68
68
  :js_agent_loader => 'loader',
69
+ :disable_harvest_thread => true
69
70
  }
70
71
  NewRelic::Agent.config.add_config_for_testing(@config)
71
72
  end
@@ -178,24 +179,6 @@ EOL
178
179
  assert last_response.ok?
179
180
  end
180
181
 
181
- def test_token_is_set_in_footer_when_set_by_cookie
182
- token = '1234567890987654321'
183
- set_cookie "NRAGENT=tk=#{token}"
184
- get '/'
185
-
186
- assert(last_response.body.include?(token), last_response.body)
187
- end
188
-
189
- def test_guid_is_set_in_footer_when_token_is_set
190
- guid = 'abcdefgfedcba'
191
- NewRelic::Agent::Transaction.any_instance.stubs(:guid).returns(guid)
192
- set_cookie "NRAGENT=tk=token"
193
- with_config(:apdex_t => 0.0001) do
194
- get '/'
195
- assert(last_response.body.include?(guid), last_response.body)
196
- end
197
- end
198
-
199
182
  def test_calculate_content_length_accounts_for_multibyte_characters_for_186
200
183
  String.stubs(:respond_to?).with(:bytesize).returns(false)
201
184
  browser_monitoring = NewRelic::Rack::BrowserMonitoring.new(mock('app'))