test: Separated query and loading internal sleep configs
To make schema cache loading wait tests robust it is necessary to provide three separate internal config variables: * "internal-schema-cache-query-sleep" - introduces delay in schema queries execution * "internal-schema-cache-load-sleep" - introduces delay between schema queries execution and processing their results * "internal-schema-cache-relationship-load-sleep" - introduces delay in processing relationship query results Thanks to these changes it is now possible to test various schema loading scenarios with the right granularity robustly (eg. make sure requests wait for schema loading but not for relationship loading).
This commit is contained in:
committed by
Steve Chavez
parent
07681d1b5b
commit
c08b87749b
+2
-2
@@ -312,13 +312,13 @@ def test_cli_ready_flag_fail_when_schema_cache_not_loaded(defaultenv, metapostgr
|
||||
**defaultenv,
|
||||
"PGUSER": role,
|
||||
"PGRST_DB_ANON_ROLE": role,
|
||||
"PGRST_INTERNAL_SCHEMA_CACHE_SLEEP": "500",
|
||||
"PGRST_INTERNAL_SCHEMA_CACHE_QUERY_SLEEP": "500",
|
||||
}
|
||||
|
||||
port = freeport()
|
||||
|
||||
with run(env=env, port=port) as postgrest:
|
||||
# The schema cache query takes at least 500ms, due to PGRST_INTERNAL_SCHEMA_CACHE_SLEEP above.
|
||||
# The schema cache query takes at least 500ms, due to PGRST_INTERNAL_SCHEMA_CACHE_QUERY_SLEEP above.
|
||||
# Make it impossible to load the schema cache, by setting statement timeout to 400ms.
|
||||
set_statement_timeout(metapostgrest, role, 400)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user