mutation_test: Hoist make_blob() to a function

This commit is contained in:
Tomasz Grabiec
2016-03-18 13:53:17 +01:00
parent 4c85d06df7
commit 36575d9f01
Notes: Avi Kivity 2016-03-26 22:06:40 +03:00
backport: 1.0

View File

@@ -68,6 +68,15 @@ static mutation_partition get_partition(memtable& mt, const partition_key& key)
return std::move(mo->partition());
}
bytes make_blob(size_t blob_size) {
static thread_local std::independent_bits_engine<std::default_random_engine, 8, uint8_t> random_bytes;
bytes big_blob(bytes::initialized_later(), blob_size);
for (auto&& b : big_blob) {
b = random_bytes();
}
return big_blob;
};
template <typename Func>
future<>
with_column_family(schema_ptr s, column_family::config cfg, Func func) {
@@ -815,15 +824,6 @@ SEASTAR_TEST_CASE(test_large_blobs) {
auto mt = make_lw_shared<memtable>(s);
auto make_blob = [] (size_t blob_size) -> bytes {
bytes big_blob(bytes::initialized_later(), blob_size);
static thread_local std::independent_bits_engine<std::default_random_engine, 8, uint8_t> random_bytes;
for (auto&& b : big_blob) {
b = random_bytes();
}
return big_blob;
};
auto blob1 = make_blob(1234567);
auto blob2 = make_blob(2345678);