Sha256: b6b4123f25c1e24bde0d3398e4443b62853b76a450e150e32ffc1873230296b5

Contents?: true

Size: 1.07 KB

Versions: 32

Compression:

Stored size: 1.07 KB

Contents

require "rbconfig"
require 'test/unit'
require 'socket'

require 'puma/cli'
require 'puma/control_cli'

class TestIntegration < Test::Unit::TestCase
  def setup
    @state_path = "test/test_puma.state"
    @bind_path = "test/test_server.sock"
    @control_path = "test/test_control.sock"
  end

  def teardown
    File.unlink @state_path rescue nil
    File.unlink @bind_path  rescue nil
    File.unlink @control_path rescue nil
  end

  def test_stop_via_pumactl
    if defined?(JRUBY_VERSION) || RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
      assert true
      return
    end

    sin = StringIO.new
    sout = StringIO.new

    cli = Puma::CLI.new %W!-q -S #{@state_path} -b unix://#{@bind_path} --control unix://#{@control_path} test/hello.ru!, sin, sout

    t = Thread.new do
      cli.run
    end

    sleep 1

    s = UNIXSocket.new @bind_path
    s << "GET / HTTP/1.0\r\n\r\n"
    assert_equal "Hello World", s.read.split("\r\n").last

    ccli = Puma::ControlCLI.new %W!-S #{@state_path} stop!, sout

    ccli.run

    assert_kind_of Thread, t.join(1), "server didn't stop"
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
puma-1.6.2-java test/test_integration.rb
puma-1.6.2 test/test_integration.rb
puma-1.6.1-java test/test_integration.rb
puma-1.6.1 test/test_integration.rb
puma-1.6.0-java test/test_integration.rb
puma-1.6.0 test/test_integration.rb
puma-1.5.0-java test/test_integration.rb
puma-1.5.0 test/test_integration.rb
puma-1.4.0-java test/test_integration.rb
puma-1.4.0 test/test_integration.rb
puma-1.3.1-java test/test_integration.rb
puma-1.3.1 test/test_integration.rb
puma-1.3.0-java test/test_integration.rb
puma-1.3.0 test/test_integration.rb
puma-1.2.2-java test/test_integration.rb
puma-1.2.2 test/test_integration.rb
puma-1.2.1-java test/test_integration.rb
puma-1.2.1 test/test_integration.rb
puma-1.2.0-java test/test_integration.rb
puma-1.2.0 test/test_integration.rb