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:44 +0000
commit17d6a993fc17d533460c5f40f3908c708e057c18 (patch)
tree1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/test/objectstore
parentReleasing progress-linux version 18.2.2-0progress7.99u1. (diff)
downloadceph-17d6a993fc17d533460c5f40f3908c708e057c18.tar.xz
ceph-17d6a993fc17d533460c5f40f3908c708e057c18.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();