Wait LFC prewarm completion in the loop in test_lfc_prewarm.py

This commit is contained in:
Konstantin Knizhnik
2024-09-30 11:47:24 +03:00
parent f971c3a786
commit f328d497e1

View File

@@ -27,12 +27,16 @@ def test_lfc_prewarm(neon_simple_env: NeonEnv):
endpoint.stop()
endpoint.start()
time.sleep(5) # give prewarm BGW some time to proceed
conn = endpoint.connect()
cur = conn.cursor()
cur.execute("select file_cache_used from neon_stat_file_cache")
lfc_used = cur.fetchall()[0][0]
for _ in range(20):
time.sleep(1) # give prewarm BGW some time to proceed
cur.execute("select file_cache_used from neon_stat_file_cache")
lfc_used = cur.fetchall()[0][0]
if lfc_used > 100:
break
log.info(f"Used LFC size: {lfc_used}")
assert lfc_used > 100