From 46b27d1e491ce602d8d1fd9969cd91b3c535656e Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov <d.rodionov@picodata.io> Date: Sat, 14 Dec 2024 01:50:10 +0300 Subject: [PATCH] test: retry query in test_user_can_read_from_query_cache to account for untimely rebalancing --- .../user_can_read_from_query_cache_test.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/pgproto/user_can_read_from_query_cache_test.py b/test/pgproto/user_can_read_from_query_cache_test.py index bfb5a9b675..478a65653d 100644 --- a/test/pgproto/user_can_read_from_query_cache_test.py +++ b/test/pgproto/user_can_read_from_query_cache_test.py @@ -1,4 +1,4 @@ -from conftest import Postgres +from conftest import Postgres, Retriable import psycopg @@ -32,13 +32,18 @@ def test_user_can_read_from_query_cache(postgres: Postgres): """, ) - # put this query in the query cache - cur = conn.execute( - """ + def select_returns_inserted(): + cur = conn.execute( + """ SELECT * FROM "t"; """, - ) - assert sorted(cur.fetchall()) == [(1,), (2,)] + ) + assert sorted(cur.fetchall()) == [(1,), (2,)] + + # put this query in the query cache + # we have to retry because of vshard rebalancing problems + # see https://git.picodata.io/core/sbroad/-/issues/848 + Retriable().call(select_returns_inserted) # get this query from the cache cur = conn.execute( -- GitLab