1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Merge pull request #2347 from sudheer-meka/move-integration-tests-to-regular-suite

[changelog skip] Move integration logging test to main test suite
This commit is contained in:
Nate Berkopec 2020-09-05 16:46:17 -07:00 committed by GitHub
commit a6f14e1ce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 45 deletions

View file

@ -72,18 +72,9 @@ else
end
namespace :test do
desc "Run the integration tests"
task :integration do
sh "ruby test/shell/run.rb"
end
desc "Run all tests"
if (Puma.jruby? && ENV['TRAVIS']) || Puma.windows?
task :all => :test
else
task :all => [:test, "test:integration"]
end
task :all => :test
end
task :default => [:rubocop, "test:all"]

View file

@ -1,10 +0,0 @@
require "puma"
require "puma/detect"
return unless Process.respond_to?(:fork)
if system("ruby -rrubygems test/shell/t3.rb ")
exit 0
else
exit 1
end

View file

@ -1,24 +0,0 @@
system "ruby -rrubygems -Ilib bin/puma -p 10102 -C test/shell/t3_conf.rb test/rackup/hello.ru &"
sleep 5
worker_pid_was_present = File.file? "t3-worker-2-pid"
Process.kill :TERM, Integer(File.read("t3-worker-2-pid")) # kill off a worker
sleep 2
worker_index_within_number_of_workers = !File.file?("t3-worker-3-pid")
Process.kill :TERM, Integer(File.read("t3-pid"))
File.unlink "t3-pid" if File.file? "t3-pid"
File.unlink "t3-worker-0-pid" if File.file? "t3-worker-0-pid"
File.unlink "t3-worker-1-pid" if File.file? "t3-worker-1-pid"
File.unlink "t3-worker-2-pid" if File.file? "t3-worker-2-pid"
File.unlink "t3-worker-3-pid" if File.file? "t3-worker-3-pid"
if worker_pid_was_present and worker_index_within_number_of_workers
exit 0
else
exit 1
end

View file

@ -157,6 +157,31 @@ end
RUBY
end
def test_worker_index_is_with_in_options_limit
skip_unless_signal_exist? :TERM
cli_server "-C test/config/t3_conf.rb test/rackup/hello.ru"
get_worker_pids # this will wait till all the processes are up
worker_pid_was_present = File.file? "t3-worker-2-pid"
stop_server(Integer(File.read("t3-worker-2-pid")))
worker_index_within_number_of_workers = !File.file?("t3-worker-3-pid")
stop_server(Integer(File.read("t3-pid")))
File.unlink "t3-pid" if File.file? "t3-pid"
File.unlink "t3-worker-0-pid" if File.file? "t3-worker-0-pid"
File.unlink "t3-worker-1-pid" if File.file? "t3-worker-1-pid"
File.unlink "t3-worker-2-pid" if File.file? "t3-worker-2-pid"
File.unlink "t3-worker-3-pid" if File.file? "t3-worker-3-pid"
assert(worker_pid_was_present)
assert(worker_index_within_number_of_workers)
end
def test_refork
refork = Tempfile.new('refork')
cli_server "-w #{WORKERS} test/rackup/sleep.ru", config: <<RUBY