[CI] test files - use unlink in ensure when appropriate (#2984)

This commit is contained in:
MSP-Greg 2022-10-04 10:09:06 -05:00 committed by GitHub
parent 838c136aeb
commit 5d5bcb135b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View File

@ -215,14 +215,14 @@ RUBY
stop_server(Integer(File.read("t3-pid")))
assert(worker_pid_was_present)
assert(worker_index_within_number_of_workers)
ensure
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
# use three workers to keep accepting clients

View File

@ -163,20 +163,18 @@ class TestIntegrationSingle < TestIntegration
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)
ensure
File.unlink 't1-stdout' if File.file? 't1-stdout'
File.unlink 't1-pid' if File.file? 't1-pid'
end
def test_puma_started_log_writing
skip_unless_signal_exist? :TERM
suppress_output = '> /dev/null 2>&1'
cli_server '-C test/config/t2_conf.rb test/rackup/hello.ru'
system "curl http://localhost:#{@tcp_port}/ #{suppress_output}"
system "curl http://localhost:#{@tcp_port}/ > /dev/null 2>&1"
out=`#{BASE} bin/pumactl -F test/config/t2_conf.rb status`
@ -184,11 +182,11 @@ class TestIntegrationSingle < TestIntegration
log = File.read('t2-stdout')
File.unlink 't2-stdout' if File.file? 't2-stdout'
assert_match(%r!GET / HTTP/1\.1!, log)
assert(!File.file?("t2-pid"))
assert_equal("Puma is started\n", out)
ensure
File.unlink 't2-stdout' if File.file? 't2-stdout'
end
def test_application_logs_are_flushed_on_write

View File

@ -23,7 +23,7 @@ class TestLauncher < Minitest::Test
launcher(conf).write_state
assert_equal File.read(pid_path).strip.to_i, Process.pid
ensure
File.unlink pid_path
end

View File

@ -44,6 +44,7 @@ class TestPumaControlCli < TestConfigFileBase
def test_config_file
control_cli = Puma::ControlCLI.new ["--config-file", "test/config/state_file_testing_config.rb", "halt"]
assert_equal "t3-pid", control_cli.instance_variable_get(:@pidfile)
ensure
File.unlink "t3-pid" if File.file? "t3-pid"
end