Attemp to fix test_dictionaries_redis flakiness

This commit is contained in:
Raúl Marín 2023-10-19 11:59:13 +02:00
parent 70711b0898
commit 297eda83fc

View File

@ -6,6 +6,8 @@ cluster = ClickHouseCluster(__file__)
node = cluster.add_instance("node", with_redis=True)
POOL_SIZE = 16
@pytest.fixture(scope="module")
def start_cluster():
@ -29,10 +31,10 @@ def start_cluster():
value UInt64
)
PRIMARY KEY date, id
SOURCE(REDIS(HOST '{}' PORT 6379 STORAGE_TYPE 'hash_map' DB_INDEX 0 PASSWORD 'clickhouse'))
SOURCE(REDIS(HOST '{}' PORT 6379 STORAGE_TYPE 'hash_map' DB_INDEX 0 PASSWORD 'clickhouse' POOL_SIZE '{}'))
LAYOUT(COMPLEX_KEY_DIRECT())
""".format(
cluster.redis_host
cluster.redis_host, POOL_SIZE
)
)
@ -58,12 +60,14 @@ def start_cluster():
def test_redis_dict_long(start_cluster):
assert (
node.query("SELECT count(), uniqExact(date), uniqExact(id) FROM redis_dict")
node.query(
f"SELECT count(), uniqExact(date), uniqExact(id) FROM redis_dict SETTINGS max_threads={POOL_SIZE}"
)
== "1000\t1\t1000\n"
)
assert (
node.query(
"SELECT count(DISTINCT dictGet('redis_dict', 'value', tuple(date, id % 1000))) FROM redis_dictionary_test"
f"SELECT count(DISTINCT dictGet('redis_dict', 'value', tuple(date, id % 1000))) FROM redis_dictionary_test SETTINGS max_threads={POOL_SIZE}"
)
== "1000\n"
)