From 17d6a993fc17d533460c5f40f3908c708e057c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 23 May 2024 18:45:17 +0200 Subject: Merging upstream version 18.2.3. Signed-off-by: Daniel Baumann --- src/test/objectstore/test_kv.cc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/test/objectstore/test_kv.cc') diff --git a/src/test/objectstore/test_kv.cc b/src/test/objectstore/test_kv.cc index 33ffd6ab3..95c712cef 100644 --- a/src/test/objectstore/test_kv.cc +++ b/src/test/objectstore/test_kv.cc @@ -29,6 +29,14 @@ using namespace std; +std::string gen_random_string(size_t size) { + std::string s; + for (size_t i = 0; i < size; i++) { + s.push_back(rand()); + } + return s; +} + class KVTest : public ::testing::TestWithParam { public: boost::scoped_ptr db; @@ -556,10 +564,11 @@ TEST_P(KVTest, RocksDB_estimate_size) { for(int test = 0; test < 20; test++) { KeyValueDB::Transaction t = db->get_transaction(); - bufferlist v1; - v1.append(string(1000, '1')); - for (int i = 0; i < 100; i++) + for (int i = 0; i < 100; i++) { + bufferlist v1; + v1.append(gen_random_string(1000)); t->set("A", to_string(rand()%100000), v1); + } db->submit_transaction_sync(t); db->compact(); @@ -588,10 +597,11 @@ TEST_P(KVTest, RocksDB_estimate_size_column_family) { for(int test = 0; test < 20; test++) { KeyValueDB::Transaction t = db->get_transaction(); - bufferlist v1; - v1.append(string(1000, '1')); - for (int i = 0; i < 100; i++) + for (int i = 0; i < 100; i++) { + bufferlist v1; + v1.append(gen_random_string(1000)); t->set("cf1", to_string(rand()%100000), v1); + } db->submit_transaction_sync(t); db->compact(); -- cgit v1.2.3