Sha256: 1be7285e57c611da246b9c17b20a73e7bf0dcb7d19850d3ce1a33698c1f4634f

Contents?: true

Size: 951 Bytes

Versions: 17

Compression:

Stored size: 951 Bytes

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 < Test::Unit::TestCase

  PORT = 10_000 + ($$ % 10_000)

  def setup
    hk = TCPServer.new('127.0.0.1',PORT)

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

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

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

    assert_raise Timeout::Error 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

17 entries across 17 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.5.130 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.4.122 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.4.113.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.3.111 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.3.106 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.3.105.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.3.104 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.3.103.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.2.96 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.2.90.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.1.88 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.1.87 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.1.86.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.1.85.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.0.83 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.0.78 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.0.74.beta test/multiverse/suites/agent_only/service_timeout_test.rb