-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up after unit tests #4050
Conversation
@socket_manager_server -> @socket_manager_path Signed-off-by: abetomo <[email protected]>
Files created in `/tmp` are deleted. Signed-off-by: abetomo <[email protected]>
Backup files are generated in `/tmp` and remain there. Set `root_dir` to generate backup files in the specified directory. Signed-off-by: abetomo <[email protected]>
0e647ed
to
a6b02da
Compare
With the committed changes and the following changes, all files were cleaned. diff --git a/test/command/test_fluentd.rb b/test/command/test_fluentd.rb
index 461e19ef..9d62cd40 100644
--- a/test/command/test_fluentd.rb
+++ b/test/command/test_fluentd.rb
@@ -85,12 +85,12 @@ class TestFluentdCommand < ::Test::Unit::TestCase
yield pid, io
# p(here: "execute command", pid: pid, worker_pids: @worker_pids)
ensure
- Process.kill(:KILL, pid) rescue nil
+ Process.kill(:TERM, pid) rescue nil
if @supervisor_pid
- Process.kill(:KILL, @supervisor_pid) rescue nil
+ Process.kill(:TERM, @supervisor_pid) rescue nil
end
@worker_pids.each do |cpid|
- Process.kill(:KILL, cpid) rescue nil
+ Process.kill(:TERM, cpid) rescue nil
end
# p(here: "execute command", pid: pid, exist: process_exist?(pid), worker_pids: @worker_pids, exists: @worker_pids.map{|i| process_exist?(i) })
Timeout.timeout(10){ sleep 0.1 while process_exist?(pid) } When you exit with SIGTERM, the shutdown process runs and the files are deleted. |
`instance_shutdown` in `ensure` block. Signed-off-by: abetomo <[email protected]>
How about trying |
@ashie Thanks! |
With SIGTERM, the shutdown process runs. `SERVERENGINE_SOCKETMANAGER_*` etc. will be removed in the shutdown process. When it cannot be terminated by SIGTERM, it is terminated by SIGKILL. Signed-off-by: abetomo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Retrying some unstable tests not concerned with this PR... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the fix!
Thanks! |
Thanks for your review! |
Which issue(s) this PR fixes:
Fixes #4048
What this PR does / why we need it:
After unit testing, clean up in /tmp.
(If you cannot terminate with SIGTERM and terminate with SIGKILL, some files cannot be cleaned up. #4050 (comment) #4050 (comment))
Docs Changes:
None
Release Note:
None