@@ -1378,31 +1378,6 @@ def test_schema_cache_query_sleep_logs(defaultenv):
13781378 assert 1000 < observed_ms < 2000
13791379
13801380
1381- def test_schema_cache_load_sleep_logs (defaultenv ):
1382- """Schema cache load sleep should be reflected in the logged load duration."""
1383-
1384- env = {
1385- ** defaultenv ,
1386- "PGRST_INTERNAL_SCHEMA_CACHE_LOAD_SLEEP" : "1000" ,
1387- }
1388- log_pattern = re .compile (r"Schema cache loaded in ([\d.]+) milliseconds" )
1389-
1390- with run (env = env , wait_max_seconds = 3 , no_startup_stdout = False ) as postgrest :
1391- observed_ms = None
1392- collected = []
1393-
1394- lines = postgrest .read_stdout (nlines = 10 )
1395- collected .extend (lines )
1396- for line in lines :
1397- match = log_pattern .search (line )
1398- if match :
1399- observed_ms = float (match .group (1 ))
1400- break
1401-
1402- assert observed_ms is not None
1403- assert 1000 < observed_ms < 2000
1404-
1405-
14061381@pytest .mark .parametrize ("timezone_enabled" , ["true" , "false" ])
14071382@pytest .mark .parametrize ("level" , ["crit" , "error" , "warn" , "info" , "debug" ])
14081383def test_schema_cache_query_timings_log (level , timezone_enabled , defaultenv ):
@@ -2040,54 +2015,6 @@ def test_db_pre_config_with_pg_reserved_words(defaultenv):
20402015 )
20412016
20422017
2043- def test_requests_with_resource_embedding_wait_for_schema_cache_reload (defaultenv ):
2044- "requests that use the schema cache with resource embedding wait long for the schema cache to reload"
2045-
2046- env = {
2047- ** defaultenv ,
2048- "PGRST_DB_POOL" : "2" ,
2049- "PGRST_INTERNAL_SCHEMA_CACHE_RELATIONSHIP_LOAD_SLEEP" : "5100" ,
2050- }
2051-
2052- with run (env = env , wait_max_seconds = 30 ) as postgrest :
2053- # reload the schema cache
2054- response = postgrest .session .get ("/rpc/notify_pgrst" )
2055- assert response .status_code == 204
2056-
2057- postgrest .wait_until_scache_starts_loading ()
2058-
2059- response = postgrest .session .get ("/directors?select=id,name,films(title)" )
2060- assert response .status_code == 200
2061-
2062- assert response .elapsed .total_seconds () > 5
2063-
2064-
2065- def test_requests_without_resource_embedding_wait_for_schema_cache_reload (defaultenv ):
2066- "requests that use the schema cache without resource embedding wait less for the schema cache to reload"
2067-
2068- env = {
2069- ** defaultenv ,
2070- "PGRST_DB_POOL" : "2" ,
2071- "PGRST_INTERNAL_SCHEMA_CACHE_LOAD_SLEEP" : "1100" ,
2072- "PGRST_INTERNAL_SCHEMA_CACHE_RELATIONSHIP_LOAD_SLEEP" : "5000" ,
2073- }
2074-
2075- with run (env = env , wait_max_seconds = 30 ) as postgrest :
2076- # reload the schema cache
2077- response = postgrest .session .get ("/rpc/notify_pgrst" )
2078- assert response .status_code == 204
2079-
2080- postgrest .wait_until_scache_starts_loading ()
2081-
2082- response = postgrest .session .get ("/films" )
2083- assert response .status_code == 200
2084-
2085- assert (
2086- response .elapsed .total_seconds () > 1
2087- and response .elapsed .total_seconds () < 5
2088- )
2089-
2090-
20912018def test_server_timing_transaction_duration (defaultenv , metapostgrest ):
20922019 "server-timing transaction duration should be accurate"
20932020
0 commit comments