mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 20:46:56 +00:00
test/cql-pytest: clean up test_create_large_static_cells_and_rows
The test test_create_large_static_cells_and_rows had its own implementation of "nodetool flush" using Scylla's REST API. Now that we have a nodetool.flush() function for general use in cql-pytest, let's use it and save a bit of duplication. Another benefit is that now this test can be run (and pass) against Cassandra. To allow this test to run on Cassandra, I had to remove a "USING TIMEOUT" which wasn't necessary for this test, and is not a feature supported by Cassandra. Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
from util import new_test_table
|
||||
|
||||
import requests
|
||||
import nodetool
|
||||
|
||||
def test_create_large_static_cells_and_rows(cql, test_keyspace):
|
||||
'''Test that `large_data_handler` successfully reports large static cells
|
||||
@@ -26,18 +27,13 @@ def test_create_large_static_cells_and_rows(cql, test_keyspace):
|
||||
This is a regression test for https://github.com/scylladb/scylla/issues/6780'''
|
||||
schema = "pk int, ck int, user_ids set<text> static, PRIMARY KEY (pk, ck)"
|
||||
with new_test_table(cql, test_keyspace, schema) as table:
|
||||
insert_stmt = cql.prepare(f"INSERT INTO {table} (pk, ck, user_ids) VALUES (?, ?, ?) USING TIMEOUT 5m")
|
||||
insert_stmt = cql.prepare(f"INSERT INTO {table} (pk, ck, user_ids) VALUES (?, ?, ?)")
|
||||
# Default large data threshold for cells is 1 mb, for rows it is 10 mb.
|
||||
# Take 10 mb cell to trigger large data reporting code both for
|
||||
# static cells and static rows simultaneously.
|
||||
large_set = {'x' * 1024 * 1024 * 10}
|
||||
cql.execute(insert_stmt, [1, 1, large_set])
|
||||
|
||||
# REST API endpoint address for test scylla node
|
||||
node_address = f'http://{cql.cluster.contact_points[0]}:10000'
|
||||
# Execute force flush of test table to persistent storage, which is necessary to trigger
|
||||
# `large_data_handler` execution.
|
||||
table_without_ks = table[table.find('.') + 1:] # strip keyspace part from the table name
|
||||
requests.post(f'{node_address}/storage_service/keyspace_flush/{test_keyspace}', params={'cf' : table_without_ks})
|
||||
nodetool.flush(cql, table)
|
||||
# No need to check that the Scylla server is running here, since the test will
|
||||
# fail automatically in case Scylla crashes.
|
||||
# fail automatically in case Scylla crashes.
|
||||
|
||||
Reference in New Issue
Block a user