summaryrefslogtreecommitdiffstats
path: root/src/test/objectstore
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:17 +0000
commitb98f2fb9922af9b7a8ec418716d79ee2a4af5b77 (patch)
treea0f4f617c881a28eb0d52754b15b0a082bb545e1 /src/test/objectstore
parentAdding debian version 18.2.2-1. (diff)
downloadceph-b98f2fb9922af9b7a8ec418716d79ee2a4af5b77.tar.xz
ceph-b98f2fb9922af9b7a8ec418716d79ee2a4af5b77.zip
Merging upstream version 18.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/objectstore')
-rw-r--r--src/test/objectstore/test_kv.cc22
1 files changed, 16 insertions, 6 deletions
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<const char*> {
public:
boost::scoped_ptr<KeyValueDB> 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();