Sha256: 093318b0c2954f1a46f690179b37e94be30c046d3fa813163edb2504792aa1eb

Contents?: true

Size: 1.05 KB

Versions: 22

Compression:

Stored size: 1.05 KB

Contents

# -*- encoding: binary -*-
require "./test/rack_unicorn"
$stderr.sync = $stdout.sync = true

class TestMiddlewareUnicorn < Test::Unit::TestCase

  def setup
    @host = ENV["UNICORN_TEST_ADDR"] || "127.0.0.1"
    @sock = TCPServer.new @host, 0
    @port = @sock.addr[1]
    ENV["UNICORN_FD"] = @sock.fileno.to_s
    @host_with_port = "#@host:#@port"
    @opts = { :listeners => [ @host_with_port ] }
    @addr_regexp = Regexp.escape @host_with_port
  end

  def test_auto_listener
    @app = Rack::Builder.new do
      use Raindrops::Middleware
      run Rack::Lobster.new
    end
    @srv = fork { Unicorn::HttpServer.new(@app, @opts).start.join }

    s = TCPSocket.new @host, @port
    s.write "GET /_raindrops HTTP/1.0\r\n\r\n"
    resp = s.read
    _, body = resp.split(/\r\n\r\n/, 2)
    assert_match %r{^#@addr_regexp active: 1$}, body
    assert_match %r{^#@addr_regexp queued: 0$}, body
  end

  def teardown
    Process.kill :QUIT, @srv
    _, status = Process.waitpid2 @srv
    assert status.success?
  end
end if defined?(Unicorn) && RUBY_PLATFORM =~ /linux/

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
raindrops-maintained-0.21.0 test/test_middleware_unicorn.rb
raindrops-0.20.1 test/test_middleware_unicorn.rb
raindrops-0.20.0 test/test_middleware_unicorn.rb
raindrops-0.19.2 test/test_middleware_unicorn.rb
raindrops-0.19.1 test/test_middleware_unicorn.rb
raindrops-0.19.0 test/test_middleware_unicorn.rb
raindrops-0.18.0 test/test_middleware_unicorn.rb
raindrops-0.17.0 test/test_middleware_unicorn.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/raindrops-0.16.0/test/test_middleware_unicorn.rb
raindrops-0.16.0 test/test_middleware_unicorn.rb
raindrops-0.15.0 test/test_middleware_unicorn.rb
raindrops-0.14.0.1.g8177 test/test_middleware_unicorn.rb
raindrops-0.14.0 test/test_middleware_unicorn.rb
raindrops-0.13.0 test/test_middleware_unicorn.rb
raindrops-0.12.0.5.g821b test/test_middleware_unicorn.rb
raindrops-0.12.0 test/test_middleware_unicorn.rb
raindrops-0.11.0 test/test_middleware_unicorn.rb
raindrops-0.10.0 test/test_middleware_unicorn.rb
raindrops-0.9.0 test/test_middleware_unicorn.rb
raindrops-0.8.1 test/test_middleware_unicorn.rb