diff options
Diffstat (limited to 'storage/src/tests/visiting')
-rw-r--r-- | storage/src/tests/visiting/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storage/src/tests/visiting/commandqueuetest.cpp | 2 | ||||
-rw-r--r-- | storage/src/tests/visiting/gtest_runner.cpp | 2 | ||||
-rw-r--r-- | storage/src/tests/visiting/memory_bounded_trace_test.cpp | 2 | ||||
-rw-r--r-- | storage/src/tests/visiting/visitormanagertest.cpp | 57 | ||||
-rw-r--r-- | storage/src/tests/visiting/visitortest.cpp | 10 |
6 files changed, 41 insertions, 34 deletions
diff --git a/storage/src/tests/visiting/CMakeLists.txt b/storage/src/tests/visiting/CMakeLists.txt index 2faa3e72c9f..211dea912d8 100644 --- a/storage/src/tests/visiting/CMakeLists.txt +++ b/storage/src/tests/visiting/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_visiting_gtest_runner_app TEST SOURCES diff --git a/storage/src/tests/visiting/commandqueuetest.cpp b/storage/src/tests/visiting/commandqueuetest.cpp index 97331774644..74de7430c3f 100644 --- a/storage/src/tests/visiting/commandqueuetest.cpp +++ b/storage/src/tests/visiting/commandqueuetest.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/visiting/commandqueue.h> diff --git a/storage/src/tests/visiting/gtest_runner.cpp b/storage/src/tests/visiting/gtest_runner.cpp index 8db0d86ec20..60d4b87edd5 100644 --- a/storage/src/tests/visiting/gtest_runner.cpp +++ b/storage/src/tests/visiting/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/visiting/memory_bounded_trace_test.cpp b/storage/src/tests/visiting/memory_bounded_trace_test.cpp index 59e28bb43fc..fc05c30f04e 100644 --- a/storage/src/tests/visiting/memory_bounded_trace_test.cpp +++ b/storage/src/tests/visiting/memory_bounded_trace_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/visiting/memory_bounded_trace.h> #include <vespa/vespalib/gtest/gtest.h> diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index 7bf79bb19fa..5fa6d4a77d8 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -1,5 +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/config/helper/configgetter.hpp> #include <vespa/document/fieldvalue/intfieldvalue.h> #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/storageapi/message/datagram.h> @@ -36,8 +37,8 @@ namespace storage { namespace { using msg_ptr_vector = std::vector<api::StorageMessage::SP>; -vespalib::string _Storage("storage"); -api::StorageMessageAddress _Address(&_Storage, lib::NodeType::STORAGE, 0); +vespalib::string _storage("storage"); +api::StorageMessageAddress _address(&_storage, lib::NodeType::STORAGE, 0); } struct VisitorManagerTest : Test { @@ -83,19 +84,23 @@ VisitorManagerTest::initializeTest(bool defer_manager_thread_start) vdstestlib::DirConfig config(getStandardConfig(true)); config.getConfig("stor-visitor").set("visitorthreads", "1"); - _messageSessionFactory = std::make_unique<TestVisitorMessageSessionFactory>(config.getConfigId()); + _messageSessionFactory = std::make_unique<TestVisitorMessageSessionFactory>(); _node = std::make_unique<TestServiceLayerApp>(config.getConfigId()); _node->setupDummyPersistence(); _node->getStateUpdater().setClusterState(std::make_shared<lib::ClusterState>("storage:1 distributor:1")); _top = std::make_unique<DummyStorageLink>(); - auto vm = std::make_unique<VisitorManager>(config::ConfigUri(config.getConfigId()), + using vespa::config::content::core::StorVisitorConfig; + auto bootstrap_cfg = config_from<StorVisitorConfig>(config::ConfigUri(config.getConfigId())); + auto vm = std::make_unique<VisitorManager>(*bootstrap_cfg, _node->getComponentRegister(), *_messageSessionFactory, VisitorFactory::Map(), defer_manager_thread_start); _manager = vm.get(); _top->push_back(std::move(vm)); - _top->push_back(std::make_unique<FileStorManager>(config::ConfigUri(config.getConfigId()), _node->getPersistenceProvider(), + using vespa::config::content::StorFilestorConfig; + auto filestor_cfg = config_from<StorFilestorConfig>(config::ConfigUri(config.getConfigId())); + _top->push_back(std::make_unique<FileStorManager>(*filestor_cfg, _node->getPersistenceProvider(), _node->getComponentRegister(), *_node, _node->get_host_info())); _manager->setTimeBetweenTicks(10); _top->open(); @@ -151,7 +156,7 @@ VisitorManagerTest::initializeTest(bool defer_manager_thread_start) document::BucketId bid(16, i); auto cmd = std::make_shared<api::CreateBucketCommand>(makeDocumentBucket(bid)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setSourceIndex(0); _top->sendDown(cmd); _top->waitForMessages(1, 60); @@ -166,7 +171,7 @@ VisitorManagerTest::initializeTest(bool defer_manager_thread_start) document::BucketId bid(16, i); auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bid), _documents[i], i+1); - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); _top->waitForMessages(1, 60); const msg_ptr_vector replies = _top->getRepliesOnce(); @@ -186,7 +191,7 @@ VisitorManagerTest::addSomeRemoves(bool removeAll) document::BucketId bid(16, i % 10); auto cmd = std::make_shared<api::RemoveCommand>(makeDocumentBucket(bid), _documents[i]->getId(), vespalib::count_us(clock.getSystemTime().time_since_epoch()) + docCount + i + 1); - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); _top->waitForMessages(1, 60); const msg_ptr_vector replies = _top->getRepliesOnce(); @@ -340,7 +345,7 @@ TEST_F(VisitorManagerTest, normal_usage) { ASSERT_NO_FATAL_FAILURE(initializeTest()); auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setControlDestination("foo/bar"); _top->sendDown(cmd); std::vector<document::Document::SP > docs; @@ -360,7 +365,7 @@ TEST_F(VisitorManagerTest, resending) { ASSERT_NO_FATAL_FAILURE(initializeTest()); auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setControlDestination("foo/bar"); _top->sendDown(cmd); std::vector<document::Document::SP > docs; @@ -407,7 +412,7 @@ TEST_F(VisitorManagerTest, visit_empty_bucket) { auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); // All data has been replied to, expecting to get a create visitor reply @@ -420,7 +425,7 @@ TEST_F(VisitorManagerTest, multi_bucket_visit) { for (uint32_t i=0; i<10; ++i) { cmd->addBucketToBeVisited(document::BucketId(16, i)); } - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setDataDestination("fooclient.0"); _top->sendDown(cmd); std::vector<document::Document::SP> docs; @@ -439,7 +444,7 @@ TEST_F(VisitorManagerTest, no_buckets) { ASSERT_NO_FATAL_FAILURE(initializeTest()); auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); // Should get one reply; a CreateVisitorReply with error since no @@ -458,7 +463,7 @@ TEST_F(VisitorManagerTest, visit_puts_and_removes) { ASSERT_NO_FATAL_FAILURE(initializeTest()); addSomeRemoves(); auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setVisitRemoves(); for (uint32_t i=0; i<10; ++i) { cmd->addBucketToBeVisited(document::BucketId(16, i)); @@ -486,7 +491,7 @@ TEST_F(VisitorManagerTest, visit_with_timeframe_and_selection) { for (uint32_t i=0; i<10; ++i) { cmd->addBucketToBeVisited(document::BucketId(16, i)); } - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); std::vector<document::Document::SP> docs; std::vector<document::DocumentId> docIds; @@ -515,7 +520,7 @@ TEST_F(VisitorManagerTest, visit_with_timeframe_and_bogus_selection) { for (uint32_t i=0; i<10; ++i) { cmd->addBucketToBeVisited(document::BucketId(16, i)); } - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); _top->waitForMessages(1, 60); @@ -551,7 +556,7 @@ TEST_F(VisitorManagerTest, visitor_callbacks) { auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "TestVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); cmd->addBucketToBeVisited(document::BucketId(16, 5)); - cmd->setAddress(_Address); + cmd->setAddress(_address); _top->sendDown(cmd); // Wait until we have started the visitor @@ -595,7 +600,7 @@ TEST_F(VisitorManagerTest, visitor_cleanup) { ost << "testvis" << i; auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "InvalidVisitor", ost.str(), ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(0ms); _top->sendDown(cmd); _top->waitForMessages(i+1, 60); @@ -607,7 +612,7 @@ TEST_F(VisitorManagerTest, visitor_cleanup) { ost << "testvis" << (i + 10); auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", ost.str(), ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(0ms); _top->sendDown(cmd); } @@ -676,7 +681,7 @@ TEST_F(VisitorManagerTest, visitor_cleanup) { ost << "testvis" << (i + 24); auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", ost.str(), ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(0ms); _top->sendDown(cmd); } @@ -706,7 +711,7 @@ TEST_F(VisitorManagerTest, abort_on_failed_visitor_info) { { auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(0ms); _top->sendDown(cmd); } @@ -740,7 +745,7 @@ TEST_F(VisitorManagerTest, abort_on_field_path_error) { auto cmd = std::make_shared<api::CreateVisitorCommand>( makeBucketSpace(), "DumpVisitor", "testvis", "testdoctype1.headerval{bogus} == 1234"); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(0ms); _top->sendDown(cmd); @@ -754,7 +759,7 @@ TEST_F(VisitorManagerTest, visitor_queue_timeout) { { auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(1ms); cmd->setTimeout(100 * 1000 * 1000ms); // The manager thread isn't running yet so the visitor stays on the queue @@ -780,7 +785,7 @@ TEST_F(VisitorManagerTest, visitor_processing_timeout) { auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", "testvis", ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(0ms); cmd->setTimeout(100ms); _top->sendDown(cmd); @@ -804,7 +809,7 @@ sendCreateVisitor(vespalib::duration timeout, DummyStorageLink& top, uint8_t pri ost << "testvis" << ++nextVisitor; auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "DumpVisitor", ost.str(), ""); cmd->addBucketToBeVisited(document::BucketId(16, 3)); - cmd->setAddress(_Address); + cmd->setAddress(_address); cmd->setQueueTimeout(timeout); cmd->setPriority(priority); top.sendDown(cmd); diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 565131b3b99..f83b6c99d64 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -1,6 +1,7 @@ -// 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/common/exceptions.h> +#include <vespa/config/helper/configgetter.hpp> #include <vespa/document/fieldvalue/intfieldvalue.h> #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/document/datatype/documenttype.h> @@ -161,16 +162,17 @@ VisitorTest::initializeTest(const TestParams& params) std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d0", rootFolder.c_str()))); std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d1", rootFolder.c_str()))); - _messageSessionFactory = std::make_unique<TestVisitorMessageSessionFactory>(config.getConfigId()); + _messageSessionFactory = std::make_unique<TestVisitorMessageSessionFactory>(); if (params._autoReplyError.getCode() != mbus::ErrorCode::NONE) { _messageSessionFactory->_autoReplyError = params._autoReplyError; _messageSessionFactory->_createAutoReplyVisitorSessions = true; } _node = std::make_unique<TestServiceLayerApp>(config.getConfigId()); _top = std::make_unique<DummyStorageLink>(); + using vespa::config::content::core::StorVisitorConfig; + auto bootstrap_cfg = config_from<StorVisitorConfig>(config::ConfigUri(config.getConfigId())); _top->push_back(std::unique_ptr<StorageLink>(_manager - = new VisitorManager(config::ConfigUri(config.getConfigId()), - _node->getComponentRegister(), *_messageSessionFactory))); + = new VisitorManager(*bootstrap_cfg, _node->getComponentRegister(), *_messageSessionFactory))); _bottom = new DummyStorageLink(); _top->push_back(std::unique_ptr<StorageLink>(_bottom)); _manager->setTimeBetweenTicks(10); |