mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
[changelog skip] Move integration logging test to main test suite (#2240)
* Copy test from shell/t1.rb to test/test_integration_t1.rb
This commit is contained in:
parent
5a4e744e8a
commit
e5f1655e47
5 changed files with 23 additions and 22 deletions
|
@ -2,9 +2,9 @@ require "puma"
|
|||
require "puma/detect"
|
||||
|
||||
TESTS_TO_RUN = if Process.respond_to?(:fork)
|
||||
%w[t1 t2 t3]
|
||||
%w[t2 t3]
|
||||
else
|
||||
%w[t1 t2]
|
||||
%w[t2]
|
||||
end
|
||||
|
||||
results = TESTS_TO_RUN.map do |test|
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
system "ruby -rrubygems -Ilib bin/puma -p 10102 -C test/shell/t1_conf.rb test/rackup/hello.ru &"
|
||||
|
||||
sleep 1 until system "curl http://localhost:10102/"
|
||||
|
||||
Process.kill :TERM, Integer(File.read("t1-pid"))
|
||||
|
||||
sleep 1
|
||||
|
||||
log = File.read("t1-stdout")
|
||||
|
||||
File.unlink "t1-stdout" if File.file? "t1-stdout"
|
||||
File.unlink "t1-pid" if File.file? "t1-pid"
|
||||
|
||||
if log =~ %r!GET / HTTP/1\.1!
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
end
|
|
@ -112,4 +112,23 @@ class TestIntegrationSingle < TestIntegration
|
|||
|
||||
assert_match "Thread: TID", output.join
|
||||
end
|
||||
|
||||
def test_write_to_log
|
||||
skip_unless_signal_exist? :TERM
|
||||
|
||||
suppress_output = '> /dev/null 2>&1'
|
||||
|
||||
cli_server '-C test/config/t1_conf.rb test/rackup/hello.ru'
|
||||
|
||||
system "curl http://localhost:#{@tcp_port}/ #{suppress_output}"
|
||||
|
||||
stop_server
|
||||
|
||||
log = File.read('t1-stdout')
|
||||
|
||||
File.unlink 't1-stdout' if File.file? 't1-stdout'
|
||||
File.unlink 't1-pid' if File.file? 't1-pid'
|
||||
|
||||
assert_match(%r!GET / HTTP/1\.1!, log)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -236,7 +236,7 @@ class TestUserSuppliedOptionsIsNotPresent < Minitest::Test
|
|||
file_log_requests_config = true
|
||||
|
||||
@options[:config_files] = [
|
||||
'test/shell/t1_conf.rb'
|
||||
'test/config/t1_conf.rb'
|
||||
]
|
||||
|
||||
conf = Rack::Handler::Puma.config(->{}, @options)
|
||||
|
@ -250,7 +250,7 @@ class TestUserSuppliedOptionsIsNotPresent < Minitest::Test
|
|||
|
||||
@options[:log_requests] = user_log_requests_config
|
||||
@options[:config_files] = [
|
||||
'test/shell/t1_conf.rb'
|
||||
'test/config/t1_conf.rb'
|
||||
]
|
||||
|
||||
conf = Rack::Handler::Puma.config(->{}, @options)
|
||||
|
|
Loading…
Reference in a new issue