test(io): move remaining tests in test_io.py to their modules
We had just 3 tests remaining in test_io.py. This commit moves them to
their modules. So we have:
* test_graceful_shutdown.py
* test_zero_downtime.py
* test_pg_internal.py
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
(cherry picked from commit 02d83d1c01)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import time
|
||||
|
||||
from util import Thread
|
||||
from postgrest import run
|
||||
|
||||
|
||||
def test_graceful_shutdown_waits_for_in_flight_request(defaultenv):
|
||||
"SIGTERM should allow in-flight requests to finish before exiting"
|
||||
|
||||
with run(env=defaultenv, wait_max_seconds=5) as postgrest:
|
||||
|
||||
def sleep():
|
||||
response = postgrest.session.get("/rpc/sleep?seconds=3", timeout=10)
|
||||
assert response.text == ""
|
||||
assert response.status_code == 204
|
||||
|
||||
t = Thread(target=sleep)
|
||||
t.start()
|
||||
|
||||
# Wait for the request to be in-flight before shutting down.
|
||||
time.sleep(1)
|
||||
|
||||
postgrest.process.terminate()
|
||||
|
||||
t.join()
|
||||
Reference in New Issue
Block a user