tests: use global nop_lp_handler in test_services

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2019-03-04 18:54:13 +02:00
parent 0e3f9c25e4
commit 2cd11208a1
10 changed files with 15 additions and 24 deletions

View File

@@ -792,13 +792,16 @@ idls = ['idl/gossip_digest.idl.hh',
headers = find_headers('.', excluded_dirs=['idl', 'build', 'seastar', '.git'])
scylla_tests_dependencies = scylla_core + idls + [
scylla_tests_generic_dependencies = [
'tests/cql_test_env.cc',
'tests/test_services.cc',
]
scylla_tests_dependencies = scylla_core + idls + scylla_tests_generic_dependencies + [
'tests/cql_assertions.cc',
'tests/result_set_assertions.cc',
'tests/mutation_source_test.cc',
'tests/data_model.cc',
'tests/test_services.cc',
]
deps = {
@@ -869,7 +872,7 @@ for t in scylla_tests:
if t not in tests_not_using_seastar_test_framework:
deps[t] += scylla_tests_dependencies
else:
deps[t] += scylla_core + idls + ['tests/cql_test_env.cc']
deps[t] += scylla_core + idls + scylla_tests_generic_dependencies
perf_tests_seastar_deps = [
'seastar/tests/perf/perf_tests.cc'

View File

@@ -65,8 +65,6 @@ using namespace std::chrono_literals;
static sstring some_keyspace("ks");
static sstring some_column_family("cf");
static db::nop_large_data_handler nop_lp_handler;
static atomic_cell make_atomic_cell(bytes value) {
return atomic_cell::make_live(*bytes_type, 0, std::move(value));
}

View File

@@ -26,14 +26,13 @@
#include "cell_locking.hh"
#include "mutation_reader.hh"
#include "tests/sstable_utils.hh"
#include "tests/test_services.hh"
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics.hpp>
#include <boost/range/irange.hpp>
using namespace sstables;
static db::nop_large_data_handler nop_lp_handler;
class perf_sstable_test_env {
test_env _env;
@@ -172,9 +171,7 @@ public:
cache_tracker tracker;
cell_locker_stats cl_stats;
auto cm = make_lw_shared<compaction_manager>();
column_family::config cfg;
cfg.large_data_handler = &nop_lp_handler;
auto cf = make_lw_shared<column_family>(s, cfg, column_family::no_commitlog(), *cm, cl_stats, tracker);
auto cf = make_lw_shared<column_family>(s, column_family_test_config(), column_family::no_commitlog(), *cm, cl_stats, tracker);
auto start = perf_sstable_test_env::now();
auto ret = sstables::compact_sstables(sstables::compaction_descriptor(std::move(ssts)), *cf, sst_gen, sstables::replacer_fn_no_op()).get0();

View File

@@ -71,8 +71,6 @@ using namespace sstables;
static const sstring some_keyspace("ks");
static const sstring some_column_family("cf");
static db::nop_large_data_handler nop_lp_handler;
atomic_cell make_atomic_cell(data_type dt, bytes_view value, uint32_t ttl = 0, uint32_t expiration = 0) {
if (ttl) {
return atomic_cell::make_live(*dt, 0, value,
@@ -1042,11 +1040,10 @@ SEASTAR_TEST_CASE(compaction_manager_test) {
cm->start();
auto tmp = tmpdir();
column_family::config cfg;
column_family::config cfg = column_family_test_config();
cfg.datadir = tmp.path().string();
cfg.enable_commitlog = false;
cfg.enable_incremental_backups = false;
cfg.large_data_handler = &nop_lp_handler;
auto cl_stats = make_lw_shared<cell_locker_stats>();
auto tracker = make_lw_shared<cache_tracker>();
auto cf = make_lw_shared<column_family>(s, cfg, column_family::no_commitlog(), *cm, *cl_stats, *tracker);

View File

@@ -49,8 +49,6 @@
using namespace sstables;
using namespace std::chrono_literals;
static db::nop_large_data_handler nop_lp_handler;
SEASTAR_THREAD_TEST_CASE(nonexistent_key) {
auto wait_bg = seastar::defer([] { sstables::await_background_jobs().get(); });
sstables::test_env env;

View File

@@ -23,8 +23,6 @@
using namespace sstables;
static db::nop_large_data_handler nop_lp_handler;
static inline std::vector<std::pair<sstring, dht::token>> token_generation_for_shard(shard_id shard, unsigned tokens_to_generate) {
unsigned tokens = 0;
unsigned key_id = 0;

View File

@@ -42,8 +42,6 @@
using namespace sstables;
static db::nop_large_data_handler nop_lp_handler;
bytes as_bytes(const sstring& s) {
return { reinterpret_cast<const int8_t*>(s.begin()), s.size() };
}

View File

@@ -39,11 +39,11 @@ range<dht::token> create_token_range_from_keys(sstring start_key, sstring end_ke
return range<dht::token>::make(start, end);
}
static db::nop_large_data_handler nop_lp_handler;
static const sstring some_keyspace("ks");
static const sstring some_column_family("cf");
db::nop_large_data_handler nop_lp_handler;
column_family::config column_family_test_config() {
column_family::config cfg;
cfg.large_data_handler = &nop_lp_handler;

View File

@@ -31,6 +31,7 @@
#include "database.hh"
#include "cell_locking.hh"
#include "sstables/compaction_manager.hh"
#include "db/large_data_handler.hh"
// Includes: database, auth, storage_service
class storage_service_for_tests {
@@ -41,6 +42,8 @@ public:
~storage_service_for_tests();
};
extern db::nop_large_data_handler nop_lp_handler;
column_family::config column_family_test_config();
struct column_family_for_tests {

View File

@@ -30,11 +30,10 @@
#include "tests/cql_assertions.hh"
#include "schema_builder.hh"
#include "service/priority_manager.hh"
#include "test_services.hh"
using namespace std::literals::chrono_literals;
static db::nop_large_data_handler nop_lp_handler;
schema_ptr test_table_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(