-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anatoly Shirykalov
committed
Aug 1, 2018
1 parent
b9a499d
commit e65ee1a
Showing
9 changed files
with
145 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ Gemfile.lock | |
/test/test_puma.state | ||
/test/test_server.sock | ||
/test/test_control.sock | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
21431 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'logger' | ||
class AppWithLogger | ||
def initialize | ||
@logger = Logger.new('test/log.log') | ||
end | ||
|
||
def call(env) | ||
puts "write to log" | ||
@logger.info "hello" | ||
#p @logger.instance_variable_get(:@logdev) | ||
[200, {"Content-Type" => "text/plain"}, ["Hello World"]] | ||
end | ||
end | ||
|
||
run AppWithLogger.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
system "rm test/log.log*" | ||
|
||
system "ruby -rrubygems -Ilib bin/pumactl -F test/shell/t4_conf.rb start" | ||
sleep 5 | ||
worker_pid = `ps aux | grep puma | grep worker`.split[1] | ||
|
||
system "curl http://localhost:10104" | ||
system "mv test/log.log test/log.log.1" | ||
system "ps aux | grep puma" | ||
system "kill -HUP `cat t4-pid`" | ||
sleep 8 | ||
|
||
system "echo 'exec request 8s'" | ||
system "curl http://localhost:10104" | ||
sleep 1 | ||
|
||
system "ruby -rrubygems -Ilib bin/pumactl -F test/shell/t4_conf.rb stop" | ||
|
||
def cleanup | ||
system "rm test/log.log*" | ||
system "rm t4-stdout" | ||
system "rm t4-stderr" | ||
end | ||
|
||
if `ps aux | grep puma | grep worker`.split[1] != worker_pid | ||
cleanup | ||
puts "worker pid changed" | ||
exit 1 | ||
end | ||
|
||
if File.size("test/log.log") == 0 | ||
cleanup | ||
puts "nothing written to reopened log file" | ||
exit 1 | ||
end | ||
|
||
cleanup | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pidfile "t4-pid" | ||
bind 'tcp://0.0.0.0:10104' | ||
rackup File.expand_path('../rackup/hello-logs.ru', File.dirname(__FILE__)) | ||
reopen_logs | ||
stdout_redirect "t4-stdout", "t4-stderr", true | ||
daemonize | ||
workers 1 |