test: compile unit tests into a single executable

To reduce test executable size and speed up compilation time, compile unit
tests into a single executable.

Here is a file size comparison of the unit test executable:

- Before applying the patch
$ du -h --exclude='*.o' --exclude='*.o.d' build/release/test/boost/ build/debug/test/boost/
11G	build/release/test/boost/
29G	build/debug/test/boost/

- After applying the patch
du -h --exclude='*.o' --exclude='*.o.d' build/release/test/boost/ build/debug/test/boost/
5.5G	build/release/test/boost/
19G	build/debug/test/boost/

It reduces executable sizes 5.5GB on release, and 10GB on debug.

Closes #9155

Closes scylladb/scylladb#21443
This commit is contained in:
Takuya ASADA
2024-09-05 05:37:28 +09:00
committed by Avi Kivity
parent 200f0bb219
commit 03461d6a54
65 changed files with 660 additions and 272 deletions

View File

@@ -430,92 +430,67 @@ modes = {
}
scylla_tests = set([
'test/boost/combined_tests',
'test/boost/UUID_test',
'test/boost/aggregate_fcts_test',
'test/boost/allocation_strategy_test',
'test/boost/alternator_unit_test',
'test/boost/anchorless_list_test',
'test/boost/auth_passwords_test',
'test/boost/auth_resource_test',
'test/boost/auth_test',
'test/boost/batchlog_manager_test',
'test/boost/big_decimal_test',
'test/boost/bloom_filter_test',
'test/boost/bptree_test',
'test/boost/broken_sstable_test',
'test/boost/btree_test',
'test/boost/bytes_ostream_test',
'test/boost/cache_algorithm_test',
'test/boost/cache_mutation_reader_test',
'test/boost/cached_file_test',
'test/boost/caching_options_test',
'test/boost/canonical_mutation_test',
'test/boost/cartesian_product_test',
'test/boost/castas_fcts_test',
'test/boost/cdc_generation_test',
'test/boost/cdc_test',
'test/boost/cell_locker_test',
'test/boost/checksum_utils_test',
'test/boost/chunked_managed_vector_test',
'test/boost/chunked_vector_test',
'test/boost/clustering_ranges_walker_test',
'test/boost/column_mapping_test',
'test/boost/commitlog_cleanup_test',
'test/boost/commitlog_test',
'test/boost/compaction_group_test',
'test/boost/compound_test',
'test/boost/compress_test',
'test/boost/config_test',
'test/boost/continuous_data_consumer_test',
'test/boost/counter_test',
'test/boost/cql_auth_query_test',
'test/boost/cql_auth_syntax_test',
'test/boost/cql_functions_test',
'test/boost/cql_query_group_test',
'test/boost/cql_query_large_test',
'test/boost/cql_query_like_test',
'test/boost/cql_query_test',
'test/boost/crc_test',
'test/boost/data_listeners_test',
'test/boost/database_test',
'test/boost/dirty_memory_manager_test',
'test/boost/double_decker_test',
'test/boost/duration_test',
'test/boost/dynamic_bitset_test',
'test/boost/enum_option_test',
'test/boost/enum_set_test',
'test/boost/error_injection_test',
'test/boost/estimated_histogram_test',
'test/boost/exception_container_test',
'test/boost/exceptions_fallback_test',
'test/boost/exceptions_optimized_test',
'test/boost/expr_test',
'test/boost/extensions_test',
'test/boost/filtering_test',
'test/boost/flush_queue_test',
'test/boost/fragmented_temporary_buffer_test',
'test/boost/frozen_mutation_test',
'test/boost/generic_server_test',
'test/boost/gossiping_property_file_snitch_test',
'test/boost/group0_cmd_merge_test',
'test/boost/group0_test',
'test/boost/hash_test',
'test/boost/hashers_test',
'test/boost/hint_test',
'test/boost/idl_test',
'test/boost/index_reader_test',
'test/boost/index_with_paging_test',
'test/boost/input_stream_test',
'test/boost/intrusive_array_test',
'test/boost/json_cql_query_test',
'test/boost/json_test',
'test/boost/keys_test',
'test/boost/large_paging_state_test',
'test/boost/like_matcher_test',
'test/boost/limiting_data_source_test',
'test/boost/linearizing_input_stream_test',
'test/boost/lister_test',
'test/boost/loading_cache_test',
'test/boost/locator_topology_test',
'test/boost/log_heap_test',
'test/boost/logalloc_standard_allocator_segment_pool_backend_test',
@@ -523,88 +498,54 @@ scylla_tests = set([
'test/boost/managed_bytes_test',
'test/boost/managed_vector_test',
'test/boost/map_difference_test',
'test/boost/memtable_test',
'test/boost/multishard_combining_reader_as_mutation_source_test',
'test/boost/multishard_mutation_query_test',
'test/boost/murmur_hash_test',
'test/boost/mutation_fragment_test',
'test/boost/mutation_query_test',
'test/boost/mutation_reader_another_test',
'test/boost/mutation_reader_test',
'test/boost/mutation_test',
'test/boost/mutation_writer_test',
'test/boost/mvcc_test',
'test/boost/network_topology_strategy_test',
'test/boost/nonwrapping_interval_test',
'test/boost/observable_test',
'test/boost/partitioner_test',
'test/boost/per_partition_rate_limit_test',
'test/boost/pretty_printers_test',
'test/boost/querier_cache_test',
'test/boost/query_processor_test',
'test/boost/radix_tree_test',
'test/boost/range_tombstone_list_test',
'test/boost/rate_limiter_test',
'test/boost/reader_concurrency_semaphore_test',
'test/boost/recent_entries_map_test',
'test/boost/repair_test',
'test/boost/restrictions_test',
'test/boost/result_utils_test',
'test/boost/reusable_buffer_test',
'test/boost/role_manager_test',
'test/boost/row_cache_test',
'test/boost/rust_test',
'test/boost/s3_test',
'test/boost/aws_errors_test',
'test/boost/aws_error_injection_test',
'test/boost/schema_change_test',
'test/boost/schema_changes_test',
'test/boost/schema_loader_test',
'test/boost/schema_registry_test',
'test/boost/secondary_index_test',
'test/boost/serialization_test',
'test/boost/serialized_action_test',
'test/boost/service_level_controller_test',
'test/boost/sessions_test',
'test/boost/small_vector_test',
'test/boost/snitch_reset_test',
'test/boost/sorting_test',
'test/boost/sstable_3_x_test',
'test/boost/sstable_compaction_test',
'test/boost/sstable_conforms_to_mutation_source_test',
'test/boost/sstable_datafile_test',
'test/boost/sstable_directory_test',
'test/boost/sstable_generation_test',
'test/boost/sstable_move_test',
'test/boost/sstable_mutation_test',
'test/boost/sstable_partition_index_cache_test',
'test/boost/sstable_resharding_test',
'test/boost/sstable_set_test',
'test/boost/sstable_test',
'test/boost/stall_free_test',
'test/boost/statement_restrictions_test',
'test/boost/storage_proxy_test',
'test/boost/string_format_test',
'test/boost/summary_test',
'test/boost/tablets_test',
'test/boost/tagged_integer_test',
'test/boost/token_metadata_test',
'test/boost/top_k_test',
'test/boost/tracing_test',
'test/boost/transport_test',
'test/boost/types_test',
'test/boost/user_function_test',
'test/boost/user_types_test',
'test/boost/utf8_test',
'test/boost/view_build_test',
'test/boost/view_complex_test',
'test/boost/view_schema_ckey_test',
'test/boost/view_schema_pkey_test',
'test/boost/view_schema_test',
'test/boost/vint_serialization_test',
'test/boost/virtual_reader_test',
'test/boost/virtual_table_mutation_source_test',
'test/boost/virtual_table_test',
'test/boost/wasm_alloc_test',
'test/boost/wasm_test',
'test/boost/wrapping_interval_test',
@@ -1455,8 +1396,72 @@ for t in sorted(perf_tests):
deps[t] = [t + '.cc'] + scylla_tests_dependencies + perf_tests_seastar_deps
deps[t] += ['test/perf/perf.cc', 'seastar/tests/perf/linux_perf_event.cc']
deps['test/boost/mutation_reader_test'] += ['test/lib/dummy_sharder.cc' ]
deps['test/boost/multishard_combining_reader_as_mutation_source_test'] += ['test/lib/dummy_sharder.cc' ]
deps['test/boost/combined_tests'] += [
'test/boost/aggregate_fcts_test.cc',
'test/boost/auth_test.cc',
'test/boost/batchlog_manager_test.cc',
'test/boost/cache_algorithm_test.cc',
'test/boost/castas_fcts_test.cc',
'test/boost/cdc_test.cc',
'test/boost/column_mapping_test.cc',
'test/boost/commitlog_cleanup_test.cc',
'test/boost/commitlog_test.cc',
'test/boost/cql_auth_query_test.cc',
'test/boost/cql_functions_test.cc',
'test/boost/cql_query_group_test.cc',
'test/boost/cql_query_large_test.cc',
'test/boost/cql_query_like_test.cc',
'test/boost/cql_query_test.cc',
'test/boost/database_test.cc',
'test/boost/data_listeners_test.cc',
'test/boost/error_injection_test.cc',
'test/boost/extensions_test.cc',
'test/boost/filtering_test.cc',
'test/boost/group0_cmd_merge_test.cc',
'test/boost/group0_test.cc',
'test/boost/index_with_paging_test.cc',
'test/boost/json_cql_query_test.cc',
'test/boost/large_paging_state_test.cc',
'test/boost/loading_cache_test.cc',
'test/boost/memtable_test.cc',
'test/boost/multishard_combining_reader_as_mutation_source_test.cc',
'test/boost/multishard_mutation_query_test.cc',
'test/boost/mutation_reader_test.cc',
'test/boost/mutation_writer_test.cc',
'test/boost/network_topology_strategy_test.cc',
'test/boost/per_partition_rate_limit_test.cc',
'test/boost/querier_cache_test.cc',
'test/boost/query_processor_test.cc',
'test/boost/reader_concurrency_semaphore_test.cc',
'test/boost/repair_test.cc',
'test/boost/restrictions_test.cc',
'test/boost/role_manager_test.cc',
'test/boost/row_cache_test.cc',
'test/boost/schema_change_test.cc',
'test/boost/schema_registry_test.cc',
'test/boost/secondary_index_test.cc',
'test/boost/sessions_test.cc',
'test/boost/sstable_compaction_test.cc',
'test/boost/sstable_directory_test.cc',
'test/boost/sstable_set_test.cc',
'test/boost/statement_restrictions_test.cc',
'test/boost/storage_proxy_test.cc',
'test/boost/tablets_test.cc',
'test/boost/tracing_test.cc',
'test/boost/user_function_test.cc',
'test/boost/user_types_test.cc',
'test/boost/view_build_test.cc',
'test/boost/view_complex_test.cc',
'test/boost/view_schema_ckey_test.cc',
'test/boost/view_schema_pkey_test.cc',
'test/boost/view_schema_test.cc',
'test/boost/virtual_reader_test.cc',
'test/boost/virtual_table_test.cc',
'tools/schema_loader.cc',
'tools/read_mutation.cc',
'test/lib/expr_test_utils.cc',
'test/lib/dummy_sharder.cc',
]
deps['test/boost/bytes_ostream_test'] = [
"test/boost/bytes_ostream_test.cc",
@@ -1496,8 +1501,6 @@ deps['test/boost/duration_test'] += ['test/lib/exception_utils.cc']
deps['test/boost/schema_loader_test'] += ['tools/schema_loader.cc', 'tools/read_mutation.cc']
deps['test/boost/rust_test'] += ['rust/inc/src/lib.rs']
deps['test/boost/group0_cmd_merge_test'] += ['test/lib/expr_test_utils.cc']
deps['test/raft/replication_test'] = ['test/raft/replication_test.cc', 'test/raft/replication.cc', 'test/raft/helpers.cc'] + scylla_raft_dependencies
deps['test/raft/raft_server_test'] = ['test/raft/raft_server_test.cc', 'test/raft/replication.cc', 'test/raft/helpers.cc'] + scylla_raft_dependencies
deps['test/raft/randomized_nemesis_test'] = ['test/raft/randomized_nemesis_test.cc', 'direct_failure_detector/failure_detector.cc', 'test/raft/helpers.cc'] + scylla_raft_dependencies

View File

@@ -141,7 +141,7 @@ class mutation_reordered_with_truncate_exception : public std::exception {};
class column_family_test;
class table_for_tests;
class database_test;
class database_test_wrapper;
using sstable_list = sstables::sstable_list;
class sigquit_handler;
@@ -1384,7 +1384,7 @@ class db_user_types_storage;
// use table::shard_for_reads()/table::shard_for_writes() for data
class database : public peering_sharded_service<database> {
friend class ::database_test;
friend class ::database_test_wrapper;
public:
enum class table_kind {
system,

110
test.py
View File

@@ -352,6 +352,12 @@ class UnitTestSuite(TestSuite):
@property
def pattern(self) -> str:
# This should only match individual tests and not combined_tests.cc
# file of the combined test.
# It is because combined_tests.cc itself does not contain any tests.
# To keep the code simple, we have avoided this by renaming
# combined test file to “_tests.cc” instead of changing the match
# pattern.
return "*_test.cc"
@@ -362,11 +368,47 @@ class BoostTestSuite(UnitTestSuite):
# --list_content. Static to share across all modes.
_case_cache: Dict[str, List[str]] = dict()
_exec_name_cache: Dict[str, str] = dict()
def _generate_cache(self) -> None:
# Apply combined test only for test/boost
if self.name != 'boost':
return
exe = path_to(self.mode, "test", self.name, 'combined_tests')
res = subprocess.run(
[exe, '--list_content'],
check=True,
capture_output=True,
env=dict(os.environ,
**{"ASAN_OPTIONS": "halt_on_error=0"}),
)
testname = None
fqname = None
for line in res.stderr.decode().splitlines():
if not line.startswith(' '):
testname = line.strip().rstrip('*')
fqname = os.path.join(self.mode, self.name, testname)
self._exec_name_cache[fqname] = 'combined_tests'
self._case_cache[fqname] = []
else:
casename = line.strip().rstrip('*')
if casename.startswith('_'):
continue
self._case_cache[fqname].append(casename)
def __init__(self, path, cfg: dict, options: argparse.Namespace, mode) -> None:
super().__init__(path, cfg, options, mode)
self._generate_cache()
async def create_test(self, shortname: str, casename: str, suite, args) -> None:
exe = path_to(suite.mode, "test", suite.name, shortname)
fqname = os.path.join(self.mode, self.name, shortname)
if fqname in self._exec_name_cache:
execname = self._exec_name_cache[fqname]
combined_test = True
else:
execname = None
combined_test = False
exe = path_to(suite.mode, "test", suite.name, execname if combined_test else shortname)
if not os.access(exe, os.X_OK):
print(palette.warn(f"Boost test executable {exe} not found."))
return
@@ -374,6 +416,8 @@ class BoostTestSuite(UnitTestSuite):
allows_compaction_groups = self.all_can_run_compaction_groups_except != None and shortname not in self.all_can_run_compaction_groups_except
if options.parallel_cases and (shortname not in self.no_parallel_cases) and casename is None:
fqname = os.path.join(self.mode, self.name, shortname)
# since combined tests are preloaded to self._case_cache, this will
# only run in non-combined test mode
if fqname not in self._case_cache:
process = await asyncio.create_subprocess_exec(
exe, *['--list_content'],
@@ -398,16 +442,36 @@ class BoostTestSuite(UnitTestSuite):
case_list = self._case_cache[fqname]
if len(case_list) == 1:
test = BoostTest(self.next_id((shortname, self.suite_key)), shortname, suite, args, None, allows_compaction_groups)
test = BoostTest(self.next_id((shortname, self.suite_key)), shortname, suite, args, None, allows_compaction_groups, execname)
self.tests.append(test)
else:
for case in case_list:
test = BoostTest(self.next_id((shortname, self.suite_key, case)), shortname, suite, args, case, allows_compaction_groups)
test = BoostTest(self.next_id((shortname, self.suite_key, case)), shortname, suite, args, case, allows_compaction_groups, execname)
self.tests.append(test)
else:
test = BoostTest(self.next_id((shortname, self.suite_key)), shortname, suite, args, casename, allows_compaction_groups)
test = BoostTest(self.next_id((shortname, self.suite_key)), shortname, suite, args, casename, allows_compaction_groups, execname)
self.tests.append(test)
async def add_test(self, shortname, casename) -> None:
"""Create a UnitTest class with possibly custom command line
arguments and add it to the list of tests"""
fqname = os.path.join(self.mode, self.name, shortname)
if fqname in self._exec_name_cache:
execname = self._exec_name_cache[fqname]
combined_test = True
else:
combined_test = False
# Skip tests which are not configured, and hence are not built
if os.path.join("test", self.name, execname if combined_test else shortname) not in self.options.tests:
return
# Default seastar arguments, if not provided in custom test options,
# are two cores and 2G of RAM
args = self.custom_args.get(shortname, ["-c2 -m2G"])
args = merge_cmdline_options(args, self.options.extra_scylla_cmdline_options)
for a in args:
await self.create_test(shortname, casename, self, a)
def junit_tests(self) -> Iterable['Test']:
"""Boost tests produce an own XML output, so are not included in a junit report"""
return []
@@ -714,16 +778,38 @@ class UnitTest(Test):
TestPath = collections.namedtuple('TestPath', ['suite_name', 'test_name', 'case_name'])
class BoostTest(UnitTest):
class BoostTest(Test):
"""A unit test which can produce its own XML output"""
standard_args = shlex.split("--overprovisioned --unsafe-bypass-fsync 1 "
"--kernel-page-cache 1 "
"--blocked-reactor-notify-ms 2000000 --collectd 0 "
"--max-networking-io-control-blocks=100 ")
def __init__(self, test_no: int, shortname: str, suite, args: str,
casename: Optional[str], allows_compaction_groups : bool) -> None:
casename: Optional[str], allows_compaction_groups : bool, execname: Optional[str]) -> None:
boost_args = []
combined_test = True if execname else False
_shortname = shortname
if casename:
shortname += '.' + casename
boost_args += ['--run_test=' + casename]
super().__init__(test_no, shortname, suite, args)
if combined_test:
boost_args += ['--run_test=' + _shortname + '/' + casename]
else:
boost_args += ['--run_test=' + casename]
else:
if combined_test:
boost_args += ['--run_test=' + _shortname]
super().__init__(test_no, shortname, suite)
if combined_test:
self.path = path_to(self.mode, "test", suite.name, execname)
else:
self.path = path_to(self.mode, "test", suite.name, shortname.split('.')[0])
self.args = shlex.split(args) + UnitTest.standard_args
if self.mode == "coverage":
self.env.update(coverage.env(self.path))
self.xmlout = os.path.join(suite.options.tmpdir, self.mode, "xml", self.uname + ".xunit.xml")
boost_args += ['--report_level=no',
'--logger=HRF,test_suite:XML,test_suite,' + self.xmlout]
@@ -784,12 +870,18 @@ class BoostTest(UnitTest):
self.args += ['--random-seed', options.random_seed]
if self.allows_compaction_groups and options.x_log2_compaction_groups:
self.args += [ "--x-log2-compaction-groups", str(options.x_log2_compaction_groups) ]
return await super().run(options)
self.success = await run_test(self, options, env=self.env)
logging.info("Test %s %s", self.uname, "succeeded" if self.success else "failed ")
return self
def write_junit_failure_report(self, xml_res: ET.Element) -> None:
"""Does not write junit report for Jenkins legacy reasons"""
assert False
def print_summary(self) -> None:
print("Output of {} {}:".format(self.path, " ".join(self.args)))
print(read_log(self.log_filename))
class CQLApprovalTest(Test):
"""Run a sequence of CQL commands against a standalone Scylla"""

View File

@@ -1,7 +1,5 @@
add_scylla_test(UUID_test
KIND BOOST)
add_scylla_test(aggregate_fcts_test
KIND SEASTAR)
add_scylla_test(allocation_strategy_test
KIND BOOST)
add_scylla_test(alternator_unit_test
@@ -14,11 +12,6 @@ add_scylla_test(auth_passwords_test
LIBRARIES auth)
add_scylla_test(auth_resource_test
KIND BOOST)
add_scylla_test(auth_test
KIND SEASTAR
LIBRARIES cql3)
add_scylla_test(batchlog_manager_test
KIND SEASTAR)
add_scylla_test(big_decimal_test
KIND BOOST
LIBRARIES utils)
@@ -34,8 +27,6 @@ add_scylla_test(btree_test
add_scylla_test(bytes_ostream_test
KIND BOOST
LIBRARIES Seastar::seastar_testing)
add_scylla_test(cache_algorithm_test
KIND SEASTAR)
add_scylla_test(cache_mutation_reader_test
KIND SEASTAR)
add_scylla_test(cached_file_test
@@ -46,13 +37,9 @@ add_scylla_test(canonical_mutation_test
KIND SEASTAR)
add_scylla_test(cartesian_product_test
KIND BOOST)
add_scylla_test(castas_fcts_test
KIND SEASTAR)
add_scylla_test(cdc_generation_test
KIND BOOST
LIBRARIES Seastar::seastar_testing)
add_scylla_test(cdc_test
KIND SEASTAR)
add_scylla_test(cell_locker_test
KIND SEASTAR)
add_scylla_test(checksum_utils_test
@@ -63,12 +50,6 @@ add_scylla_test(chunked_vector_test
KIND BOOST)
add_scylla_test(clustering_ranges_walker_test
KIND SEASTAR)
add_scylla_test(column_mapping_test
KIND SEASTAR)
add_scylla_test(commitlog_cleanup_test
KIND SEASTAR)
add_scylla_test(commitlog_test
KIND SEASTAR)
add_scylla_test(compaction_group_test
KIND SEASTAR)
add_scylla_test(compound_test
@@ -81,28 +62,11 @@ add_scylla_test(continuous_data_consumer_test
KIND SEASTAR)
add_scylla_test(counter_test
KIND SEASTAR)
add_scylla_test(cql_auth_query_test
KIND SEASTAR)
add_scylla_test(cql_auth_syntax_test
KIND BOOST
LIBRARIES cql3)
add_scylla_test(cql_functions_test
KIND SEASTAR)
add_scylla_test(cql_query_group_test
KIND SEASTAR)
add_scylla_test(cql_query_large_test
KIND SEASTAR)
add_scylla_test(cql_query_like_test
KIND SEASTAR)
add_scylla_test(cql_query_test
KIND SEASTAR
LIBRARIES cql3)
add_scylla_test(crc_test
KIND BOOST)
add_scylla_test(data_listeners_test
KIND SEASTAR)
add_scylla_test(database_test
KIND SEASTAR)
add_scylla_test(dirty_memory_manager_test
KIND SEASTAR)
add_scylla_test(double_decker_test
@@ -116,8 +80,6 @@ add_scylla_test(enum_option_test
KIND BOOST)
add_scylla_test(enum_set_test
KIND BOOST)
add_scylla_test(error_injection_test
KIND SEASTAR)
add_scylla_test(estimated_histogram_test
KIND BOOST)
add_scylla_test(exception_container_test
@@ -129,10 +91,6 @@ add_scylla_test(exceptions_optimized_test
add_scylla_test(expr_test
KIND BOOST
LIBRARIES cql3)
add_scylla_test(extensions_test
KIND SEASTAR)
add_scylla_test(filtering_test
KIND SEASTAR)
add_scylla_test(flush_queue_test
KIND SEASTAR)
add_scylla_test(fragmented_temporary_buffer_test
@@ -143,10 +101,6 @@ add_scylla_test(generic_server_test
KIND SEASTAR)
add_scylla_test(gossiping_property_file_snitch_test
KIND SEASTAR)
add_scylla_test(group0_cmd_merge_test
KIND SEASTAR)
add_scylla_test(group0_test
KIND SEASTAR)
add_scylla_test(hash_test
KIND SEASTAR)
add_scylla_test(hashers_test
@@ -158,23 +112,17 @@ add_scylla_test(idl_test
LIBRARIES idl)
add_scylla_test(index_reader_test
KIND SEASTAR)
add_scylla_test(index_with_paging_test
KIND SEASTAR)
add_scylla_test(input_stream_test
KIND BOOST
LIBRARIES Seastar::seastar_testing)
add_scylla_test(intrusive_array_test
KIND SEASTAR)
add_scylla_test(json_cql_query_test
KIND SEASTAR)
add_scylla_test(json_test
KIND BOOST
LIBRARIES cql3)
add_scylla_test(keys_test
KIND BOOST
LIBRARIES idl schema)
add_scylla_test(large_paging_state_test
KIND SEASTAR)
add_scylla_test(like_matcher_test
KIND BOOST
LIBRARIES utils)
@@ -184,8 +132,6 @@ add_scylla_test(linearizing_input_stream_test
KIND BOOST)
add_scylla_test(lister_test
KIND SEASTAR)
add_scylla_test(loading_cache_test
KIND SEASTAR)
add_scylla_test(locator_topology_test
KIND SEASTAR)
add_scylla_test(log_heap_test
@@ -201,12 +147,6 @@ add_scylla_test(managed_vector_test
KIND SEASTAR)
add_scylla_test(map_difference_test
KIND BOOST)
add_scylla_test(memtable_test
KIND SEASTAR)
add_scylla_test(multishard_combining_reader_as_mutation_source_test
KIND SEASTAR)
add_scylla_test(multishard_mutation_query_test
KIND SEASTAR)
add_scylla_test(murmur_hash_test
KIND BOOST)
add_scylla_test(mutation_fragment_test
@@ -215,52 +155,30 @@ add_scylla_test(mutation_query_test
KIND SEASTAR)
add_scylla_test(mutation_reader_another_test
KIND SEASTAR)
add_scylla_test(mutation_reader_test
KIND SEASTAR)
add_scylla_test(mutation_test
KIND SEASTAR)
add_scylla_test(mutation_writer_test
KIND SEASTAR)
add_scylla_test(mvcc_test
KIND SEASTAR)
add_scylla_test(network_topology_strategy_test
KIND SEASTAR)
add_scylla_test(nonwrapping_interval_test
KIND BOOST)
add_scylla_test(observable_test
KIND BOOST)
add_scylla_test(partitioner_test
KIND SEASTAR)
add_scylla_test(per_partition_rate_limit_test
KIND SEASTAR)
add_scylla_test(pretty_printers_test
KIND BOOST)
add_scylla_test(querier_cache_test
KIND SEASTAR)
add_scylla_test(query_processor_test
KIND SEASTAR)
add_scylla_test(radix_tree_test
KIND SEASTAR)
add_scylla_test(range_tombstone_list_test
KIND BOOST)
add_scylla_test(rate_limiter_test
KIND SEASTAR)
add_scylla_test(reader_concurrency_semaphore_test
KIND SEASTAR)
add_scylla_test(recent_entries_map_test
KIND SEASTAR)
add_scylla_test(repair_test
KIND SEASTAR)
add_scylla_test(restrictions_test
KIND SEASTAR)
add_scylla_test(result_utils_test
KIND SEASTAR)
add_scylla_test(reusable_buffer_test
KIND SEASTAR)
add_scylla_test(role_manager_test
KIND SEASTAR)
add_scylla_test(row_cache_test
KIND SEASTAR)
add_scylla_test(rust_test
KIND BOOST
LIBRARIES inc)
@@ -270,25 +188,17 @@ add_scylla_test(aws_errors_test
KIND BOOST)
add_scylla_test(aws_error_injection_test
KIND SEASTAR)
add_scylla_test(schema_change_test
KIND SEASTAR)
add_scylla_test(schema_changes_test
KIND SEASTAR)
add_scylla_test(schema_loader_test
KIND SEASTAR
LIBRARIES tools)
add_scylla_test(schema_registry_test
KIND SEASTAR)
add_scylla_test(secondary_index_test
KIND SEASTAR)
add_scylla_test(serialization_test
KIND BOOST)
add_scylla_test(serialized_action_test
KIND SEASTAR)
add_scylla_test(service_level_controller_test
KIND SEASTAR)
add_scylla_test(sessions_test
KIND SEASTAR)
add_scylla_test(small_vector_test
KIND SEASTAR)
add_scylla_test(snitch_reset_test
@@ -297,14 +207,10 @@ add_scylla_test(sorting_test
KIND SEASTAR)
add_scylla_test(sstable_3_x_test
KIND SEASTAR)
add_scylla_test(sstable_compaction_test
KIND SEASTAR)
add_scylla_test(sstable_conforms_to_mutation_source_test
KIND SEASTAR)
add_scylla_test(sstable_datafile_test
KIND SEASTAR)
add_scylla_test(sstable_directory_test
KIND SEASTAR)
add_scylla_test(sstable_generation_test
KIND BOOST)
add_scylla_test(sstable_move_test
@@ -315,64 +221,34 @@ add_scylla_test(sstable_partition_index_cache_test
KIND SEASTAR)
add_scylla_test(sstable_resharding_test
KIND SEASTAR)
add_scylla_test(sstable_set_test
KIND SEASTAR)
add_scylla_test(sstable_test
KIND SEASTAR)
add_scylla_test(stall_free_test
KIND SEASTAR)
add_scylla_test(statement_restrictions_test
KIND SEASTAR
LIBRARIES cql3)
add_scylla_test(storage_proxy_test
KIND SEASTAR)
add_scylla_test(string_format_test
KIND BOOST)
add_scylla_test(summary_test
KIND BOOST)
add_scylla_test(tablets_test
KIND SEASTAR)
add_scylla_test(tagged_integer_test
KIND SEASTAR)
add_scylla_test(token_metadata_test
KIND SEASTAR)
add_scylla_test(top_k_test
KIND BOOST)
add_scylla_test(tracing_test
KIND SEASTAR)
add_scylla_test(transport_test
KIND SEASTAR)
add_scylla_test(types_test
KIND SEASTAR)
add_scylla_test(user_function_test
KIND SEASTAR
LIBRARIES idl)
add_scylla_test(user_types_test
KIND SEASTAR)
add_scylla_test(utf8_test
KIND BOOST
LIBRARIES utils)
add_scylla_test(view_build_test
KIND SEASTAR)
add_scylla_test(view_complex_test
KIND SEASTAR)
add_scylla_test(view_schema_ckey_test
KIND SEASTAR)
add_scylla_test(view_schema_pkey_test
KIND SEASTAR)
add_scylla_test(view_schema_test
KIND SEASTAR)
add_scylla_test(vint_serialization_test
KIND BOOST
LIBRARIES
scylla-main
utils)
add_scylla_test(virtual_reader_test
KIND SEASTAR)
LIBRARIES
scylla-main
utils)
add_scylla_test(virtual_table_mutation_source_test
KIND SEASTAR)
add_scylla_test(virtual_table_test
KIND SEASTAR)
add_scylla_test(wasm_alloc_test
KIND SEASTAR)
add_scylla_test(wasm_test
@@ -382,6 +258,75 @@ add_scylla_test(wrapping_interval_test
add_scylla_test(address_map_test
KIND SEASTAR)
add_scylla_test(combined_tests
KIND SEASTAR
SOURCES
combined_tests.cc
aggregate_fcts_test.cc
auth_test.cc
batchlog_manager_test.cc
cache_algorithm_test.cc
castas_fcts_test.cc
cdc_test.cc
column_mapping_test.cc
commitlog_cleanup_test.cc
commitlog_test.cc
cql_auth_query_test.cc
cql_functions_test.cc
cql_query_group_test.cc
cql_query_large_test.cc
cql_query_like_test.cc
cql_query_test.cc
database_test.cc
data_listeners_test.cc
error_injection_test.cc
extensions_test.cc
filtering_test.cc
group0_cmd_merge_test.cc
group0_test.cc
index_with_paging_test.cc
json_cql_query_test.cc
large_paging_state_test.cc
loading_cache_test.cc
memtable_test.cc
multishard_combining_reader_as_mutation_source_test.cc
multishard_mutation_query_test.cc
mutation_reader_test.cc
mutation_writer_test.cc
network_topology_strategy_test.cc
per_partition_rate_limit_test.cc
querier_cache_test.cc
query_processor_test.cc
reader_concurrency_semaphore_test.cc
repair_test.cc
role_manager_test.cc
restrictions_test.cc
row_cache_test.cc
schema_change_test.cc
schema_registry_test.cc
secondary_index_test.cc
sessions_test.cc
sstable_compaction_test.cc
sstable_directory_test.cc
sstable_set_test.cc
statement_restrictions_test.cc
storage_proxy_test.cc
tablets_test.cc
tracing_test.cc
user_function_test.cc
user_types_test.cc
view_build_test.cc
view_complex_test.cc
view_schema_ckey_test.cc
view_schema_pkey_test.cc
view_schema_test.cc
virtual_reader_test.cc
virtual_table_test.cc
LIBRARIES
cql3
idl
tools
utils)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/suite.yaml")
set(scylla_tests "${scylla_tests}" PARENT_SCOPE)
endif()

View File

@@ -12,7 +12,8 @@
#include <boost/test/unit_test.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -20,6 +21,8 @@
#include "types/set.hh"
BOOST_AUTO_TEST_SUITE(aggregate_fcts_test)
namespace {
void create_table(cql_test_env& e) {
@@ -267,3 +270,5 @@ SEASTAR_TEST_CASE(test_minmax_on_set) {
}
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -21,7 +21,9 @@
#include "cql3/CqlParser.hpp"
#include "exceptions/exceptions.hh"
#include "service/raft/raft_group0_client.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
#include "test/lib/exception_utils.hh"
@@ -34,6 +36,8 @@
#include "db/config.hh"
BOOST_AUTO_TEST_SUITE(auth_test)
cql_test_config auth_on(bool with_authorizer = true) {
cql_test_config cfg;
if (with_authorizer) {
@@ -407,3 +411,5 @@ SEASTAR_TEST_CASE(test_try_describe_schema_with_internals_and_passwords_as_anony
exception_predicate::message_equals("DESCRIBE SCHEMA WITH INTERNALS AND PASSWORDS can only be issued by a superuser"));
}, auth_on(true));
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -12,7 +12,8 @@
#include <boost/test/unit_test.hpp>
#include <stdint.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include <seastar/core/future-util.hh>
@@ -24,6 +25,8 @@
#include "message/messaging_service.hh"
#include "service/storage_proxy.hh"
BOOST_AUTO_TEST_SUITE(batchlog_manager_test)
static atomic_cell make_atomic_cell(data_type dt, bytes value) {
return atomic_cell::make_live(*dt, 0, std::move(value));
};
@@ -66,3 +69,4 @@ SEASTAR_TEST_CASE(test_execute_batch) {
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -7,11 +7,14 @@
*/
#include <fmt/ranges.h>
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/log.hh"
#include "db/config.hh"
BOOST_AUTO_TEST_SUITE(cache_algorithm_test)
// These tests are slow, and tuned to a particular amount of memory
// (and --memory is ignored in debug mode).
// Hence they are not run in debug.
@@ -217,3 +220,4 @@ SEASTAR_TEST_CASE(test_index_is_cached_in_big_partition_workload) {
}
#endif
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,7 +14,8 @@
#include "utils/big_decimal.hh"
#include "exceptions/exceptions.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
#include "test/lib/exception_utils.hh"
@@ -22,6 +23,8 @@
#include <seastar/core/future-util.hh>
#include "transport/messages/result_message.hh"
BOOST_AUTO_TEST_SUITE(castas_fcts_test)
namespace {
template<typename T>
@@ -615,3 +618,5 @@ SEASTAR_TEST_CASE(test_identity_casts) {
}
// FIXME: Add test with user-defined functions after they are available.
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -8,7 +8,9 @@
#include <fmt/core.h>
#include <seastar/util/defer.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <string>
#include <boost/range/adaptor/map.hpp>
#include <fmt/ranges.h>
@@ -42,6 +44,8 @@ api::timestamp_type find_timestamp(const mutation&);
utils::UUID generate_timeuuid(api::timestamp_type);
}
BOOST_AUTO_TEST_SUITE(cdc_test)
SEASTAR_THREAD_TEST_CASE(test_find_mutation_timestamp) {
do_with_cql_env_thread([] (cql_test_env& e) {
cquery_nofail(e, "CREATE TYPE ut (a int, b int)");
@@ -373,6 +377,8 @@ SEASTAR_THREAD_TEST_CASE(test_cdc_log_schema) {
}).get();
}
} // cdc_test namespace
static std::vector<std::vector<bytes_opt>> to_bytes(const cql_transport::messages::result_message::rows& rows) {
auto rs = rows.rs().result_set().rows();
std::vector<std::vector<bytes_opt>> results;
@@ -426,6 +432,8 @@ static auto select_log(cql_test_env& e, const sstring& table_name) {
return rows;
};
namespace cdc_test {
SEASTAR_THREAD_TEST_CASE(test_primary_key_logging) {
do_with_cql_env_thread([](cql_test_env& e) {
cquery_nofail(e, "CREATE TABLE ks.tbl (pk int, pk2 int, ck int, ck2 int, s int STATIC, val int, PRIMARY KEY((pk, pk2), ck, ck2)) WITH cdc = {'enabled':'true'}");
@@ -1305,6 +1313,8 @@ SEASTAR_THREAD_TEST_CASE(test_update_insert_delete_distinction) {
}).get();
}
} // namespace cdc_test
static std::vector<std::vector<data_value>> get_result(cql_test_env& e,
const std::vector<data_type>& col_types, const sstring& query) {
auto deser = [] (const data_type& t, const bytes_opt& b) -> data_value {
@@ -1330,6 +1340,8 @@ static std::vector<std::vector<data_value>> get_result(cql_test_env& e,
return res;
}
namespace cdc_test {
SEASTAR_THREAD_TEST_CASE(test_change_splitting) {
do_with_cql_env_thread([](cql_test_env& e) {
using oper_ut = std::underlying_type_t<cdc::operation>;
@@ -2077,3 +2089,5 @@ SEASTAR_THREAD_TEST_CASE(test_image_deleted_column) {
perform_test(true);
}).get();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -6,7 +6,8 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -15,6 +16,8 @@
#include "db/schema_tables.hh"
#include "transport/messages/result_message.hh"
BOOST_AUTO_TEST_SUITE(column_mapping_test)
SEASTAR_TEST_CASE(test_column_mapping_persistence) {
return do_with_cql_env_thread([] (cql_test_env& e) {
// Check that column mapping history is empty initially
@@ -84,3 +87,5 @@ SEASTAR_TEST_CASE(test_column_mapping_ttl_check) {
BOOST_REQUIRE(ttl_val > 0);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -0,0 +1,9 @@
/*
* Copyright (C) 2024-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "test/lib/scylla_test_case.hh"

View File

@@ -7,13 +7,17 @@
*/
#include <fmt/ranges.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "db/commitlog/commitlog_replayer.hh"
#include "db/commitlog/commitlog.hh"
#include "db/config.hh"
#include "db/system_keyspace.hh"
BOOST_AUTO_TEST_SUITE(commitlog_cleanup_test)
// Test that `canonical_token_range(tr)` contains the same tokens as `tr`.
SEASTAR_TEST_CASE(test_canonical_token_range) {
const int64_t arbitrary_token = -42;
@@ -219,3 +223,5 @@ SEASTAR_TEST_CASE(test_commitlog_cleanup_record_gc) {
BOOST_REQUIRE_EQUAL(get_num_records(), 1);
}, cfg);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -19,7 +19,8 @@
#include <fmt/ranges.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/core/coroutine.hh>
#include <seastar/core/future-util.hh>
#include <seastar/core/do_with.hh>
@@ -47,6 +48,8 @@
#include "test/lib/key_utils.hh"
#include "test/lib/test_utils.hh"
BOOST_AUTO_TEST_SUITE(commitlog_test)
using namespace db;
static future<> cl_test(commitlog::config cfg, noncopyable_function<future<> (commitlog&)> f) {
@@ -2056,3 +2059,5 @@ SEASTAR_TEST_CASE(test_commitlog_buffer_size_counter) {
co_await log.shutdown();
co_await log.clear();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,7 +14,9 @@
#include <seastar/core/sstring.hh>
#include <seastar/core/thread.hh>
#include <seastar/util/defer.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/test_utils.hh"
#include "auth/authenticated_user.hh"
@@ -27,6 +29,8 @@
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
BOOST_AUTO_TEST_SUITE(cql_auth_query_test)
static const auto alice = std::string_view("alice");
static const auto bob = std::string_view("bob");
@@ -339,3 +343,5 @@ SEASTAR_TEST_CASE(modify_table_with_index) {
{{int32_type->decompose(14)}});
}, db_config_with_auth());
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -16,7 +16,8 @@
#include <seastar/net/inet_address.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -30,6 +31,8 @@
#include "types/set.hh"
#include "schema/schema_builder.hh"
BOOST_AUTO_TEST_SUITE(cql_functions_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_functions) {
@@ -408,3 +411,5 @@ SEASTAR_TEST_CASE(test_aggregate_functions_map_type) {
).test_min_max_count();
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,7 +14,8 @@
#include <seastar/net/inet_address.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -22,6 +23,8 @@
#include <seastar/core/future-util.hh>
#include "test/lib/exception_utils.hh"
BOOST_AUTO_TEST_SUITE(cql_query_group_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_group_by_syntax) {
@@ -233,3 +236,5 @@ SEASTAR_TEST_CASE(test_group_by_null_clustering) {
return make_ready_future<>();
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,7 +14,8 @@
#include <fmt/ranges.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -29,6 +30,8 @@
#include "compaction/compaction_manager.hh"
#include "schema/schema_builder.hh"
BOOST_AUTO_TEST_SUITE(cql_query_large_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_large_partitions) {
@@ -195,3 +198,5 @@ SEASTAR_TEST_CASE(test_insert_large_collection_values) {
});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -12,7 +12,8 @@
#include <boost/test/unit_test.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -20,6 +21,8 @@
#include <seastar/core/future-util.hh>
#include "test/lib/exception_utils.hh"
BOOST_AUTO_TEST_SUITE(cql_query_like_test)
using namespace std::literals::chrono_literals;
namespace {
@@ -178,3 +181,5 @@ SEASTAR_TEST_CASE(test_like_operator_on_token) {
exception_predicate::message_contains("token function"));
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -19,7 +19,8 @@
#include <seastar/net/inet_address.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -53,6 +54,7 @@
#include "replica/schema_describe_helper.hh"
BOOST_AUTO_TEST_SUITE(cql_query_test)
using namespace std::literals::chrono_literals;
@@ -4735,6 +4737,8 @@ SEASTAR_TEST_CASE(test_impossible_where) {
});
}
} // cql_query_test namespace
// FIXME: copy-pasta
static bool has_more_pages(::shared_ptr<cql_transport::messages::result_message> res) {
auto rows = dynamic_pointer_cast<cql_transport::messages::result_message::rows>(res);
@@ -4758,6 +4762,8 @@ static lw_shared_ptr<service::pager::paging_state> extract_paging_state(::shared
return make_lw_shared<service::pager::paging_state>(*paging_state);
};
namespace cql_query_test {
SEASTAR_THREAD_TEST_CASE(test_query_limit) {
cql_test_config cfg;
@@ -5921,3 +5927,5 @@ SEASTAR_TEST_CASE(test_schema_change_events) {
BOOST_REQUIRE(dynamic_pointer_cast<event_t>(res));
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -8,13 +8,16 @@
#include <boost/test/unit_test.hpp>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/log.hh"
#include "readers/filtering.hh"
#include "db/data_listeners.hh"
BOOST_AUTO_TEST_SUITE(data_listeners_test)
using namespace std::chrono_literals;
class table_listener : public db::data_listener {
@@ -111,3 +114,5 @@ SEASTAR_TEST_CASE(test_dlistener_t2) {
BOOST_REQUIRE_EQUAL(0, res.write);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -13,7 +13,8 @@
#include <seastar/core/coroutine.hh>
#include <seastar/util/file.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <utility>
#include <fmt/ranges.h>
@@ -54,10 +55,10 @@
using namespace std::chrono_literals;
using namespace sstables;
class database_test {
class database_test_wrapper {
replica::database& _db;
public:
explicit database_test(replica::database& db) : _db(db) { }
explicit database_test_wrapper(replica::database& db) : _db(db) { }
reader_concurrency_semaphore& get_user_read_concurrency_semaphore() {
return _db._read_concurrency_sem;
@@ -99,6 +100,8 @@ future<> do_with_cql_env_and_compaction_groups(std::function<void(cql_test_env&)
}
}
BOOST_AUTO_TEST_SUITE(database_test)
SEASTAR_TEST_CASE(test_safety_after_truncate) {
auto cfg = make_shared<db::config>();
cfg->auto_snapshot.set(false);
@@ -1125,11 +1128,11 @@ SEASTAR_THREAD_TEST_CASE(reader_concurrency_semaphore_selection_test) {
destroy_scheduling_group(unknown_scheduling_group).get();
});
const auto user_semaphore = std::mem_fn(&database_test::get_user_read_concurrency_semaphore);
const auto system_semaphore = std::mem_fn(&database_test::get_system_read_concurrency_semaphore);
const auto streaming_semaphore = std::mem_fn(&database_test::get_streaming_read_concurrency_semaphore);
const auto user_semaphore = std::mem_fn(&database_test_wrapper::get_user_read_concurrency_semaphore);
const auto system_semaphore = std::mem_fn(&database_test_wrapper::get_system_read_concurrency_semaphore);
const auto streaming_semaphore = std::mem_fn(&database_test_wrapper::get_streaming_read_concurrency_semaphore);
std::vector<std::pair<scheduling_group, std::function<reader_concurrency_semaphore&(database_test&)>>> scheduling_group_and_expected_semaphore{
std::vector<std::pair<scheduling_group, std::function<reader_concurrency_semaphore&(database_test_wrapper&)>>> scheduling_group_and_expected_semaphore{
{default_scheduling_group(), system_semaphore}
};
@@ -1146,7 +1149,7 @@ SEASTAR_THREAD_TEST_CASE(reader_concurrency_semaphore_selection_test) {
do_with_cql_env_and_compaction_groups([&scheduling_group_and_expected_semaphore] (cql_test_env& e) {
auto& db = e.local_db();
database_test tdb(db);
database_test_wrapper tdb(db);
for (const auto& [sched_group, expected_sem_getter] : scheduling_group_and_expected_semaphore) {
with_scheduling_group(sched_group, [&db, sched_group = sched_group, expected_sem_ptr = &expected_sem_getter(tdb)] {
auto& sem = db.get_reader_concurrency_semaphore();
@@ -1196,7 +1199,7 @@ SEASTAR_THREAD_TEST_CASE(max_result_size_for_query_selection_test) {
do_with_cql_env_and_compaction_groups([&scheduling_group_and_expected_max_result_size] (cql_test_env& e) {
auto& db = e.local_db();
database_test tdb(db);
database_test_wrapper tdb(db);
for (const auto& [sched_group, expected_max_size] : scheduling_group_and_expected_max_result_size) {
with_scheduling_group(sched_group, [&db, sched_group = sched_group, expected_max_size = expected_max_size] {
const auto max_size = db.get_query_max_result_size();
@@ -1418,7 +1421,7 @@ SEASTAR_TEST_CASE(database_drop_column_family_clears_querier_cache) {
auto q = query::querier(
tbl.as_mutation_source(),
tbl.schema(),
database_test(db).get_user_read_concurrency_semaphore().make_tracking_only_permit(s, "test", db::no_timeout, {}),
database_test_wrapper(db).get_user_read_concurrency_semaphore().make_tracking_only_permit(s, "test", db::no_timeout, {}),
query::full_partition_range,
s->full_slice(),
nullptr);
@@ -1513,3 +1516,5 @@ SEASTAR_TEST_CASE(mutation_dump_generated_schema_deterministic_id_version) {
return make_ready_future<>();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -9,7 +9,8 @@
#include <seastar/testing/on_internal_error.hh>
#include "test/lib/cql_test_env.hh"
#include <seastar/core/manual_clock.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/rpc/rpc_types.hh>
#include "utils/error_injection.hh"
#include "db/timeout_clock.hh"
@@ -19,6 +20,8 @@
#include "utils/log.hh"
#include <chrono>
BOOST_AUTO_TEST_SUITE(error_injection_test)
using namespace std::literals::chrono_literals;
static logging::logger flogger("error_injection_test");
@@ -500,3 +503,5 @@ SEASTAR_TEST_CASE(test_inject_cql) {
});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -12,7 +12,8 @@
#include <seastar/core/future-util.hh>
#include <seastar/core/sleep.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -26,6 +27,8 @@
#include "transport/messages/result_message.hh"
#include "utils/overloaded_functor.hh"
BOOST_AUTO_TEST_SUITE(extensions_test)
class dummy_ext : public schema_extension {
public:
dummy_ext(bytes b) : _bytes(b) {}
@@ -206,3 +209,5 @@ SEASTAR_TEST_CASE(test_extension_remove) {
});
}, ::make_shared<db::config>(ext));
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -15,7 +15,8 @@
#include <seastar/net/inet_address.hh>
#include "test/lib/eventually.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -26,6 +27,8 @@
#include "types/set.hh"
#include "types/map.hh"
BOOST_AUTO_TEST_SUITE(filtering_test)
using namespace std::literals::chrono_literals;
@@ -1152,3 +1155,5 @@ SEASTAR_TEST_CASE(test_filtering) {
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -8,7 +8,8 @@
#include <fmt/ranges.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "db/config.hh"
@@ -24,6 +25,8 @@
#include "utils/error_injection.hh"
#include "test/lib/expr_test_utils.hh"
BOOST_AUTO_TEST_SUITE(group0_cmd_merge_test)
const auto OLD_TIMEUUID = utils::UUID_gen::get_time_UUID(std::chrono::system_clock::time_point::min());
static service::group0_command create_command(utils::UUID id) {
@@ -120,3 +123,5 @@ SEASTAR_TEST_CASE(test_group0_cmd_merge) {
}, cfg);
#endif
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -6,7 +6,8 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_assertions.hh"
#include <seastar/core/coroutine.hh>
@@ -32,6 +33,8 @@ static future<size_t> get_history_size(cql_test_env& e) {
co_return (co_await fetch_rows(e, "select * from system.group0_history")).size();
}
BOOST_AUTO_TEST_SUITE(group0_test)
SEASTAR_TEST_CASE(test_abort_server_on_background_error) {
#ifndef SCYLLA_ENABLE_ERROR_INJECTION
std::cerr << "Skipping test as it depends on error injection. Please run in mode where it's enabled (debug,dev).\n";
@@ -341,3 +344,5 @@ SEASTAR_TEST_CASE(test_group0_batch) {
co_await std::move(mc1).commit(rclient, as, ::service::raft_timeout{});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -6,7 +6,8 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
#include "test/lib/eventually.hh"
@@ -14,6 +15,8 @@
#include "cql3/query_processor.hh"
#include "transport/messages/result_message.hh"
BOOST_AUTO_TEST_SUITE(index_with_paging_test)
SEASTAR_TEST_CASE(test_index_with_paging) {
return do_with_cql_env_thread([] (auto& e) {
e.execute_cql("CREATE TABLE tab (pk int, ck text, v int, v2 int, v3 text, PRIMARY KEY (pk, ck))").get();
@@ -102,3 +105,5 @@ SEASTAR_TEST_CASE(test_index_with_paging_with_base_short_read_no_ck) {
});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,7 +14,8 @@
#include <seastar/net/inet_address.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -27,6 +28,8 @@
#include "types/list.hh"
#include "utils/rjson.hh"
BOOST_AUTO_TEST_SUITE(json_cql_query_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_select_json_types) {
@@ -788,3 +791,5 @@ SEASTAR_TEST_CASE(test_unpack_decimal){
assert_that(msg).is_rows().with_rows({{int32_type->decompose(1), lt_val}});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -9,12 +9,15 @@
#include "utils/assert.hh"
#include <boost/test/unit_test.hpp>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "transport/messages/result_message.hh"
#include "types/types.hh"
BOOST_AUTO_TEST_SUITE(large_paging_state_test)
static lw_shared_ptr<service::pager::paging_state> extract_paging_state(::shared_ptr<cql_transport::messages::result_message> res) {
auto rows = dynamic_pointer_cast<cql_transport::messages::result_message::rows>(res);
auto paging_state = rows->rs().get_metadata().paging_state();
@@ -114,3 +117,5 @@ SEASTAR_TEST_CASE(test_use_high_bits_of_remaining_rows_in_paging_state_filtering
}
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -20,7 +20,8 @@
#include "seastarx.hh"
#include "test/lib/eventually.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/tmpdir.hh"
#include "test/lib/log.hh"
@@ -31,6 +32,8 @@
#include <numeric>
#include <random>
BOOST_AUTO_TEST_SUITE(loading_cache_test)
/// Get a random integer in the [0, max) range.
/// \param max bound of the random value range
/// \return The uniformly distributed random integer from the [0, \ref max) range.
@@ -851,3 +854,5 @@ SEASTAR_TEST_CASE(test_prepared_statement_small_cache) {
}
}, small_cache_config);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -12,7 +12,8 @@
#include "db/config.hh"
#include "utils/assert.hh"
#include "utils/UUID_gen.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "schema/schema_builder.hh"
#include <seastar/util/closeable.hh>
@@ -42,6 +43,8 @@
#include "db/config.hh"
#include "service/storage_service.hh"
BOOST_AUTO_TEST_SUITE(memtable_test)
using namespace std::literals::chrono_literals;
static api::timestamp_type next_timestamp() {
@@ -1481,3 +1484,5 @@ SEASTAR_TEST_CASE(test_ext_config_exceptions_in_flush_on_sstable_open) {
[] { throw db::extension_storage_misconfigured(get_name()); }
);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -12,7 +12,8 @@
#include <seastar/core/thread.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/mutation_source_test.hh"
#include "test/lib/cql_test_env.hh"
@@ -23,6 +24,8 @@
#include "schema/schema_registry.hh"
#include "readers/forwardable_v2.hh"
BOOST_AUTO_TEST_SUITE(multishard_combining_reader_as_mutation_source_test)
// It has to be a container that does not invalidate pointers
static std::list<dummy_sharder> keep_alive_sharder;
@@ -154,3 +157,5 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_with_tiny_buffer_rever
return make_ready_future<>();
}).get();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -28,7 +28,9 @@
#include "db/paxos_grace_seconds_extension.hh"
#include "db/per_partition_rate_limit_extension.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <fmt/ranges.h>
#include <utility>
@@ -189,6 +191,8 @@ static void require_eventually_empty_caches(distributed<replica::database>& db,
tests::require(eventually_true(aggregated_population_is_zero));
}
BOOST_AUTO_TEST_SUITE(multishard_mutation_query_test)
// Best run with SMP>=2
SEASTAR_THREAD_TEST_CASE(test_abandoned_read) {
do_with_cql_env_thread([] (cql_test_env& env) -> future<> {
@@ -222,6 +226,8 @@ SEASTAR_THREAD_TEST_CASE(test_abandoned_read) {
}, cql_config_with_extensions()).get();
}
} // multishard_mutation_query_test namespace
static std::vector<mutation> read_all_partitions_one_by_one(distributed<replica::database>& db, schema_ptr s, std::vector<dht::decorated_key> pkeys,
const query::partition_slice& slice) {
const auto& sharder = s->get_sharder();
@@ -527,6 +533,8 @@ void check_results_are_equal(std::vector<mutation>& results1, std::vector<mutati
}
}
namespace multishard_mutation_query_test {
// Best run with SMP>=2
SEASTAR_THREAD_TEST_CASE(test_read_all) {
do_with_cql_env_thread([] (cql_test_env& env) -> future<> {
@@ -809,6 +817,8 @@ SEASTAR_THREAD_TEST_CASE(test_read_reversed) {
}, cql_config_with_extensions()).get();
}
} // multishard_mutation_query_test namespace
namespace {
class buffer_ostream {
@@ -1107,6 +1117,8 @@ run_fuzzy_test_workload(fuzzy_test_config cfg, distributed<replica::database>& d
} // namespace
namespace multishard_mutation_query_test {
SEASTAR_THREAD_TEST_CASE(fuzzy_test) {
auto cql_cfg = cql_config_with_extensions();
cql_cfg.db_config->enable_commitlog(false);
@@ -1158,3 +1170,5 @@ SEASTAR_THREAD_TEST_CASE(fuzzy_test) {
return make_ready_future<>();
}, cql_cfg).get();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -22,7 +22,8 @@
#include <seastar/util/closeable.hh>
#include "sstables/generation_type.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/eventually.hh"
#include "test/lib/mutation_assertions.hh"
@@ -66,6 +67,8 @@
#include "readers/evictable.hh"
#include "readers/queue.hh"
BOOST_AUTO_TEST_SUITE(mutation_reader_test)
static schema_ptr make_schema() {
return schema_builder("ks", "cf")
.with_column("pk", bytes_type, column_kind::partition_key)
@@ -4623,3 +4626,5 @@ SEASTAR_TEST_CASE(test_multishard_reader_buffer_hint_small_partitions) {
}
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -8,7 +8,8 @@
#include <fmt/ranges.h>
#include <seastar/core/thread.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <seastar/util/bool_class.hh>
#include <seastar/util/closeable.hh>
@@ -36,6 +37,8 @@
#include "readers/generating_v2.hh"
#include "readers/combined.hh"
BOOST_AUTO_TEST_SUITE(mutation_writer_test)
using namespace mutation_writer;
struct generate_error_tag { };
@@ -590,3 +593,5 @@ SEASTAR_THREAD_TEST_CASE(test_token_group_based_splitting_mutation_writer) {
assert_that_segregator_produces_correct_data(buckets, muts, semaphore.make_permit(), random_schema);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -16,7 +16,8 @@
#include "utils/sequenced_set.hh"
#include "utils/to_string.hh"
#include "locator/network_topology_strategy.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <seastar/core/sstring.hh>
#include "utils/log.hh"
@@ -422,6 +423,7 @@ void heavy_origin_test() {
full_ring_check(ring_points, config_options, ars_ptr, stm.get());
}
BOOST_AUTO_TEST_SUITE(network_topology_strategy_test)
SEASTAR_THREAD_TEST_CASE(NetworkTopologyStrategy_simple) {
return simple_test();
@@ -940,6 +942,8 @@ SEASTAR_TEST_CASE(test_invalid_dcs) {
});
}
} // namespace network_topology_strategy_test
namespace locator {
void topology::test_compare_endpoints(const locator::host_id& address, const locator::host_id& a1, const locator::host_id& a2) const {
@@ -1003,6 +1007,8 @@ void topology::test_sort_by_proximity(const locator::host_id& address, const hos
} // namespace locator
namespace network_topology_strategy_test {
SEASTAR_THREAD_TEST_CASE(test_topology_compare_endpoints) {
locator::token_metadata::config tm_cfg;
auto my_address = gms::inet_address("localhost");
@@ -1210,3 +1216,5 @@ SEASTAR_THREAD_TEST_CASE(test_topology_tracks_local_node) {
BOOST_REQUIRE(n1->dc_rack() == ip1_dc_rack_v2);
BOOST_REQUIRE(stm.get()->get_topology().get_location() == ip1_dc_rack_v2);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -1,7 +1,8 @@
#include <chrono>
#include <cstdint>
#include <seastar/core/coroutine.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -9,6 +10,8 @@
#include "mutation/mutation.hh"
#include "service/storage_proxy.hh"
BOOST_AUTO_TEST_SUITE(per_partition_rate_limit_test)
SEASTAR_TEST_CASE(test_internal_operation_filtering) {
return do_with_cql_env_thread([] (cql_test_env& e) -> future<> {
// The test requires at least two shards
@@ -106,4 +109,6 @@ SEASTAR_TEST_CASE(test_internal_operation_filtering) {
return make_ready_future<>();
});
}
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -20,12 +20,16 @@
#include <fmt/ranges.h>
#include <seastar/core/sleep.hh>
#include <seastar/core/thread.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <seastar/util/closeable.hh>
#include "readers/from_mutations_v2.hh"
#include "readers/empty_v2.hh"
BOOST_AUTO_TEST_SUITE(querier_cache_test)
using namespace std::chrono_literals;
class dummy_result_builder {
@@ -835,3 +839,5 @@ SEASTAR_THREAD_TEST_CASE(test_semaphore_mismatch) {
.no_evictions();
}
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,7 +14,8 @@
#include <iterator>
#include <stdint.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
#include "test/lib/test_utils.hh"
@@ -25,6 +26,8 @@
#include "cql3/query_processor.hh"
#include "cql3/untyped_result_set.hh"
BOOST_AUTO_TEST_SUITE(query_processor_test)
SEASTAR_TEST_CASE(test_execute_internal_insert) {
return do_with_cql_env([] (auto& e) {
auto& qp = e.local_qp();
@@ -354,3 +357,5 @@ SEASTAR_TEST_CASE(test_select_full_scan_metrics) {
BOOST_CHECK_EQUAL(stat_ps8, qp.get_cql_stats().select_partition_range_scan);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -25,7 +25,8 @@
#include <fmt/ranges.h>
#include <seastar/core/coroutine.hh>
#include <seastar/coroutine/parallel_for_each.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <boost/test/unit_test.hpp>
#include "readers/empty_v2.hh"
@@ -33,6 +34,8 @@
#include "replica/database.hh" // new_reader_base_cost is there :(
#include "db/config.hh"
BOOST_AUTO_TEST_SUITE(reader_concurrency_semaphore_test)
SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_clear_inactive_reads) {
simple_schema s;
std::vector<reader_permit> permits;
@@ -683,6 +686,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_stop_waits_on_permits
}
} // reader_concurrency_semaphore_test namespace
static void require_can_admit(schema_ptr schema, reader_concurrency_semaphore& semaphore, bool expected_can_admit, const char* description,
seastar::compat::source_location sl = seastar::compat::source_location::current()) {
testlog.trace("Running admission scenario {}, with exepcted_can_admit={}", description, expected_can_admit);
@@ -711,6 +716,8 @@ static void require_can_admit(schema_ptr schema, reader_concurrency_semaphore& s
}
};
namespace reader_concurrency_semaphore_test {
SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_admission) {
simple_schema s;
const auto schema = s.schema();
@@ -1209,6 +1216,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_set_resources) {
permit3_fut.get();
}
} // namespace reader_concurrency_semaphore_test
namespace {
class allocating_reader {
@@ -1345,6 +1354,8 @@ public:
} //anonymous namespace
namespace reader_concurrency_semaphore_test {
// Check that the memory consumption limiting mechanism doesn't leak any
// resources or cause any internal consistencies in the semaphore.
SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_memory_limit_no_leaks) {
@@ -2139,3 +2150,5 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_live_update_cpu_concu
}
require_can_admit(true, "!need_cpu");
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -18,11 +18,14 @@
#include "test/lib/cql_test_env.hh"
#include "service/storage_proxy.hh"
#include "test/lib/reader_concurrency_semaphore.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/sstable_utils.hh"
#include "readers/mutation_fragment_v1_stream.hh"
#include "schema/schema_registry.hh"
BOOST_AUTO_TEST_SUITE(repair_test)
// Helper mutation_fragment_queue that stores the received stream of
// mutation_fragments in a passed in deque of mutation_fragment_v2.
// This allows easy reader construction to verify what was sent to the queue
@@ -269,3 +272,5 @@ SEASTAR_TEST_CASE(repair_rows_size_considers_external_memory) {
BOOST_REQUIRE_EQUAL(row_with_boundary.size(), fmf_size + boundary.pk.external_memory_usage() + boundary.position.external_memory_usage() + sizeof(repair_row));
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -8,7 +8,9 @@
#include <fmt/format.h>
#include <fmt/ranges.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "cql3/cql_config.hh"
#include "cql3/values.hh"
@@ -21,6 +23,8 @@
#include "types/map.hh"
#include "types/set.hh"
BOOST_AUTO_TEST_SUITE(restrictions_test)
namespace {
using seastar::compat::source_location;
@@ -1046,3 +1050,5 @@ SEASTAR_THREAD_TEST_CASE(strict_is_not_null_in_views_default_value) {
auto cfg = make_shared<db::config>();
BOOST_REQUIRE(cfg->strict_is_not_null_in_views() == db::tri_mode_restriction_t::mode::WARN);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -11,10 +11,13 @@
#include "auth/standard_role_manager.hh"
#include "service/raft/raft_group0_client.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/test_utils.hh"
#include "test/lib/cql_test_env.hh"
BOOST_AUTO_TEST_SUITE(role_manager_test)
auto make_manager(cql_test_env& env) {
auto stop_role_manager = [] (auth::standard_role_manager* m) {
m->stop().get();
@@ -240,3 +243,5 @@ SEASTAR_TEST_CASE(alter_role) {
});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -13,7 +13,8 @@
#include <seastar/util/alloc_failure_injector.hh>
#include <seastar/util/closeable.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/mutation_assertions.hh"
#include "test/lib/mutation_reader_assertions.hh"
#include "test/lib/mutation_source_test.hh"
@@ -126,6 +127,8 @@ void verify_has(row_cache& cache, const mutation& m) {
assert_that(std::move(reader)).next_mutation().is_equal_to(m);
}
BOOST_AUTO_TEST_SUITE(row_cache_test)
SEASTAR_TEST_CASE(test_cache_delegates_to_underlying) {
return seastar::async([] {
auto s = make_schema();
@@ -2133,6 +2136,8 @@ SEASTAR_TEST_CASE(test_tombstone_merging_in_partial_partition) {
});
}
} // row_cache_test namespace
static void consume_all(mutation_reader& rd) {
while (auto mfopt = rd().get()) {}
}
@@ -2160,6 +2165,8 @@ static void apply(row_cache& cache, memtable_snapshot_source& underlying, replic
cache.update(row_cache::external_updater([&] { underlying.apply(std::move(mt1)); }), m).get();
}
namespace row_cache_test {
SEASTAR_TEST_CASE(test_readers_get_all_data_after_eviction) {
return seastar::async([] {
simple_schema table;
@@ -4892,3 +4899,5 @@ SEASTAR_THREAD_TEST_CASE(test_reproduce_18045) {
auto close_rd = deferred_close(rd);
read_mutation_from_mutation_reader(rd).get();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -10,7 +10,8 @@
#include <iostream>
#include <fmt/ranges.h>
#include <seastar/core/thread.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/util/defer.hh>
#include <boost/range/algorithm/copy.hpp>
@@ -32,6 +33,8 @@
#include "test/lib/log.hh"
#include "cdc/cdc_extension.hh"
BOOST_AUTO_TEST_SUITE(schema_change_test)
static cql_test_config run_with_raft_recovery_config() {
cql_test_config c;
c.run_with_raft_recovery = true;
@@ -1158,3 +1161,5 @@ SEASTAR_TEST_CASE(test_system_schema_version_is_stable) {
BOOST_REQUIRE_EQUAL(s->version(), table_schema_version(utils::UUID("9621f170-f101-3459-a8d3-f342c83ad86e")));
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -9,7 +9,8 @@
#include <seastar/core/thread.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "data_dictionary/user_types_metadata.hh"
#include "schema/schema_registry.hh"
@@ -23,6 +24,8 @@
#include "test/lib/cql_test_env.hh"
#include "gms/feature_service.hh"
BOOST_AUTO_TEST_SUITE(schema_registry_test)
static bytes random_column_name() {
return to_bytes(to_hex(make_blob(32)));
}
@@ -254,3 +257,5 @@ SEASTAR_THREAD_TEST_CASE(test_table_is_attached) {
BOOST_REQUIRE_THROW(learned_s1->table(), replica::no_such_column_family);
}).get();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -11,7 +11,8 @@
#include "test/lib/cql_assertions.hh"
#include "test/lib/eventually.hh"
#include "test/lib/exception_utils.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/select_statement_utils.hh"
#include "transport/messages/result_message.hh"
#include "service/pager/paging_state.hh"
@@ -22,6 +23,8 @@
#include "utils/assert.hh"
#include "utils/error_injection.hh"
BOOST_AUTO_TEST_SUITE(secondary_index_test)
using namespace std::chrono_literals;
SEASTAR_TEST_CASE(test_secondary_index_regular_column_query) {
@@ -2002,3 +2005,5 @@ SEASTAR_TEST_CASE(test_returning_failure_from_ghost_rows_deletion) {
}
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -7,7 +7,8 @@
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/random_utils.hh"
#include "test/lib/cql_test_env.hh"
@@ -15,6 +16,8 @@
#include "service/session.hh"
BOOST_AUTO_TEST_SUITE(sessions_test)
using namespace service;
SEASTAR_TEST_CASE(test_default_session_always_exists) {
@@ -92,3 +95,5 @@ SEASTAR_TEST_CASE(test_session_closing) {
BOOST_REQUIRE_THROW(mgr.enter_session(id3), std::runtime_error);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -20,7 +20,8 @@
#include "sstables/sstables.hh"
#include "sstables/compress.hh"
#include "compaction/compaction.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "schema/schema.hh"
#include "schema/schema_builder.hh"
@@ -57,7 +58,6 @@
#include <ftw.h>
#include <unistd.h>
#include <boost/icl/interval_map.hpp>
#include <seastar/testing/test_case.hh>
#include "test/lib/test_services.hh"
#include "test/lib/cql_test_env.hh"
#include "test/lib/reader_concurrency_semaphore.hh"
@@ -72,6 +72,8 @@
#include "utils/assert.hh"
#include "utils/pretty_printers.hh"
BOOST_AUTO_TEST_SUITE(sstable_compaction_test)
namespace fs = std::filesystem;
using namespace sstables;
@@ -6090,3 +6092,5 @@ SEASTAR_TEST_CASE(splitting_compaction_test) {
std::runtime_error);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -12,7 +12,9 @@
#include <seastar/core/sstring.hh>
#include <seastar/util/file.hh>
#include "sstables/generation_type.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "sstables/shared_sstable.hh"
#include "sstables/sstable_directory.hh"
#include "replica/distributed_loader.hh"
@@ -163,6 +165,8 @@ static void with_sstable_directory(sharded<replica::database>& db,
func(sstdir);
}
BOOST_AUTO_TEST_SUITE(sstable_directory_test)
SEASTAR_TEST_CASE(sstable_directory_test_table_simple_empty_directory_scan) {
return sstables::test_env::do_with_async([] (test_env& env) {
auto& dir = env.tempdir();
@@ -838,3 +842,5 @@ SEASTAR_TEST_CASE(test_pending_log_garbage_collection) {
}
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -7,7 +7,8 @@
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <fmt/ranges.h>
#include "db/config.hh"
@@ -22,6 +23,8 @@
#include "test/lib/sstable_utils.hh"
#include "readers/from_mutations_v2.hh"
BOOST_AUTO_TEST_SUITE(sstable_set_test)
using namespace sstables;
static sstables::sstable_set make_sstable_set(schema_ptr schema, lw_shared_ptr<sstable_list> all = {}, bool use_level_metadata = true) {
@@ -197,3 +200,5 @@ SEASTAR_TEST_CASE(test_tablet_sstable_set_copy_ctor) {
}, std::move(cfg));
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -7,7 +7,8 @@
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <vector>
@@ -20,6 +21,8 @@
#include "test/lib/cql_test_env.hh"
#include "test/lib/test_utils.hh"
BOOST_AUTO_TEST_SUITE(statement_restrictions_test)
using namespace cql3;
namespace {
@@ -515,3 +518,5 @@ BOOST_AUTO_TEST_CASE(expression_extract_column_restrictions) {
assert_expr_vec_eq(restrictions::extract_single_column_restrictions_for_column(big_where_expr, col_r3),
{});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -9,13 +9,17 @@
#include <fmt/ranges.h>
#include <seastar/core/thread.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "service/storage_proxy.hh"
#include "query_ranges_to_vnodes.hh"
#include "schema/schema_builder.hh"
BOOST_AUTO_TEST_SUITE(storage_proxy_test)
// Returns random keys sorted in ring order.
// The schema must have a single bytes_type partition key column.
static std::vector<dht::ring_position> make_ring(schema_ptr s, int n_keys) {
@@ -131,3 +135,5 @@ SEASTAR_THREAD_TEST_CASE(test_split_stats) {
stats1->register_metrics_for("DC1", ep1);
stats2->register_metrics_for("DC1", ep1);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -9,7 +9,8 @@
#include <seastar/core/shard_id.hh>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/random_utils.hh"
#include <fmt/ranges.h>
#include <seastar/testing/thread_test_case.hh>
@@ -37,6 +38,8 @@
#include <boost/regex.hpp>
BOOST_AUTO_TEST_SUITE(tablets_test)
using namespace locator;
using namespace replica;
using namespace service;
@@ -3649,3 +3652,4 @@ SEASTAR_TEST_CASE(test_recognition_of_deprecated_name_for_resize_transition) {
BOOST_REQUIRE_EQUAL(service::transition_state_from_string("tablet resize finalization"), transition_state::tablet_resize_finalization);
return make_ready_future<>();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -6,13 +6,16 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "tracing/tracing.hh"
#include "tracing/trace_state.hh"
#include "test/lib/cql_test_env.hh"
BOOST_AUTO_TEST_SUITE(tracing_test)
future<> do_with_tracing_env(std::function<future<>(cql_test_env&)> func, cql_test_config cfg_in = {}) {
return do_with_cql_env_thread([func](auto &env) {
sharded<tracing::tracing>& tracing = tracing::tracing::tracing_instance();
@@ -80,3 +83,5 @@ SEASTAR_TEST_CASE(tracing_slow_query_fast_mode) {
return make_ready_future<>();
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -6,7 +6,8 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <fmt/ranges.h>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_assertions.hh"
@@ -23,6 +24,8 @@
#include "test/lib/exception_utils.hh"
#include "test/lib/test_utils.hh"
BOOST_AUTO_TEST_SUITE(user_function_test)
using ire = exceptions::invalid_request_exception;
using exception_predicate::message_equals;
using exception_predicate::message_contains;
@@ -1103,3 +1106,5 @@ SEASTAR_TEST_CASE(test_user_function_filtering) {
std::runtime_error, message_contains("User function cannot be executed in this context"));
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -6,7 +6,8 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -21,6 +22,8 @@
#include <fmt/ranges.h>
#include <boost/algorithm/string/join.hpp>
BOOST_AUTO_TEST_SUITE(user_types_test)
// Specifies that the given 'cql' query fails with the 'msg' message.
// Requires a cql_test_env. The caller must be inside thread.
#define REQUIRE_INVALID(e, cql, msg) \
@@ -671,3 +674,5 @@ SEASTAR_TEST_CASE(test_cql3_name_without_frozen) {
BOOST_REQUIRE(list_type_ptr->cql3_type_name_without_frozen() == list_type_name);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -17,7 +17,8 @@
#include "db/config.hh"
#include "cql3/query_options.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <seastar/util/closeable.hh>
@@ -38,6 +39,8 @@
#include "readers/from_mutations_v2.hh"
#include "readers/evictable.hh"
BOOST_AUTO_TEST_SUITE(view_build_test)
using namespace std::literals::chrono_literals;
schema_ptr test_table_schema() {
@@ -1007,3 +1010,5 @@ SEASTAR_THREAD_TEST_CASE(test_view_update_generator_buffering_with_empty_mutatio
vuc.consume_end_of_stream();
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -14,13 +14,16 @@
#include "db/view/view_builder.hh"
#include "compaction/compaction_manager.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
#include "test/lib/eventually.hh"
#include "db/config.hh"
BOOST_AUTO_TEST_SUITE(view_complex_test)
using namespace std::literals::chrono_literals;
// This test checks various cases where a base table row disappears - or does
@@ -1748,3 +1751,5 @@ SEASTAR_TEST_CASE(test_3362_row_deletion_2) {
});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -10,12 +10,15 @@
#include <boost/test/unit_test.hpp>
#include <boost/range/adaptor/map.hpp>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
#include "test/lib/eventually.hh"
BOOST_AUTO_TEST_SUITE(view_schema_ckey_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_delete_single_column_in_view_clustering_key) {
@@ -491,3 +494,5 @@ SEASTAR_TEST_CASE(test_no_clustering_key_2) {
});
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -13,11 +13,14 @@
#include "db/view/view_builder.hh"
#include "test/lib/eventually.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
BOOST_AUTO_TEST_SUITE(view_schema_pkey_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_compound_partition_key) {
@@ -712,3 +715,5 @@ SEASTAR_TEST_CASE(test_base_non_pk_columns_in_view_partition_key_are_non_emtpy)
}
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -16,7 +16,8 @@
#include "db/view/node_view_update_backlog.hh"
#include "db/view/view_builder.hh"
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -27,6 +28,8 @@
#include "types/list.hh"
#include "types/map.hh"
BOOST_AUTO_TEST_SUITE(view_schema_test)
using namespace std::literals::chrono_literals;
// CQL usually folds identifier names - keyspace, table and column names -
@@ -3268,3 +3271,5 @@ SEASTAR_TEST_CASE(test_mv_allow_some_column_drops) {
BOOST_REQUIRE_THROW(e.execute_cql("alter table cf2 drop d").get(), exceptions::invalid_request_exception);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -13,7 +13,8 @@
#include <boost/test/unit_test.hpp>
#include <stdint.h>
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "test/lib/cql_assertions.hh"
@@ -23,6 +24,8 @@
#include "db/view/view_builder.hh"
#include <seastar/core/future-util.hh>
BOOST_AUTO_TEST_SUITE(virtual_reader_test)
using namespace std::literals::chrono_literals;
SEASTAR_TEST_CASE(test_query_size_estimates_virtual_table) {
@@ -212,3 +215,5 @@ SEASTAR_TEST_CASE(test_query_view_built_progress_virtual_table) {
assert_that(rs).is_rows().with_size(0);
});
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -8,7 +8,8 @@
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "test/lib/scylla_test_case.hh"
#undef SEASTAR_TESTING_MAIN
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "test/lib/cql_test_env.hh"
#include "db/virtual_table.hh"
@@ -53,6 +54,8 @@ public:
}
BOOST_AUTO_TEST_SUITE(virtual_table_test)
SEASTAR_TEST_CASE(test_set_cell) {
auto table = db::test_table();
table.test_set_cell();
@@ -100,3 +103,5 @@ SEASTAR_THREAD_TEST_CASE(test_system_config_table_no_live_update) {
);
}).get();
}
BOOST_AUTO_TEST_SUITE_END()