Fix code coverage + less flakiness (#318)

Code coverage logic was missing coverage from rust tests. This is now fixed.
Also, we weren't reaping spawned PgCat processes correctly which left zombie processes.
This commit is contained in:
Mostafa Abdelraouf
2023-02-13 15:29:08 -06:00
committed by GitHub
parent f1265a5570
commit bf6efde8cc
2 changed files with 16 additions and 4 deletions

View File

@@ -8,7 +8,11 @@ class PgcatProcess
attr_reader :pid
def self.finalize(pid, log_filename, config_filename)
`kill #{pid}` if pid
if pid
Process.kill("TERM", pid)
Process.wait(pid)
end
File.delete(config_filename) if File.exist?(config_filename)
File.delete(log_filename) if File.exist?(log_filename)
end
@@ -77,8 +81,8 @@ class PgcatProcess
def stop
return unless @pid
`kill #{@pid}`
sleep 0.1
Process.kill("TERM", @pid)
Process.wait(@pid)
@pid = nil
end