mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-19 14:10:37 +00:00
Properly shutdown test mock S3 server
This commit is contained in:
committed by
Kliment Serafimov
parent
a3238cd69d
commit
fedcc71c01
@@ -393,7 +393,10 @@ class MockS3Server:
|
||||
):
|
||||
self.port = port
|
||||
|
||||
self.subprocess = subprocess.Popen([f'poetry run moto_server s3 -p{port}'], shell=True)
|
||||
# XXX: do not use `shell=True` or add `exec ` to the command here otherwise.
|
||||
# We use `self.subprocess.kill()` to shut down the server, which would not "just" work in Linux
|
||||
# if a process is started from the shell process.
|
||||
self.subprocess = subprocess.Popen(['poetry', 'run', 'moto_server', 's3', f'-p{port}'])
|
||||
error = None
|
||||
try:
|
||||
return_code = self.subprocess.poll()
|
||||
@@ -403,7 +406,7 @@ class MockS3Server:
|
||||
error = f"expected mock s3 server to start but it failed with exception: {e}. stdout: '{self.subprocess.stdout}', stderr: '{self.subprocess.stderr}'"
|
||||
if error is not None:
|
||||
log.error(error)
|
||||
self.subprocess.kill()
|
||||
self.kill()
|
||||
raise RuntimeError("failed to start s3 mock server")
|
||||
|
||||
def endpoint(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user