Sha256: 621dec584f09dbd9b8e74fe1b903a704ab21167cd3f47d015c5a494df93a1406

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 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 'socket'

class ServiceTimeoutTest < Minitest::Test

  def setup
    hk = TCPServer.new('127.0.0.1',0)
    @port = hk.addr[1]

    Thread.new {
      client = hk.accept
      client.gets
      sleep 4
      client.close
      Thread.exit
    }
  end

  def teardown
    NewRelic::Agent.config.reset_to_defaults
  end

  def test_service_timeout
    server = NewRelic::Control::Server.new('localhost',@port,'127.0.0.1')
    NewRelic::Agent.config.add_config_for_testing(:timeout => 0.1)

    service = NewRelic::Agent::NewRelicService.new('deadbeef', server)

    assert_raises NewRelic::Agent::ServerConnectionException do
      service.send('send_request',
                   :uri => '/agent_listener/8/bd0e1d52adade840f7ca727d29a86249e89a6f1c/get_redirect_host',
                   :encoding => 'UTF-8', :collector => server, :data => 'blah')
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
newrelic_rpm-3.12.0.288 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.11.2.286 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.11.1.284 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.11.0.283 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.10.0.279 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.9.275 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.8.273 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.7.266 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.6.257 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.5.251 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.4.245 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.3.241 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.9.2.239 test/multiverse/suites/agent_only/service_timeout_test.rb