Sha256: 0e9aefb17a4149c2856fe44ba34a2d839a8a1d3c8f44cf4820bb17b590041708
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require 'test_helper' class PumaWorkerKillerTest < Test::Unit::TestCase def test_starts port = 0 # http://stackoverflow.com/questions/200484/how-do-you-find-a-free-tcp-server-port-using-ruby command = "bundle exec puma #{ fixture_path.join("default.ru") } -t 1:1 -w 2 --preload --debug -p #{ port }" options = { wait_for: "booted", timeout: 5, env: { "PUMA_FREQUENCY" => 1 } } WaitForIt.new(command, options) do |spawn| assert_contains(spawn, "PumaWorkerKiller") end end def test_without_preload port = 0 # http://stackoverflow.com/questions/200484/how-do-you-find-a-free-tcp-server-port-using-ruby command = "bundle exec puma #{ fixture_path.join("default.ru") } -t 1:1 -w 2 --debug -p #{ port } -C #{ fixture_path.join("config/puma_worker_killer_start.rb") }" options = { wait_for: "booted", timeout: 10, env: { "PUMA_FREQUENCY" => 1 } } WaitForIt.new(command, options) do |spawn| assert_contains(spawn, "PumaWorkerKiller") end end def test_kills_large_app file = fixture_path.join("big.ru") port = 0 command = "bundle exec puma #{ file } -t 1:1 -w 2 --preload --debug -p #{ port }" options = { wait_for: "booted", timeout: 5, env: { "PUMA_FREQUENCY" => 1, 'PUMA_RAM' => 1} } WaitForIt.new(command, options) do |spawn| assert_contains(spawn, "Out of memory") end end def assert_contains(spawn, string) assert spawn.wait(string), "Expected logs to contain '#{string}' but it did not, contents: #{ spawn.log.read }" end def test_rolling_restart file = fixture_path.join("rolling_restart.ru") port = 0 command = "bundle exec puma #{ file } -t 1:1 -w 2 --preload --debug -p #{ port }" puts command.inspect options = { wait_for: "booted", timeout: 15, env: { } } WaitForIt.new(command, options) do |spawn| assert_contains(spawn, "Rolling Restart") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puma_worker_killer-0.0.7 | test/puma_worker_killer_test.rb |