fix: Restore showing LISTEN pgrst in pg_stat_activity
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import subprocess
|
||||
import time
|
||||
import pytest
|
||||
|
||||
@@ -690,6 +691,39 @@ def test_admin_ready_w_channel(defaultenv):
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_listener_query_is_visible_in_pg_stat_activity(defaultenv):
|
||||
"The listener connection should show the LISTEN pgrst statement in pg_stat_activity"
|
||||
|
||||
env = {
|
||||
**defaultenv,
|
||||
"PGRST_DB_CHANNEL_ENABLED": "true",
|
||||
"PGAPPNAME": "listener-query-test",
|
||||
}
|
||||
|
||||
with run(env=env):
|
||||
query = """
|
||||
select query
|
||||
from pg_stat_activity
|
||||
where application_name = 'listener-query-test'
|
||||
and query = 'LISTEN "pgrst"'
|
||||
limit 1;
|
||||
"""
|
||||
output = subprocess.check_output(
|
||||
[
|
||||
"psql",
|
||||
"--set",
|
||||
"ON_ERROR_STOP=1",
|
||||
"--tuples-only",
|
||||
"--no-align",
|
||||
"-c",
|
||||
query,
|
||||
],
|
||||
text=True,
|
||||
).strip()
|
||||
|
||||
assert output == 'LISTEN "pgrst"'
|
||||
|
||||
|
||||
def test_admin_ready_wo_channel(defaultenv):
|
||||
"Should get a success response from the admin server ready endpoint when the LISTEN channel is disabled"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user