Sha256: f0781382dfc8269aef5e526d43ea36b767e1ae89c0fd75598a7ec5c7f7f5ed53

Contents?: true

Size: 1.44 KB

Versions: 27

Compression:

Stored size: 1.44 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'newrelic_rpm'

class AgentRunIdHandlingTest < Minitest::Test
  include MultiverseHelpers

  NON_NUMERIC_RUN_ID = 'some-crazy-non-integer-thing'

  setup_and_teardown_agent do
    $collector.stub('connect', { "agent_run_id" => NON_NUMERIC_RUN_ID })
  end

  # This test verifies that the Ruby agent is able to accept non-numeric values
  # of the agent run ID handed down by the collector in response to the connect
  # method. This is required for agent protocol version 14.
  def test_handles_non_numeric_agent_run_ids
    NewRelic::Agent.agent.send(:transmit_data)
    metric_data_post = $collector.calls_for('metric_data').last
    assert_equal(NON_NUMERIC_RUN_ID, metric_data_post[0])
  end

  # The sql_data endpoint sends the agent run ID as a query string parameter,
  # rather than embedded within the body, so make sure we handle that.
  def test_handles_non_numeric_agent_run_id_on_slow_sql_traces
    simulate_slow_sql_trace
    sql_data_post = $collector.calls_for('sql_trace_data').last
    assert_equal(NON_NUMERIC_RUN_ID, sql_data_post.query_params['run_id'])
  end

  def simulate_slow_sql_trace
    in_transaction do
      agent.sql_sampler.notice_sql("select * from test", "Database/test/select", nil, 1.5)
    end
    NewRelic::Agent.agent.send(:harvest_and_send_slowest_sql)
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
newrelic_rpm-4.1.0.333 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-4.0.0.332 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.18.1.330 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.18.0.329 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.17.2.327 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.17.1.326 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.17.0.325 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.16.3.323 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.16.2.321 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.16.1.320 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.16.0.318 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.15.2.317 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.15.1.316 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.15.0.314 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.14.3.313 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.14.2.312 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.14.1.311 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.14.0.305 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
newrelic_rpm-3.13.2.302 test/multiverse/suites/agent_only/agent_run_id_handling_test.rb