aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/storageserver
diff options
context:
space:
mode:
Diffstat (limited to 'storage/src/tests/storageserver')
-rw-r--r--storage/src/tests/storageserver/CMakeLists.txt2
-rw-r--r--storage/src/tests/storageserver/bouncertest.cpp78
-rw-r--r--storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp12
-rw-r--r--storage/src/tests/storageserver/communicationmanagertest.cpp88
-rw-r--r--storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp2
-rw-r--r--storage/src/tests/storageserver/documentapiconvertertest.cpp4
-rw-r--r--storage/src/tests/storageserver/gtest_runner.cpp2
-rw-r--r--storage/src/tests/storageserver/mergethrottlertest.cpp31
-rw-r--r--storage/src/tests/storageserver/priorityconvertertest.cpp6
-rw-r--r--storage/src/tests/storageserver/rpc/CMakeLists.txt2
-rw-r--r--storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp2
-rw-r--r--storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp2
-rw-r--r--storage/src/tests/storageserver/rpc/gtest_runner.cpp2
-rw-r--r--storage/src/tests/storageserver/rpc/message_codec_provider_test.cpp2
-rw-r--r--storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp2
-rw-r--r--storage/src/tests/storageserver/service_layer_error_listener_test.cpp13
-rw-r--r--storage/src/tests/storageserver/statemanagertest.cpp2
-rw-r--r--storage/src/tests/storageserver/statereportertest.cpp2
-rw-r--r--storage/src/tests/storageserver/testvisitormessagesession.cpp2
-rw-r--r--storage/src/tests/storageserver/testvisitormessagesession.h8
20 files changed, 157 insertions, 107 deletions
diff --git a/storage/src/tests/storageserver/CMakeLists.txt b/storage/src/tests/storageserver/CMakeLists.txt
index 22d3e71021c..6c6331c2da5 100644
--- a/storage/src/tests/storageserver/CMakeLists.txt
+++ b/storage/src/tests/storageserver/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(storage_teststorageserver TEST
SOURCES
testvisitormessagesession.cpp
diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp
index acd2d978f9e..225b3c94120 100644
--- a/storage/src/tests/storageserver/bouncertest.cpp
+++ b/storage/src/tests/storageserver/bouncertest.cpp
@@ -1,20 +1,22 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/storageapi/message/bucket.h>
-#include <vespa/storageapi/message/state.h>
-#include <vespa/storageapi/message/stat.h>
-#include <vespa/storage/storageserver/bouncer.h>
-#include <vespa/storage/storageserver/bouncer_metrics.h>
-#include <tests/common/teststorageapp.h>
-#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
+#include <tests/common/testhelper.h>
+#include <tests/common/teststorageapp.h>
+#include <vespa/config/common/exceptions.h>
+#include <vespa/config/helper/configgetter.hpp>
#include <vespa/document/bucket/fixed_bucket_spaces.h>
-#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/fieldset/fieldsets.h>
-#include <vespa/storageapi/message/persistence.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/persistence/spi/bucket_limits.h>
+#include <vespa/storage/config/config-stor-bouncer.h>
+#include <vespa/storage/storageserver/bouncer.h>
+#include <vespa/storage/storageserver/bouncer_metrics.h>
+#include <vespa/storageapi/message/bucket.h>
+#include <vespa/storageapi/message/persistence.h>
+#include <vespa/storageapi/message/stat.h>
+#include <vespa/storageapi/message/state.h>
#include <vespa/vdslib/state/clusterstate.h>
-#include <vespa/config/common/exceptions.h>
#include <vespa/vespalib/gtest/gtest.h>
using document::test::makeDocumentBucket;
@@ -51,9 +53,10 @@ struct BouncerTest : public Test {
api::Timestamp timestamp,
document::BucketSpace bucketSpace);
- void expectMessageBouncedWithRejection();
- void expectMessageBouncedWithAbort();
- void expectMessageNotBounced();
+ void expectMessageBouncedWithRejection() const;
+ void expect_message_bounced_with_node_down_abort() const;
+ void expect_message_bounced_with_shutdown_abort() const;
+ void expectMessageNotBounced() const;
};
BouncerTest::BouncerTest()
@@ -72,7 +75,10 @@ void BouncerTest::setUpAsNode(const lib::NodeType& type) {
_node.reset(new TestDistributorApp(NodeIndex(2), config.getConfigId()));
}
_upper.reset(new DummyStorageLink());
- _manager = new Bouncer(_node->getComponentRegister(), config::ConfigUri(config.getConfigId()));
+ using StorBouncerConfig = vespa::config::content::core::StorBouncerConfig;
+ auto cfg_uri = config::ConfigUri(config.getConfigId());
+ auto cfg = config::ConfigGetter<StorBouncerConfig>::getConfig(cfg_uri.getConfigId(), cfg_uri.getContext());
+ _manager = new Bouncer(_node->getComponentRegister(), *cfg);
_lower = new DummyStorageLink();
_upper->push_back(std::unique_ptr<StorageLink>(_manager));
_upper->push_back(std::unique_ptr<StorageLink>(_lower));
@@ -181,7 +187,7 @@ TEST_F(BouncerTest, allow_notify_bucket_change_even_when_distributor_down) {
}
void
-BouncerTest::expectMessageBouncedWithRejection()
+BouncerTest::expectMessageBouncedWithRejection() const
{
ASSERT_EQ(1, _upper->getNumReplies());
EXPECT_EQ(0, _upper->getNumCommands());
@@ -191,7 +197,7 @@ BouncerTest::expectMessageBouncedWithRejection()
}
void
-BouncerTest::expectMessageBouncedWithAbort()
+BouncerTest::expect_message_bounced_with_node_down_abort() const
{
ASSERT_EQ(1, _upper->getNumReplies());
EXPECT_EQ(0, _upper->getNumCommands());
@@ -204,7 +210,17 @@ BouncerTest::expectMessageBouncedWithAbort()
}
void
-BouncerTest::expectMessageNotBounced()
+BouncerTest::expect_message_bounced_with_shutdown_abort() const
+{
+ ASSERT_EQ(1, _upper->getNumReplies());
+ EXPECT_EQ(0, _upper->getNumCommands());
+ auto& reply = dynamic_cast<api::StorageReply&>(*_upper->getReply(0));
+ EXPECT_EQ(api::ReturnCode(api::ReturnCode::ABORTED, "Node is shutting down"), reply.getResult());
+ EXPECT_EQ(0, _lower->getNumCommands());
+}
+
+void
+BouncerTest::expectMessageNotBounced() const
{
EXPECT_EQ(size_t(0), _upper->getNumReplies());
EXPECT_EQ(size_t(1), _lower->getNumCommands());
@@ -214,9 +230,9 @@ void
BouncerTest::configureRejectionThreshold(int newThreshold)
{
using Builder = vespa::config::content::core::StorBouncerConfigBuilder;
- auto config = std::make_unique<Builder>();
- config->feedRejectionPriorityThreshold = newThreshold;
- _manager->configure(std::move(config));
+ Builder config;
+ config.feedRejectionPriorityThreshold = newThreshold;
+ _manager->on_configure(config);
}
TEST_F(BouncerTest, reject_lower_prioritized_feed_messages_when_configured) {
@@ -296,7 +312,7 @@ TEST_F(BouncerTest, abort_request_when_derived_bucket_space_node_state_is_marked
auto state = makeClusterStateBundle("distributor:3 storage:3", {{ document::FixedBucketSpaces::default_space(), "distributor:3 storage:3 .2.s:d" }});
_node->getNodeStateUpdater().setClusterStateBundle(state);
_upper->sendDown(createDummyFeedMessage(11 * 1000000, document::FixedBucketSpaces::default_space()));
- expectMessageBouncedWithAbort();
+ expect_message_bounced_with_node_down_abort();
EXPECT_EQ(1, _manager->metrics().unavailable_node_aborts.getValue());
_upper->reset();
@@ -362,5 +378,23 @@ TEST_F(BouncerTest, operation_with_sufficient_bucket_bits_is_not_rejected) {
expectMessageNotBounced();
}
+TEST_F(BouncerTest, requests_are_rejected_after_close) {
+ _manager->close();
+ _upper->sendDown(createDummyFeedMessage(11 * 1000000, document::FixedBucketSpaces::default_space()));
+ expect_message_bounced_with_shutdown_abort();
+}
+
+TEST_F(BouncerTest, replies_are_swallowed_after_close) {
+ _manager->close();
+ auto req = createDummyFeedMessage(11 * 1000000, document::FixedBucketSpaces::default_space());
+ auto reply = req->makeReply();
+ _upper->sendDown(std::move(reply));
+
+ EXPECT_EQ(0, _upper->getNumCommands());
+ EXPECT_EQ(0, _upper->getNumReplies());
+ EXPECT_EQ(0, _lower->getNumCommands());
+ EXPECT_EQ(0, _lower->getNumReplies());
+}
+
} // storage
diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
index ec8afaad86d..50977b5ec8b 100644
--- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
+++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
@@ -1,8 +1,9 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/common/teststorageapp.h>
#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
+#include <vespa/config/helper/configgetter.hpp>
#include <vespa/document/base/testdocman.h>
#include <vespa/storage/bucketdb/storbucketdb.h>
#include <vespa/storage/persistence/messages.h>
@@ -124,11 +125,12 @@ ChangedBucketOwnershipHandlerTest::insertBuckets(uint32_t numBuckets,
void
ChangedBucketOwnershipHandlerTest::SetUp()
{
+ using vespa::config::content::PersistenceConfig;
vdstestlib::DirConfig config(getStandardConfig(true));
_app.reset(new TestServiceLayerApp);
_top.reset(new DummyStorageLink);
- _handler = new ChangedBucketOwnershipHandler(config::ConfigUri(config.getConfigId()),
+ _handler = new ChangedBucketOwnershipHandler(*config_from<PersistenceConfig>(config::ConfigUri(config.getConfigId())),
_app->getComponentRegister());
_top->push_back(std::unique_ptr<StorageLink>(_handler));
_bottom = new DummyStorageLink;
@@ -139,7 +141,7 @@ ChangedBucketOwnershipHandlerTest::SetUp()
auto pconfig = std::make_unique<vespa::config::content::PersistenceConfigBuilder>();
pconfig->abortOutdatedMutatingIdealStateOps = true;
pconfig->abortOutdatedMutatingExternalLoadOps = true;
- _handler->configure(std::move(pconfig));
+ _handler->on_configure(*pconfig);
}
namespace {
@@ -466,7 +468,7 @@ TEST_F(ChangedBucketOwnershipHandlerTest, abort_outdated_remove_location) {
TEST_F(ChangedBucketOwnershipHandlerTest, ideal_state_aborts_are_configurable) {
auto config = std::make_unique<vespa::config::content::PersistenceConfigBuilder>();
config->abortOutdatedMutatingIdealStateOps = false;
- _handler->configure(std::move(config));
+ _handler->on_configure(*config);
// Should not abort operation, even when ownership has changed.
expectChangeAbortsMessage<api::CreateBucketCommand>(false, getBucketToAbort());
}
@@ -508,7 +510,7 @@ TEST_F(ChangedBucketOwnershipHandlerTest, external_load_op_abort_updates_metric)
TEST_F(ChangedBucketOwnershipHandlerTest, external_load_op_aborts_are_configurable) {
auto config = std::make_unique<vespa::config::content::PersistenceConfigBuilder>();
config->abortOutdatedMutatingExternalLoadOps = false;
- _handler->configure(std::move(config));
+ _handler->on_configure(*config);
// Should not abort operation, even when ownership has changed.
document::DocumentId docId("id:foo:testdoctype1::bar");
expectChangeAbortsMessage<api::RemoveCommand>(
diff --git a/storage/src/tests/storageserver/communicationmanagertest.cpp b/storage/src/tests/storageserver/communicationmanagertest.cpp
index 05dc1c642d0..04322562d08 100644
--- a/storage/src/tests/storageserver/communicationmanagertest.cpp
+++ b/storage/src/tests/storageserver/communicationmanagertest.cpp
@@ -1,31 +1,33 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/storage/storageserver/communicationmanager.h>
-
-#include <vespa/messagebus/testlib/slobrok.h>
-#include <vespa/messagebus/rpcmessagebus.h>
-#include <vespa/storageapi/message/persistence.h>
-#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h>
-#include <vespa/storage/persistence/messages.h>
-#include <vespa/document/bucket/fixed_bucket_spaces.h>
-#include <tests/common/teststorageapp.h>
#include <tests/common/dummystoragelink.h>
#include <tests/common/testhelper.h>
-#include <vespa/document/test/make_document_bucket.h>
+#include <tests/common/teststorageapp.h>
+#include <vespa/config/helper/configgetter.hpp>
+#include <vespa/document/bucket/fixed_bucket_spaces.h>
#include <vespa/document/fieldset/fieldsets.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/documentapi/messagebus/messages/getdocumentmessage.h>
-#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/documentapi/messagebus/messages/removedocumentmessage.h>
#include <vespa/documentapi/messagebus/messages/getdocumentreply.h>
+#include <vespa/documentapi/messagebus/messages/removedocumentmessage.h>
+#include <vespa/messagebus/rpcmessagebus.h>
+#include <vespa/messagebus/testlib/slobrok.h>
+#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h>
+#include <vespa/storage/persistence/messages.h>
+#include <vespa/storage/storageserver/communicationmanager.h>
+#include <vespa/storageapi/message/persistence.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <thread>
-#include <vespa/vespalib/gtest/gtest.h>
+#include <gtest/gtest.h>
using document::test::makeDocumentBucket;
using namespace ::testing;
namespace storage {
-vespalib::string _Storage("storage");
+vespalib::string _storage("storage");
+
+using CommunicationManagerConfig = vespa::config::content::core::StorCommunicationmanagerConfig;
struct CommunicationManagerTest : Test {
@@ -33,13 +35,11 @@ struct CommunicationManagerTest : Test {
void doTestConfigPropagation(bool isContentNode);
- std::shared_ptr<api::StorageCommand> createDummyCommand(
- api::StorageMessage::Priority priority)
- {
+ static std::shared_ptr<api::StorageCommand> createDummyCommand(api::StorageMessage::Priority priority) {
auto cmd = std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)),
document::DocumentId("id:ns:mytype::mydoc"),
document::AllFields::NAME);
- cmd->setAddress(api::StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 1));
+ cmd->setAddress(api::StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 1));
cmd->setPriority(priority);
return cmd;
}
@@ -77,19 +77,22 @@ TEST_F(CommunicationManagerTest, simple) {
TestServiceLayerApp storNode(storConfig.getConfigId());
TestDistributorApp distNode(distConfig.getConfigId());
- CommunicationManager distributor(distNode.getComponentRegister(),
- config::ConfigUri(distConfig.getConfigId()));
- CommunicationManager storage(storNode.getComponentRegister(),
- config::ConfigUri(storConfig.getConfigId()));
- DummyStorageLink *distributorLink = new DummyStorageLink();
- DummyStorageLink *storageLink = new DummyStorageLink();
+ auto dist_cfg_uri = config::ConfigUri(distConfig.getConfigId());
+ auto stor_cfg_uri = config::ConfigUri(storConfig.getConfigId());
+
+ CommunicationManager distributor(distNode.getComponentRegister(), dist_cfg_uri,
+ *config_from<CommunicationManagerConfig>(dist_cfg_uri));
+ CommunicationManager storage(storNode.getComponentRegister(), stor_cfg_uri,
+ *config_from<CommunicationManagerConfig>(stor_cfg_uri));
+ auto* distributorLink = new DummyStorageLink();
+ auto* storageLink = new DummyStorageLink();
distributor.push_back(std::unique_ptr<StorageLink>(distributorLink));
storage.push_back(std::unique_ptr<StorageLink>(storageLink));
distributor.open();
storage.open();
- auto stor_addr = api::StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 1);
- auto distr_addr = api::StorageMessageAddress::create(&_Storage, lib::NodeType::DISTRIBUTOR, 1);
+ auto stor_addr = api::StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 1);
+ auto distr_addr = api::StorageMessageAddress::create(&_storage, lib::NodeType::DISTRIBUTOR, 1);
// It is undefined when the logical nodes will be visible in each others Slobrok
// mirrors, so explicitly wait until mutual visibility is ensured. Failure to do this
// might cause the below message to be immediately bounced due to failing to map the
@@ -136,9 +139,10 @@ CommunicationManagerTest::doTestConfigPropagation(bool isContentNode)
node = std::make_unique<TestDistributorApp>(config.getConfigId());
}
- CommunicationManager commMgr(node->getComponentRegister(),
- config::ConfigUri(config.getConfigId()));
- DummyStorageLink *storageLink = new DummyStorageLink();
+ auto cfg_uri = config::ConfigUri(config.getConfigId());
+ CommunicationManager commMgr(node->getComponentRegister(), cfg_uri,
+ *config_from<CommunicationManagerConfig>(cfg_uri));
+ auto* storageLink = new DummyStorageLink();
commMgr.push_back(std::unique_ptr<StorageLink>(storageLink));
commMgr.open();
@@ -153,13 +157,12 @@ CommunicationManagerTest::doTestConfigPropagation(bool isContentNode)
}
// Test live reconfig of limits.
- using ConfigBuilder
- = vespa::config::content::core::StorCommunicationmanagerConfigBuilder;
+ using ConfigBuilder = vespa::config::content::core::StorCommunicationmanagerConfigBuilder;
auto liveCfg = std::make_unique<ConfigBuilder>();
liveCfg->mbusContentNodeMaxPendingCount = 777777;
liveCfg->mbusDistributorNodeMaxPendingCount = 999999;
- commMgr.configure(std::move(liveCfg));
+ commMgr.on_configure(*liveCfg);
if (isContentNode) {
EXPECT_EQ(777777, mbus.getMaxPendingCount());
} else {
@@ -182,9 +185,10 @@ TEST_F(CommunicationManagerTest, commands_are_dequeued_in_fifo_order) {
addSlobrokConfig(storConfig, slobrok);
TestServiceLayerApp storNode(storConfig.getConfigId());
- CommunicationManager storage(storNode.getComponentRegister(),
- config::ConfigUri(storConfig.getConfigId()));
- DummyStorageLink *storageLink = new DummyStorageLink();
+ auto cfg_uri = config::ConfigUri(storConfig.getConfigId());
+ CommunicationManager storage(storNode.getComponentRegister(), cfg_uri,
+ *config_from<CommunicationManagerConfig>(cfg_uri));
+ auto* storageLink = new DummyStorageLink();
storage.push_back(std::unique_ptr<StorageLink>(storageLink));
storage.open();
@@ -215,9 +219,10 @@ TEST_F(CommunicationManagerTest, replies_are_dequeued_in_fifo_order) {
addSlobrokConfig(storConfig, slobrok);
TestServiceLayerApp storNode(storConfig.getConfigId());
- CommunicationManager storage(storNode.getComponentRegister(),
- config::ConfigUri(storConfig.getConfigId()));
- DummyStorageLink *storageLink = new DummyStorageLink();
+ auto cfg_uri = config::ConfigUri(storConfig.getConfigId());
+ CommunicationManager storage(storNode.getComponentRegister(), cfg_uri,
+ *config_from<CommunicationManagerConfig>(cfg_uri));
+ auto* storageLink = new DummyStorageLink();
storage.push_back(std::unique_ptr<StorageLink>(storageLink));
storage.open();
@@ -256,8 +261,9 @@ struct CommunicationManagerFixture {
addSlobrokConfig(stor_config, slobrok);
node = std::make_unique<TestServiceLayerApp>(stor_config.getConfigId());
- comm_mgr = std::make_unique<CommunicationManager>(node->getComponentRegister(),
- config::ConfigUri(stor_config.getConfigId()));
+ auto cfg_uri = config::ConfigUri(stor_config.getConfigId());
+ comm_mgr = std::make_unique<CommunicationManager>(node->getComponentRegister(), cfg_uri,
+ *config_from<CommunicationManagerConfig>(cfg_uri));
bottom_link = new DummyStorageLink();
comm_mgr->push_back(std::unique_ptr<StorageLink>(bottom_link));
comm_mgr->open();
diff --git a/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp b/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp
index f2e3c20c550..499bc365edd 100644
--- a/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp
+++ b/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storage/storageserver/configurable_bucket_resolver.h>
#include <vespa/document/base/documentid.h>
diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp
index 5829aa83893..eb4789b25d4 100644
--- a/storage/src/tests/storageserver/documentapiconvertertest.cpp
+++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/config/subscription/configuri.h>
#include <vespa/document/base/testdocrepo.h>
@@ -77,7 +77,7 @@ struct DocumentApiConverterTest : Test {
}
void SetUp() override {
- _converter = std::make_unique<DocumentApiConverter>(config::ConfigUri("raw:"), _bucketResolver);
+ _converter = std::make_unique<DocumentApiConverter>(_bucketResolver);
};
template <typename DerivedT, typename BaseT>
diff --git a/storage/src/tests/storageserver/gtest_runner.cpp b/storage/src/tests/storageserver/gtest_runner.cpp
index edd1a03019e..ff6a8707e22 100644
--- a/storage/src/tests/storageserver/gtest_runner.cpp
+++ b/storage/src/tests/storageserver/gtest_runner.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/gtest/gtest.h>
diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp
index ee18384598e..7a7f2551c2d 100644
--- a/storage/src/tests/storageserver/mergethrottlertest.cpp
+++ b/storage/src/tests/storageserver/mergethrottlertest.cpp
@@ -1,7 +1,8 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
#include <tests/common/teststorageapp.h>
+#include <vespa/config/helper/configgetter.hpp>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/messagebus/dynamicthrottlepolicy.h>
#include <vespa/storage/storageserver/mergethrottler.h>
@@ -28,7 +29,9 @@ namespace storage {
namespace {
-vespalib::string _Storage("storage");
+using StorServerConfig = vespa::config::content::core::StorServerConfig;
+
+vespalib::string _storage("storage");
struct MergeBuilder {
document::BucketId _bucket;
@@ -108,7 +111,7 @@ struct MergeBuilder {
auto cmd = std::make_shared<MergeBucketCommand>(
makeDocumentBucket(_bucket), n, _maxTimestamp,
_clusterStateVersion, _chain);
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, _nodes[0]));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, _nodes[0]));
return cmd;
}
};
@@ -167,7 +170,9 @@ MergeThrottlerTest::~MergeThrottlerTest() = default;
void
MergeThrottlerTest::SetUp()
{
- vdstestlib::DirConfig config(getStandardConfig(true));
+ vdstestlib::DirConfig dir_config(getStandardConfig(true));
+ auto cfg_uri = ::config::ConfigUri(dir_config.getConfigId());
+ auto config = config_from<StorServerConfig>(cfg_uri);
for (int i = 0; i < _storageNodeCount; ++i) {
auto server = std::make_unique<TestServiceLayerApp>(NodeIndex(i));
@@ -175,7 +180,7 @@ MergeThrottlerTest::SetUp()
std::unique_ptr<DummyStorageLink> top;
top = std::make_unique<DummyStorageLink>();
- MergeThrottler* throttler = new MergeThrottler(::config::ConfigUri(config.getConfigId()), server->getComponentRegister());
+ MergeThrottler* throttler = new MergeThrottler(*config, server->getComponentRegister());
// MergeThrottler will be sandwiched in between two dummy links
top->push_back(std::unique_ptr<StorageLink>(throttler));
DummyStorageLink* bottom = new DummyStorageLink;
@@ -283,7 +288,7 @@ TEST_F(MergeThrottlerTest, chain) {
auto cmd = std::make_shared<MergeBucketCommand>(bucket, nodes, UINT_MAX, 123);
cmd->setPriority(7);
cmd->setTimeout(54321ms);
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 0));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 0));
const uint16_t distributorIndex = 123;
cmd->setSourceIndex(distributorIndex); // Dummy distributor index that must be forwarded
@@ -423,7 +428,7 @@ TEST_F(MergeThrottlerTest, with_source_only_node) {
std::vector<MergeBucketCommand::Node> nodes({{0}, {2}, {1, true}});
auto cmd = std::make_shared<MergeBucketCommand>(makeDocumentBucket(bid), nodes, UINT_MAX, 123);
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 0));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 0));
_topLinks[0]->sendDown(cmd);
_topLinks[0]->waitForMessage(MessageType::MERGEBUCKET, _messageWaitTime);
@@ -468,7 +473,7 @@ TEST_F(MergeThrottlerTest, legacy_42_distributor_behavior) {
auto cmd = std::make_shared<MergeBucketCommand>(makeDocumentBucket(bid), nodes, 1234);
// Send to node 1, which is not the lowest index
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 1));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 1));
_topLinks[1]->sendDown(cmd);
_bottomLinks[1]->waitForMessage(MessageType::MERGEBUCKET, _messageWaitTime);
@@ -503,7 +508,7 @@ TEST_F(MergeThrottlerTest, legacy_42_distributor_behavior_does_not_take_ownershi
auto cmd = std::make_shared<MergeBucketCommand>(makeDocumentBucket(bid), nodes, 1234);
// Send to node 1, which is not the lowest index
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 1));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 1));
_topLinks[1]->sendDown(cmd);
_bottomLinks[1]->waitForMessage(MessageType::MERGEBUCKET, _messageWaitTime);
@@ -550,7 +555,7 @@ TEST_F(MergeThrottlerTest, end_of_chain_execution_does_not_take_ownership) {
auto cmd = std::make_shared<MergeBucketCommand>(makeDocumentBucket(bid), nodes, 1234, 1, chain);
// Send to last node, which is not the lowest index
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 3));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 3));
_topLinks[2]->sendDown(cmd);
_bottomLinks[2]->waitForMessage(MessageType::MERGEBUCKET, _messageWaitTime);
@@ -595,7 +600,7 @@ TEST_F(MergeThrottlerTest, resend_handling) {
std::vector<MergeBucketCommand::Node> nodes({{0}, {1}, {2}});
auto cmd = std::make_shared<MergeBucketCommand>(makeDocumentBucket(bid), nodes, 1234);
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 1));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 1));
_topLinks[0]->sendDown(cmd);
_topLinks[0]->waitForMessage(MessageType::MERGEBUCKET, _messageWaitTime);
@@ -962,7 +967,7 @@ TEST_F(MergeThrottlerTest, unseen_merge_with_node_in_chain) {
makeDocumentBucket(BucketId(32, 0xdeadbeef)), nodes, 1234, 1, chain);
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 9));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 9));
_topLinks[0]->sendDown(cmd);
// First, test that we get rejected when processing merge immediately
@@ -1145,7 +1150,7 @@ TEST_F(MergeThrottlerTest, unknown_merge_with_self_in_chain) {
std::vector<uint16_t> chain({0});
auto cmd = std::make_shared<MergeBucketCommand>(makeDocumentBucket(bid), nodes, 1234, 1, chain);
- cmd->setAddress(StorageMessageAddress::create(&_Storage, lib::NodeType::STORAGE, 1));
+ cmd->setAddress(StorageMessageAddress::create(&_storage, lib::NodeType::STORAGE, 1));
_topLinks[0]->sendDown(cmd);
_topLinks[0]->waitForMessage(MessageType::MERGEBUCKET_REPLY, _messageWaitTime);
diff --git a/storage/src/tests/storageserver/priorityconvertertest.cpp b/storage/src/tests/storageserver/priorityconvertertest.cpp
index c18f36f9b6c..69f9d313242 100644
--- a/storage/src/tests/storageserver/priorityconvertertest.cpp
+++ b/storage/src/tests/storageserver/priorityconvertertest.cpp
@@ -1,7 +1,6 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storage/storageserver/priorityconverter.h>
-#include <tests/common/testhelper.h>
#include <vespa/vespalib/gtest/gtest.h>
using namespace ::testing;
@@ -12,8 +11,7 @@ struct PriorityConverterTest : Test {
std::unique_ptr<PriorityConverter> _converter;
void SetUp() override {
- vdstestlib::DirConfig config(getStandardConfig(true));
- _converter = std::make_unique<PriorityConverter>(config::ConfigUri(config.getConfigId()));
+ _converter = std::make_unique<PriorityConverter>();
};
};
diff --git a/storage/src/tests/storageserver/rpc/CMakeLists.txt b/storage/src/tests/storageserver/rpc/CMakeLists.txt
index 4e5025a58d2..919a131bcdb 100644
--- a/storage/src/tests/storageserver/rpc/CMakeLists.txt
+++ b/storage/src/tests/storageserver/rpc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(storage_storageserver_rpc_gtest_runner_app TEST
SOURCES
caching_rpc_target_resolver_test.cpp
diff --git a/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp b/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp
index 3eec21aae64..9b9b32a74ab 100644
--- a/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp
+++ b/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/slobrok/imirrorapi.h>
#include <vespa/storage/storageserver/rpc/caching_rpc_target_resolver.h>
diff --git a/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp b/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp
index ad410eb93e8..6e9485e24d4 100644
--- a/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp
+++ b/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/bucket/fixed_bucket_spaces.h>
#include <vespa/fnet/frt/rpcrequest.h>
diff --git a/storage/src/tests/storageserver/rpc/gtest_runner.cpp b/storage/src/tests/storageserver/rpc/gtest_runner.cpp
index ff1c0366478..61600281467 100644
--- a/storage/src/tests/storageserver/rpc/gtest_runner.cpp
+++ b/storage/src/tests/storageserver/rpc/gtest_runner.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/gtest/gtest.h>
diff --git a/storage/src/tests/storageserver/rpc/message_codec_provider_test.cpp b/storage/src/tests/storageserver/rpc/message_codec_provider_test.cpp
index ec42558d9f1..546b7604dee 100644
--- a/storage/src/tests/storageserver/rpc/message_codec_provider_test.cpp
+++ b/storage/src/tests/storageserver/rpc/message_codec_provider_test.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storage/storageserver/rpc/message_codec_provider.h>
#include <vespa/storageapi/mbusprot/protocolserialization7.h>
#include <vespa/document/base/testdocman.h>
diff --git a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp
index 26c5b8df5a5..72ddc89f9d3 100644
--- a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp
+++ b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/common/testhelper.h>
#include <vespa/document/base/testdocman.h>
diff --git a/storage/src/tests/storageserver/service_layer_error_listener_test.cpp b/storage/src/tests/storageserver/service_layer_error_listener_test.cpp
index 11ecc11f810..edb13eea5af 100644
--- a/storage/src/tests/storageserver/service_layer_error_listener_test.cpp
+++ b/storage/src/tests/storageserver/service_layer_error_listener_test.cpp
@@ -1,11 +1,12 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/storage/storageserver/service_layer_error_listener.h>
+#include <tests/common/testhelper.h>
+#include <tests/common/teststorageapp.h>
+#include <vespa/config/helper/configgetter.hpp>
#include <vespa/storage/storageserver/mergethrottler.h>
+#include <vespa/storage/storageserver/service_layer_error_listener.h>
#include <vespa/storageframework/defaultimplementation/component/componentregisterimpl.h>
#include <vespa/vdstestlib/config/dirconfig.h>
-#include <tests/common/testhelper.h>
-#include <tests/common/teststorageapp.h>
#include <vespa/vespalib/gtest/gtest.h>
using namespace ::testing;
@@ -34,10 +35,12 @@ private:
};
struct Fixture {
+ using StorServerConfig = vespa::config::content::core::StorServerConfig;
+
vdstestlib::DirConfig config{getStandardConfig(true)};
TestServiceLayerApp app;
ServiceLayerComponent component{app.getComponentRegister(), "dummy"};
- MergeThrottler merge_throttler{config::ConfigUri(config.getConfigId()), app.getComponentRegister()};
+ MergeThrottler merge_throttler{*config_from<StorServerConfig>(config::ConfigUri(config.getConfigId())), app.getComponentRegister()};
TestShutdownListener shutdown_listener;
ServiceLayerErrorListener error_listener{component, merge_throttler};
diff --git a/storage/src/tests/storageserver/statemanagertest.cpp b/storage/src/tests/storageserver/statemanagertest.cpp
index d757a83db01..2a5af397aca 100644
--- a/storage/src/tests/storageserver/statemanagertest.cpp
+++ b/storage/src/tests/storageserver/statemanagertest.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storageapi/message/bucket.h>
#include <vespa/storageapi/message/state.h>
diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp
index f5512fb193d..43eb37afe15 100644
--- a/storage/src/tests/storageserver/statereportertest.cpp
+++ b/storage/src/tests/storageserver/statereportertest.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <vespa/storage/persistence/filestorage/filestormanager.h>
diff --git a/storage/src/tests/storageserver/testvisitormessagesession.cpp b/storage/src/tests/storageserver/testvisitormessagesession.cpp
index 369e175b205..6ceb690e6b0 100644
--- a/storage/src/tests/storageserver/testvisitormessagesession.cpp
+++ b/storage/src/tests/storageserver/testvisitormessagesession.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/storageserver/testvisitormessagesession.h>
#include <vespa/storageframework/defaultimplementation/clock/realclock.h>
diff --git a/storage/src/tests/storageserver/testvisitormessagesession.h b/storage/src/tests/storageserver/testvisitormessagesession.h
index 4479b194396..cc7dab7ef9e 100644
--- a/storage/src/tests/storageserver/testvisitormessagesession.h
+++ b/storage/src/tests/storageserver/testvisitormessagesession.h
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
@@ -49,9 +49,11 @@ struct TestVisitorMessageSessionFactory : public VisitorMessageSessionFactory
bool _createAutoReplyVisitorSessions;
PriorityConverter _priConverter;
- TestVisitorMessageSessionFactory(vespalib::stringref configId = "")
+ TestVisitorMessageSessionFactory()
: _createAutoReplyVisitorSessions(false),
- _priConverter(config::ConfigUri(configId)) {}
+ _priConverter()
+ {
+ }
VisitorMessageSession::UP createSession(Visitor& v, VisitorThread& vt) override {
std::lock_guard lock(_accessLock);