Sha256: a83c90217da972cc8d5f1076d93e4351c390b03a02160e0835bcb678fd3c8c28

Contents?: true

Size: 943 Bytes

Versions: 8

Compression:

Stored size: 943 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 < MiniTest::Unit::TestCase

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

    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_raises 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

8 entries across 8 versions & 1 rubygems

Version Path
newrelic_rpm-3.7.0.174.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.9.171 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.8.168 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.8.164 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.7.159 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.7.159.beta test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.7.152 test/multiverse/suites/agent_only/service_timeout_test.rb
newrelic_rpm-3.6.6.147 test/multiverse/suites/agent_only/service_timeout_test.rb