summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton')
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp3
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp1
-rw-r--r--searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp62
-rw-r--r--searchcore/src/tests/proton/server/feedstates_test.cpp5
8 files changed, 46 insertions, 32 deletions
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index a9a75a1fc7a..45ec3824c11 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/feedoperation/operations.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
index 42e85f2909f..1d8585666b8 100644
--- a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
@@ -2,6 +2,7 @@
#include "bucketmover_common.h"
#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/vespalib/testkit/test_macros.h>
using vespalib::IDestructorCallback;
@@ -58,8 +59,7 @@ void
MySubDb::insertDocs(const UserDocuments &docs_) {
for (const auto & entry : docs_) {
const auto & bucketDocs = entry.second;
- for (size_t i = 0; i < bucketDocs.getDocs().size(); ++i) {
- const auto & testDoc = bucketDocs.getDocs()[i];
+ for (const auto & testDoc : bucketDocs.getDocs()) {
_metaStore.put(testDoc.getGid(), testDoc.getBucket(),
testDoc.getTimestamp(), testDoc.getDocSize(), testDoc.getLid(), 0u);
_realRetriever->_docs.push_back(testDoc.getDoc());
diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp
index 2db34e45140..84ce40589a3 100644
--- a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp
@@ -4,6 +4,7 @@
#include <vespa/searchcore/proton/server/bucketmovejob.h>
#include <vespa/searchcore/proton/server/executor_thread_service.h>
#include <vespa/searchcore/proton/server/document_db_maintenance_config.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/persistence/dummyimpl/dummy_bucket_executor.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/lambdatask.h>
diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp
index 8d0d11295cd..b65beb5d231 100644
--- a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp
@@ -3,6 +3,7 @@
#include "bucketmover_common.h"
#include <vespa/searchcore/proton/server/documentbucketmover.h>
#include <vespa/searchcore/proton/common/pendinglidtracker.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/log/log.h>
@@ -18,7 +19,7 @@ struct MySubDbTwoBuckets : public MySubDb
std::shared_ptr<bucketdb::BucketDBOwner> bucketDB,
uint32_t subDbId,
SubDbType subDbType)
- : MySubDb(builder.getRepo(), bucketDB, subDbId, subDbType)
+ : MySubDb(builder.getRepo(), std::move(bucketDB), subDbId, subDbType)
{
builder.createDocs(1, 1, 6);
builder.createDocs(2, 6, 9);
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index f9518cb1b5e..e89d5eef078 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -12,6 +12,7 @@
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value.h>
#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchcore/proton/test/bucketfactory.h>
#include <vespa/searchcore/proton/common/feedtoken.h>
#include <vespa/searchcore/proton/feedoperation/moveoperation.h>
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
index f5ac3cd8c13..c62226ad363 100644
--- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
@@ -4,6 +4,7 @@
#include <vespa/persistence/spi/bucket_limits.h>
#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
#include <vespa/searchcore/proton/bucketdb/checksumaggregators.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchcore/proton/bucketdb/i_bucket_create_listener.h>
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h>
diff --git a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
index 07fd4ac6fc3..48ff1dac93a 100644
--- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
+++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
@@ -65,17 +65,17 @@ struct DBConfigFixture {
return schema;
}
- RankingConstants::SP buildRankingConstants()
+ static RankingConstants::SP buildRankingConstants()
{
return std::make_shared<RankingConstants>();
}
- RankingExpressions::SP buildRankingExpressions()
+ static RankingExpressions::SP buildRankingExpressions()
{
return std::make_shared<RankingExpressions>();
}
- OnnxModels::SP buildOnnxModels()
+ static OnnxModels::SP buildOnnxModels()
{
return std::make_shared<OnnxModels>();
}
@@ -96,8 +96,8 @@ struct DBConfigFixture {
std::make_shared<AttributesConfig>(_attributesBuilder),
std::make_shared<SummaryConfig>(_summaryBuilder),
std::make_shared<JuniperrcConfig>(_juniperrcBuilder),
- documentTypes,
- repo,
+ std::move(documentTypes),
+ std::move(repo),
std::make_shared<ImportedFieldsConfig>(_importedFieldsBuilder),
std::make_shared<TuneFileDocumentDB>(),
buildSchema(),
@@ -121,7 +121,7 @@ struct ConfigFixture {
int64_t _generation;
std::shared_ptr<ProtonConfigSnapshot> _cachedConfigSnapshot;
- ConfigFixture(const std::string & id)
+ explicit ConfigFixture(const std::string & id)
: _configId(id),
_protonBuilder(),
_documenttypesBuilder(),
@@ -135,7 +135,7 @@ struct ConfigFixture {
addDocType("_alwaysthere_", "default");
}
- ~ConfigFixture() { }
+ ~ConfigFixture();
DBConfigFixture *addDocType(const std::string & name, const std::string& bucket_space) {
DocumenttypesConfigBuilder::Documenttype dt;
@@ -191,13 +191,13 @@ struct ConfigFixture {
}
BootstrapConfig::SP getBootstrapConfig(int64_t generation) const {
- return BootstrapConfig::SP(new BootstrapConfig(generation,
- BootstrapConfig::DocumenttypesConfigSP(new DocumenttypesConfig(_documenttypesBuilder)),
- std::shared_ptr<const DocumentTypeRepo>(new DocumentTypeRepo(_documenttypesBuilder)),
- BootstrapConfig::ProtonConfigSP(new ProtonConfig(_protonBuilder)),
- std::make_shared<FiledistributorrpcConfig>(),
- std::make_shared<BucketspacesConfig>(_bucketspacesBuilder),
- std::make_shared<TuneFileDocumentDB>(), HwInfo()));
+ return std::make_shared<BootstrapConfig>(generation,
+ std::make_shared<DocumenttypesConfig>(_documenttypesBuilder),
+ std::make_shared<DocumentTypeRepo>(_documenttypesBuilder),
+ std::make_shared<ProtonConfig>(_protonBuilder),
+ std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(_bucketspacesBuilder),
+ std::make_shared<TuneFileDocumentDB>(), HwInfo());
}
std::shared_ptr<ProtonConfigSnapshot> getConfigSnapshot()
@@ -226,6 +226,8 @@ struct ConfigFixture {
};
+ConfigFixture::~ConfigFixture() = default;
+
struct MyProtonConfigurerOwner;
struct MyDocumentDBConfigOwner : public DocumentDBConfigOwner
@@ -242,9 +244,9 @@ struct MyDocumentDBConfigOwner : public DocumentDBConfigOwner
_owner(owner)
{
}
- ~MyDocumentDBConfigOwner() { }
+ ~MyDocumentDBConfigOwner() override;
- void reconfigure(const DocumentDBConfig::SP & config) override;
+ void reconfigure(DocumentDBConfig::SP config) override;
document::BucketSpace getBucketSpace() const override { return _bucket_space; }
};
@@ -256,13 +258,16 @@ struct MyLog
: _log()
{
}
+ ~MyLog();
- void appendLog(vespalib::string logEntry)
+ void appendLog(const vespalib::string & logEntry)
{
_log.emplace_back(logEntry);
}
};
+MyLog::~MyLog() = default;
+
struct MyProtonConfigurerOwner : public IProtonConfigurerOwner,
public MyLog
{
@@ -276,7 +281,7 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner,
_dbs()
{
}
- ~MyProtonConfigurerOwner() { }
+ ~MyProtonConfigurerOwner() override;
std::shared_ptr<DocumentDBConfigOwner> addDocumentDB(const DocTypeName &docTypeName,
document::BucketSpace bucketSpace,
@@ -294,7 +299,7 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner,
_dbs.insert(std::make_pair(docTypeName, db));
std::ostringstream os;
os << "add db " << docTypeName.getName() << " " << documentDBConfig->getGeneration();
- _log.push_back(os.str());
+ _log.emplace_back(os.str());
return db;
}
void removeDocumentDB(const DocTypeName &docTypeName) override {
@@ -302,34 +307,37 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner,
_dbs.erase(docTypeName);
std::ostringstream os;
os << "remove db " << docTypeName.getName();
- _log.push_back(os.str());
+ _log.emplace_back(os.str());
}
void applyConfig(const std::shared_ptr<BootstrapConfig> &bootstrapConfig) override {
std::ostringstream os;
os << "apply config " << bootstrapConfig->getGeneration();
- _log.push_back(os.str());
+ _log.emplace_back(os.str());
}
- void reconfigureDocumentDB(const vespalib::string &name, const DocumentDBConfig::SP &config)
+ void reconfigureDocumentDB(const vespalib::string &name, const DocumentDBConfig & config)
{
std::ostringstream os;
- os << "reconf db " << name << " " << config->getGeneration();
- _log.push_back(os.str());
+ os << "reconf db " << name << " " << config.getGeneration();
+ _log.emplace_back(os.str());
}
void sync() { _executor.sync(); }
};
+MyProtonConfigurerOwner::~MyProtonConfigurerOwner() = default;
+MyDocumentDBConfigOwner::~MyDocumentDBConfigOwner() = default;
+
void
-MyDocumentDBConfigOwner::reconfigure(const DocumentDBConfig::SP & config)
+MyDocumentDBConfigOwner::reconfigure(DocumentDBConfig::SP config)
{
- _owner.reconfigureDocumentDB(_name, config);
+ _owner.reconfigureDocumentDB(_name, *config);
}
struct MyProtonDiskLayout : public IProtonDiskLayout
{
MyLog &_log;
- MyProtonDiskLayout(MyLog &myLog)
+ explicit MyProtonDiskLayout(MyLog &myLog)
: _log(myLog)
{
}
diff --git a/searchcore/src/tests/proton/server/feedstates_test.cpp b/searchcore/src/tests/proton/server/feedstates_test.cpp
index e01d90f5eed..faffb8fe1de 100644
--- a/searchcore/src/tests/proton/server/feedstates_test.cpp
+++ b/searchcore/src/tests/proton/server/feedstates_test.cpp
@@ -10,13 +10,14 @@
#include <vespa/searchcore/proton/server/memoryconfigstore.h>
#include <vespa/searchcore/proton/server/replay_throttling_policy.h>
#include <vespa/searchcore/proton/feedoperation/removeoperation.h>
+#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
+#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchcore/proton/test/dummy_feed_view.h>
#include <vespa/searchlib/common/serialnum.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/buffer.h>
-#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
#include <vespa/log/log.h>
LOG_SETUP("feedstates_test");
@@ -56,7 +57,7 @@ struct MyReplayConfig : IReplayConfig {
struct MyIncSerialNum : IIncSerialNum {
SerialNum _serial_num;
- MyIncSerialNum(SerialNum serial_num)
+ explicit MyIncSerialNum(SerialNum serial_num)
: _serial_num(serial_num)
{
}