test: notify do nothing

This commit is contained in:
steve-chavez
2024-03-19 13:22:51 +03:30
committed by Steve Chavez
parent ee8b3ef8fe
commit 941ea0f929
5 changed files with 41 additions and 1 deletions
+1
View File
@@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #3237, Dump media handlers and timezones with --dump-schema - @wolfgangwalther
- #3323, #3324, Don't hide error on LISTEN channel failure - @steve-chavez
- #3330, Incorrect admin server `/ready` response on slow schema cache loads - @steve-chavez
- #3327, Fix slow responses on schema cache reloads - @steve-chavez
- #3340, Log when the LISTEN channel gets a notification - @steve-chavez
### Deprecated
@@ -393,6 +393,23 @@
pdSchema: public
pdVolatility: Volatile
- - qiName: notify_do_nothing
qiSchema: public
- - pdDescription: null
pdFuncSettings: []
pdHasVariadic: false
pdName: notify_do_nothing
pdParams: []
pdReturnType:
contents:
contents:
qiName: void
qiSchema: pg_catalog
tag: Scalar
tag: Single
pdSchema: public
pdVolatility: Volatile
- - qiName: sleep
qiSchema: public
- - pdDescription: null
+4
View File
@@ -89,6 +89,10 @@ begin
perform pg_notify('pgrst', 'reload config');
end $_$ volatile security definer language plpgsql ;
create function notify_do_nothing() returns void as $_$
notify pgrst, 'nothing';
$_$ language sql;
create function reset_invalid_role_claim_key() returns void as $_$
begin
alter role postgrest_test_authenticator reset pgrst.jwt_role_claim_key;
+1 -1
View File
@@ -246,7 +246,7 @@ def test_invalid_openapi_mode(invalidopenapimodes, defaultenv):
print(line)
# If this test is failing, run pytest with --snapshot-update.
# If this test is failing, run postgrest-test-io --snapshot-update -k test_schema_cache_snapshot
@pytest.mark.parametrize(
"key",
[
+18
View File
@@ -430,6 +430,24 @@ def test_invalid_role_claim_key_notify_reload(defaultenv):
assert response.status_code == 204
def test_notify_do_nothing(defaultenv):
"NOTIFY with unknown message should do nothing"
env = {
**defaultenv,
"PGRST_DB_CONFIG": "true",
"PGRST_DB_CHANNEL_ENABLED": "true",
"PGRST_LOG_LEVEL": "crit",
}
with run(env=env) as postgrest:
response = postgrest.session.post("/rpc/notify_do_nothing")
assert response.status_code == 204
output = postgrest.read_stdout()
assert output == []
def test_db_prepared_statements_enable(defaultenv):
"Should use prepared statements when the setting is enabled."