1
0
Fork 0
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:
Harry Lewis 2020-04-29 02:06:11 -04:00 committed by GitHub
parent 5a4e744e8a
commit e5f1655e47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 22 deletions

View file

@ -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|

View file

@ -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

View file

@ -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

View file

@ -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)