diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-04-24 13:36:49 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-04-24 13:36:49 -0700 |
commit | e74dac7aebd453449d632c697cb05a277c998690 (patch) | |
tree | 303bfd4efa97caa9fe4248b1110dcd1dcf758101 /test/exec/test_exec.rb | |
parent | 3baf3e68c1a7f4d1187e292cc5001fb1dc379194 (diff) | |
download | unicorn-e74dac7aebd453449d632c697cb05a277c998690.tar.gz |
This allows dynamic tuning of the worker_processes count without having to restart existing ones. This also allows worker_processes to be set to a low initial amount in the config file for low-traffic deployments/upgrades and then scaled up as the old processes are killed off. Remove the proposed reexec_worker_processes from TODO since this is far more flexible and powerful. This will allow not-yet-existent third-party monitoring tools to dynamically change and scale worker processes according to site load without increasing the complexity of Unicorn itself.
Diffstat (limited to 'test/exec/test_exec.rb')
-rw-r--r-- | test/exec/test_exec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index b0462dc..014b270 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -98,6 +98,28 @@ end assert_shutdown(pid) end + def test_ttin_ttou + File.open("config.ru", "wb") { |fp| fp.syswrite(HI) } + pid = fork { redirect_test_io { exec($unicorn_bin, "-l#@addr:#@port") } } + log = "test_stderr.#{pid}.log" + wait_master_ready(log) + [ 2, 3].each { |i| + assert_nothing_raised { Process.kill(:TTIN, pid) } + wait_workers_ready(log, i) + } + File.truncate(log, 0) + reaped = nil + [ 2, 1, 0].each { |i| + assert_nothing_raised { Process.kill(:TTOU, pid) } + DEFAULT_TRIES.times { + sleep DEFAULT_RES + reaped = File.readlines(log).grep(/reaped.*\s*worker=#{i}$/) + break if reaped.size == 1 + } + assert_equal 1, reaped.size + } + end + def test_help redirect_test_io do assert(system($unicorn_bin, "-h"), "help text returns true") |