diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2017-10-17 01:19:04 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-17 12:02:29 +0000 |
commit | a110f409b9d56fc7542b110cd50956e3fefdb806 (patch) | |
tree | 567d9ad6afdb65c5ffe40dccb55cc1cedab06226 /storage/src/tests/distributor | |
parent | dde45a05b010b6de1c62643cd9ecd37c091fdba9 (diff) |
Take document::Bucket instead of document::BucketId as constructor
argument to storage commands that inherit from BucketCommand.
Diffstat (limited to 'storage/src/tests/distributor')
14 files changed, 75 insertions, 40 deletions
diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp index e4b23f9d46d..54a5f3ec4b1 100644 --- a/storage/src/tests/distributor/bucketdbupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp @@ -8,12 +8,14 @@ #include <vespa/storageframework/defaultimplementation/clock/realclock.h> #include <vespa/storage/storageutil/distributorstatecache.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/simpleclusterinformation.h> #include <vespa/storage/distributor/distributor.h> #include <vespa/vespalib/text/stringtokenizer.h> using namespace storage::api; using namespace storage::lib; +using storage::test::makeDocumentBucket; namespace storage { namespace distributor { @@ -1102,7 +1104,7 @@ BucketDBUpdaterTest::testNotifyBucketChange() { api::BucketInfo info(1, 2, 3, 4, 5, true, true); auto cmd(std::make_shared<api::NotifyBucketChangeCommand>( - document::BucketId(16, 1), info)); + makeDocumentBucket(document::BucketId(16, 1)), info)); cmd->setSourceIndex(0); getBucketDBUpdater().onNotifyBucketChange(cmd); } @@ -1110,7 +1112,7 @@ BucketDBUpdaterTest::testNotifyBucketChange() { api::BucketInfo info(10, 11, 12, 13, 14, false, false); auto cmd(std::make_shared<api::NotifyBucketChangeCommand>( - document::BucketId(16, 2), info)); + makeDocumentBucket(document::BucketId(16, 2)), info)); cmd->setSourceIndex(0); getBucketDBUpdater().onNotifyBucketChange(cmd); } @@ -1173,7 +1175,7 @@ BucketDBUpdaterTest::testNotifyBucketChangeFromNodeDown() { api::BucketInfo info(8999, 300, 3000, 500, 5000, false, false); auto cmd(std::make_shared<api::NotifyBucketChangeCommand>( - document::BucketId(16, 1), info)); + makeDocumentBucket(document::BucketId(16, 1)), info)); cmd->setSourceIndex(0); getBucketDBUpdater().onNotifyBucketChange(cmd); } @@ -1230,7 +1232,7 @@ BucketDBUpdaterTest::testNotifyChangeWithPendingStateQueuesBucketInfoRequests() { api::BucketInfo info(8999, 300, 3000, 500, 5000, false, false); auto cmd(std::make_shared<api::NotifyBucketChangeCommand>( - document::BucketId(16, 1), info)); + makeDocumentBucket(document::BucketId(16, 1)), info)); cmd->setSourceIndex(0); getBucketDBUpdater().onNotifyBucketChange(cmd); } @@ -1279,7 +1281,7 @@ BucketDBUpdaterTest::testMergeReply() nodes.push_back(api::MergeBucketCommand::Node(1)); nodes.push_back(api::MergeBucketCommand::Node(2)); - api::MergeBucketCommand cmd(document::BucketId(16, 1234), nodes, 0); + api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0); auto reply(std::make_shared<api::MergeBucketReply>(cmd)); @@ -1325,7 +1327,7 @@ BucketDBUpdaterTest::testMergeReplyNodeDown() nodes.push_back(api::MergeBucketCommand::Node(i)); } - api::MergeBucketCommand cmd(document::BucketId(16, 1234), nodes, 0); + api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0); auto reply(std::make_shared<api::MergeBucketReply>(cmd)); @@ -1372,7 +1374,7 @@ BucketDBUpdaterTest::testMergeReplyNodeDownAfterRequestSent() nodes.push_back(api::MergeBucketCommand::Node(i)); } - api::MergeBucketCommand cmd(document::BucketId(16, 1234), nodes, 0); + api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0); auto reply(std::make_shared<api::MergeBucketReply>(cmd)); @@ -1421,7 +1423,7 @@ BucketDBUpdaterTest::testFlush() nodes.push_back(api::MergeBucketCommand::Node(i)); } - api::MergeBucketCommand cmd(document::BucketId(16, 1234), + api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0); diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp index d0941571a6a..e40add9b76d 100644 --- a/storage/src/tests/distributor/distributortest.cpp +++ b/storage/src/tests/distributor/distributortest.cpp @@ -9,11 +9,14 @@ #include <vespa/storageapi/message/removelocation.h> #include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/config/config-stor-distributormanager.h> #include <tests/common/dummystoragelink.h> #include <vespa/storage/distributor/distributor.h> #include <vespa/vespalib/text/stringtokenizer.h> +using storage::test::makeDocumentBucket; + namespace storage { namespace distributor { @@ -202,7 +205,7 @@ Distributor_Test::testOperationGeneration() CPPUNIT_ASSERT_EQUAL(std::string("Remove"), testOp(new api::RemoveCommand( - bid, + makeDocumentBucket(bid), document::DocumentId("userdoc:m:1:foo"), api::Timestamp(1234)))); @@ -285,7 +288,7 @@ Distributor_Test::testHandleUnknownMaintenanceReply() { api::SplitBucketCommand::SP cmd( - new api::SplitBucketCommand(document::BucketId(16, 1234))); + new api::SplitBucketCommand(makeDocumentBucket(document::BucketId(16, 1234)))); api::SplitBucketReply::SP reply(new api::SplitBucketReply(*cmd)); CPPUNIT_ASSERT(_distributor->handleReply(reply)); @@ -295,7 +298,7 @@ Distributor_Test::testHandleUnknownMaintenanceReply() // RemoveLocationReply must be treated as a maintenance reply since // it's what GC is currently built around. auto cmd = std::make_shared<api::RemoveLocationCommand>( - "false", document::BucketId(30, 1234)); + "false", makeDocumentBucket(document::BucketId(30, 1234))); auto reply = std::shared_ptr<api::StorageReply>(cmd->makeReply()); CPPUNIT_ASSERT(_distributor->handleReply(reply)); } @@ -733,7 +736,7 @@ namespace { auto makeDummyRemoveCommand() { return std::make_shared<api::RemoveCommand>( - document::BucketId(0), + makeDocumentBucket(document::BucketId(0)), document::DocumentId("id:foo:testdoctype1:n=1:foo"), api::Timestamp(0)); } @@ -881,7 +884,7 @@ void Distributor_Test::external_client_requests_are_handled_individually_in_prio document::DocumentId id("id:foo:testdoctype1:n=1:foo"); vespalib::stringref field_set = ""; for (auto pri : priorities) { - auto cmd = std::make_shared<api::GetCommand>(document::BucketId(), id, field_set); + auto cmd = std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId()), id, field_set); cmd->setPriority(pri); // onDown appends to internal message FIFO queue, awaiting hand-off. _distributor->onDown(cmd); @@ -912,7 +915,7 @@ void Distributor_Test::internal_messages_are_started_in_fifo_order_batch() { std::vector<api::StorageMessage::Priority> priorities({50, 255, 10, 40, 1}); for (auto pri : priorities) { api::BucketInfo fake_info(pri, pri, pri); - auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(bucket, fake_info); + auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(makeDocumentBucket(bucket), fake_info); cmd->setSourceIndex(0); cmd->setPriority(pri); _distributor->onDown(cmd); @@ -937,7 +940,7 @@ void Distributor_Test::closing_aborts_priority_queued_client_requests() { document::DocumentId id("id:foo:testdoctype1:n=1:foo"); vespalib::stringref field_set = ""; for (int i = 0; i < 10; ++i) { - auto cmd = std::make_shared<api::GetCommand>(document::BucketId(), id, field_set); + auto cmd = std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId()), id, field_set); _distributor->onDown(cmd); } tickDistributorNTimes(1); diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp index 73b1ff7d356..a66a22c7eb1 100644 --- a/storage/src/tests/distributor/externaloperationhandlertest.cpp +++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp @@ -5,6 +5,9 @@ #include <vespa/storage/distributor/operation_sequencer.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/storage/distributor/distributor.h> +#include <tests/common/make_document_bucket.h> + +using storage::test::makeDocumentBucket; namespace storage { namespace distributor { @@ -177,13 +180,13 @@ ExternalOperationHandlerTest::findOwned1stNotOwned2ndInStates( std::shared_ptr<api::GetCommand> ExternalOperationHandlerTest::makeGetCommand(const vespalib::string& id) const { - return std::make_shared<api::GetCommand>(document::BucketId(0), DocumentId(id), "[all]"); + return std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)), DocumentId(id), "[all]"); } std::shared_ptr<api::GetCommand> ExternalOperationHandlerTest::makeGetCommandForUser(uint64_t id) const { DocumentId docId(document::UserDocIdString(vespalib::make_string("userdoc:foo:%lu:bar", id))); - return std::make_shared<api::GetCommand>(document::BucketId(0), docId, "[all]"); + return std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)), docId, "[all]"); } std::shared_ptr<api::UpdateCommand> ExternalOperationHandlerTest::makeUpdateCommand( @@ -193,7 +196,7 @@ std::shared_ptr<api::UpdateCommand> ExternalOperationHandlerTest::makeUpdateComm *_testDocMan.getTypeRepo().getDocumentType(doc_type), document::DocumentId(id)); return std::make_shared<api::UpdateCommand>( - document::BucketId(0), std::move(update), api::Timestamp(0)); + makeDocumentBucket(document::BucketId(0)), std::move(update), api::Timestamp(0)); } std::shared_ptr<api::UpdateCommand> @@ -206,11 +209,11 @@ std::shared_ptr<api::PutCommand> ExternalOperationHandlerTest::makePutCommand( const vespalib::string& id) const { auto doc = _testDocMan.createDocument(doc_type, id); return std::make_shared<api::PutCommand>( - document::BucketId(0), std::move(doc), api::Timestamp(0)); + makeDocumentBucket(document::BucketId(0)), std::move(doc), api::Timestamp(0)); } std::shared_ptr<api::RemoveCommand> ExternalOperationHandlerTest::makeRemoveCommand(const vespalib::string& id) const { - return std::make_shared<api::RemoveCommand>(document::BucketId(0), DocumentId(id), api::Timestamp(0)); + return std::make_shared<api::RemoveCommand>(makeDocumentBucket(document::BucketId(0)), DocumentId(id), api::Timestamp(0)); } void @@ -331,7 +334,7 @@ void ExternalOperationHandlerTest::mutation_not_rejected_when_safe_point_reached DocumentId id("id:foo:testdoctype1::bar"); getExternalOperationHandler().handleMessage( std::make_shared<api::RemoveCommand>( - document::BucketId(0), id, api::Timestamp(0)), + makeDocumentBucket(document::BucketId(0)), id, api::Timestamp(0)), generated); CPPUNIT_ASSERT(generated.get() != nullptr); CPPUNIT_ASSERT_EQUAL(size_t(0), _sender.replies.size()); diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp index f9040df0ec2..315152e4683 100644 --- a/storage/src/tests/distributor/getoperationtest.cpp +++ b/storage/src/tests/distributor/getoperationtest.cpp @@ -8,6 +8,7 @@ #include <tests/distributor/distributortestutil.h> #include <vespa/storageapi/message/persistence.h> #include <tests/common/dummystoragelink.h> +#include <tests/common/make_document_bucket.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/config/helper/configgetter.hpp> @@ -20,6 +21,7 @@ using std::shared_ptr; using config::ConfigGetter; using document::DocumenttypesConfig; using config::FileSpec; +using storage::test::makeDocumentBucket; namespace storage { namespace distributor { @@ -70,7 +72,7 @@ public: void sendGet() { std::shared_ptr<api::GetCommand> msg( - new api::GetCommand(document::BucketId(0), docId, "[all]")); + new api::GetCommand(makeDocumentBucket(document::BucketId(0)), docId, "[all]")); op.reset(new GetOperation(getExternalOperationHandler(), msg, diff --git a/storage/src/tests/distributor/idealstatemanagertest.cpp b/storage/src/tests/distributor/idealstatemanagertest.cpp index 83b147f4125..8f4b99d9d7f 100644 --- a/storage/src/tests/distributor/idealstatemanagertest.cpp +++ b/storage/src/tests/distributor/idealstatemanagertest.cpp @@ -9,7 +9,9 @@ #include <vespa/storageapi/message/visitor.h> #include <vespa/storageapi/message/bucketsplitting.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> +using storage::test::makeDocumentBucket; namespace storage { namespace distributor { @@ -240,7 +242,7 @@ IdealStateManagerTest::testBlockCheckForAllOperationsToSpecificBucket() document::BucketId bid(16, 1234); { - auto msg = std::make_shared<api::JoinBucketsCommand>(bid); + auto msg = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(bid)); msg->setAddress( api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 4)); tracker.insert(msg); diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp index 7e7ca52635e..d33ee64a883 100644 --- a/storage/src/tests/distributor/mergeoperationtest.cpp +++ b/storage/src/tests/distributor/mergeoperationtest.cpp @@ -8,10 +8,12 @@ #include <vespa/storage/distributor/operations/idealstate/mergeoperation.h> #include <vespa/storage/distributor/bucketdbupdater.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/distributor.h> #include <vespa/vespalib/text/stringtokenizer.h> using std::shared_ptr; +using storage::test::makeDocumentBucket; namespace storage { namespace distributor { @@ -320,7 +322,7 @@ MergeOperationTest::doNotRemoveCopiesWithPendingMessages() { // Removes are blocked by all and any operation types, so can just choose // at will. api::StorageMessage::SP msg( - new api::SetBucketStateCommand(bucket, api::SetBucketStateCommand::ACTIVE)); + new api::SetBucketStateCommand(makeDocumentBucket(bucket), api::SetBucketStateCommand::ACTIVE)); msg->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 1)); _pendingTracker->insert(msg); diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp index fa36b4e6305..1fc12821e1d 100644 --- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp +++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp @@ -7,9 +7,12 @@ #include <vespa/storageapi/message/persistence.h> #include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> #include <tests/common/dummystoragelink.h> +#include <tests/common/make_document_bucket.h> #include <vespa/vdslib/state/random.h> #include <vespa/vdstestlib/cppunit/macros.h> +using storage::test::makeDocumentBucket; + namespace storage { namespace distributor { @@ -185,7 +188,7 @@ private: std::shared_ptr<api::PutCommand> createPutToNode(uint16_t node) const { document::BucketId bucket(16, 1234); std::shared_ptr<api::PutCommand> cmd( - new api::PutCommand(bucket, + new api::PutCommand(makeDocumentBucket(bucket), createDummyDocumentForBucket(bucket), api::Timestamp(123456))); cmd->setAddress(makeStorageAddress(node)); @@ -197,7 +200,7 @@ private: { document::BucketId bucket(16, 1234); std::shared_ptr<api::RemoveCommand> cmd( - new api::RemoveCommand(bucket, + new api::RemoveCommand(makeDocumentBucket(bucket), document::DocumentId( createDummyIdString(bucket)), api::Timestamp(123456))); @@ -239,7 +242,7 @@ PendingMessageTrackerTest::testSimple() std::shared_ptr<api::RemoveCommand> remove( new api::RemoveCommand( - document::BucketId(16, 1234), + makeDocumentBucket(document::BucketId(16, 1234)), document::DocumentId("userdoc:footype:1234:foo"), 1001)); remove->setAddress( api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0)); @@ -280,7 +283,7 @@ PendingMessageTrackerTest::insertMessages(PendingMessageTracker& tracker) ost << "userdoc:footype:1234:" << i; std::shared_ptr<api::RemoveCommand> remove( new api::RemoveCommand( - document::BucketId(16, 1234), + makeDocumentBucket(document::BucketId(16, 1234)), document::DocumentId(ost.str()), 1000 + i)); remove->setAddress( api::StorageMessageAddress("storage", @@ -291,7 +294,7 @@ PendingMessageTrackerTest::insertMessages(PendingMessageTracker& tracker) for (uint32_t i = 0; i < 4; i++) { std::ostringstream ost; ost << "userdoc:footype:4567:" << i; - std::shared_ptr<api::RemoveCommand> remove(new api::RemoveCommand(document::BucketId(16, 4567), document::DocumentId(ost.str()), 2000 + i)); + std::shared_ptr<api::RemoveCommand> remove(new api::RemoveCommand(makeDocumentBucket(document::BucketId(16, 4567)), document::DocumentId(ost.str()), 2000 + i)); remove->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, i % 2)); tracker.insert(remove); } @@ -434,7 +437,7 @@ PendingMessageTrackerTest::testGetPendingMessageTypes() std::shared_ptr<api::RemoveCommand> remove( new api::RemoveCommand( - bid, + makeDocumentBucket(bid), document::DocumentId("userdoc:footype:1234:foo"), 1001)); remove->setAddress( api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0)); @@ -474,7 +477,7 @@ PendingMessageTrackerTest::testHasPendingMessage() { std::shared_ptr<api::RemoveCommand> remove( new api::RemoveCommand( - bid, + makeDocumentBucket(bid), document::DocumentId("userdoc:footype:1234:foo"), 1001)); remove->setAddress( api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 1)); diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp index bec07c299d9..156fc2fc8ca 100644 --- a/storage/src/tests/distributor/putoperationtest.cpp +++ b/storage/src/tests/distributor/putoperationtest.cpp @@ -10,6 +10,7 @@ #include <vespa/storageapi/message/state.h> #include <tests/distributor/distributortestutil.h> #include <tests/common/dummystoragelink.h> +#include <tests/common/make_document_bucket.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/testkit/test_kit.h> @@ -26,6 +27,7 @@ using namespace storage; using namespace storage::api; using namespace storage::lib; using namespace std::literals::string_literals; +using storage::test::makeDocumentBucket; namespace storage { @@ -148,7 +150,7 @@ public: const Document::SP doc) const { return std::shared_ptr<api::PutCommand>( - new api::PutCommand(document::BucketId(0), doc, 100)); + new api::PutCommand(makeDocumentBucket(document::BucketId(0)), doc, 100)); } }; @@ -164,7 +166,7 @@ PutOperationTest::createAndSendSampleDocument(uint32_t timeout) { addIdealNodes(id); std::shared_ptr<api::PutCommand> msg( - new api::PutCommand(document::BucketId(0), + new api::PutCommand(makeDocumentBucket(document::BucketId(0)), doc, 0)); msg->setTimestamp(100); diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp index 28283b62120..975d77d870f 100644 --- a/storage/src/tests/distributor/removelocationtest.cpp +++ b/storage/src/tests/distributor/removelocationtest.cpp @@ -6,8 +6,11 @@ #include <vespa/storageapi/message/removelocation.h> #include <vespa/storage/distributor/operations/external/removelocationoperation.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/distributor.h> +using storage::test::makeDocumentBucket; + namespace storage { namespace distributor { @@ -34,7 +37,7 @@ public: void sendRemoveLocation(const std::string& selection) { std::shared_ptr<api::RemoveLocationCommand> msg( - new api::RemoveLocationCommand(selection, document::BucketId(0))); + new api::RemoveLocationCommand(selection, makeDocumentBucket(document::BucketId(0)))); op.reset(new RemoveLocationOperation(getExternalOperationHandler(), msg, diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp index ae4feb0d03a..013d62bac14 100644 --- a/storage/src/tests/distributor/removeoperationtest.cpp +++ b/storage/src/tests/distributor/removeoperationtest.cpp @@ -6,8 +6,11 @@ #include <vespa/storage/distributor/distributor.h> #include <vespa/storageapi/message/persistence.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/operations/external/removeoperation.h> +using storage::test::makeDocumentBucket; + namespace storage { namespace distributor { @@ -52,7 +55,7 @@ public: void sendRemove(document::DocumentId dId) { std::shared_ptr<api::RemoveCommand> msg( - new api::RemoveCommand(document::BucketId(0), dId, 100)); + new api::RemoveCommand(makeDocumentBucket(document::BucketId(0)), dId, 100)); op.reset(new RemoveOperation(getExternalOperationHandler(), msg, diff --git a/storage/src/tests/distributor/splitbuckettest.cpp b/storage/src/tests/distributor/splitbuckettest.cpp index 17a59b620a2..e4c90dcbbe3 100644 --- a/storage/src/tests/distributor/splitbuckettest.cpp +++ b/storage/src/tests/distributor/splitbuckettest.cpp @@ -9,10 +9,12 @@ #include <vespa/storage/distributor/idealstatemanager.h> #include <vespa/storageapi/message/multioperation.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/distributor.h> using std::shared_ptr; using namespace document; +using storage::test::makeDocumentBucket; namespace storage { @@ -317,7 +319,7 @@ SplitOperationTest::testOperationBlockedByPendingJoin() std::vector<document::BucketId> joinSources = { document::BucketId(3, 1), document::BucketId(3, 5) }; - auto joinCmd = std::make_shared<api::JoinBucketsCommand>(joinTarget); + auto joinCmd = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(joinTarget)); joinCmd->getSourceBuckets() = joinSources; joinCmd->setAddress( api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0)); diff --git a/storage/src/tests/distributor/statoperationtest.cpp b/storage/src/tests/distributor/statoperationtest.cpp index bbfac1e69fd..e9364b06085 100644 --- a/storage/src/tests/distributor/statoperationtest.cpp +++ b/storage/src/tests/distributor/statoperationtest.cpp @@ -4,10 +4,13 @@ #include <vespa/storageapi/message/stat.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/operations/external/statbucketoperation.h> #include <vespa/storage/distributor/operations/external/statbucketlistoperation.h> #include <vespa/storage/distributor/distributor.h> +using storage::test::makeDocumentBucket; + namespace storage { namespace distributor { @@ -44,7 +47,7 @@ StatOperationTest::testBucketInfo() StatBucketOperation op( getExternalOperationHandler(), std::shared_ptr<api::StatBucketCommand>( - new api::StatBucketCommand(document::BucketId(16, 5), ""))); + new api::StatBucketCommand(makeDocumentBucket(document::BucketId(16, 5)), ""))); op.start(_sender, framework::MilliSecTime(0)); @@ -84,7 +87,7 @@ StatOperationTest::testBucketList() { } std::shared_ptr<api::GetBucketListCommand> msg( - new api::GetBucketListCommand(document::BucketId(16, 5))); + new api::GetBucketListCommand(makeDocumentBucket(document::BucketId(16, 5)))); StatBucketListOperation op( getExternalOperationHandler().getBucketDatabase(), diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp index 9df7888a3d0..7d3c61d5674 100644 --- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp +++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp @@ -13,8 +13,11 @@ #include <vespa/storage/distributor/operations/external/twophaseupdateoperation.h> #include <vespa/storageapi/message/batch.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/distributor.h> +using storage::test::makeDocumentBucket; + namespace storage { namespace distributor { @@ -321,7 +324,7 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState, } auto msg(std::make_shared<api::UpdateCommand>( - document::BucketId(0), update, api::Timestamp(0))); + makeDocumentBucket(document::BucketId(0)), update, api::Timestamp(0))); // Misc settings for checking that propagation works. msg->getTrace().setLevel(6); msg->setTimeout(6789); diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp index fdb6012800f..425751ee0d0 100644 --- a/storage/src/tests/distributor/updateoperationtest.cpp +++ b/storage/src/tests/distributor/updateoperationtest.cpp @@ -7,6 +7,7 @@ #include <vespa/storageapi/message/state.h> #include <vespa/storageapi/message/bucket.h> #include <tests/distributor/distributortestutil.h> +#include <tests/common/make_document_bucket.h> #include <vespa/storage/distributor/operations/external/updateoperation.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/storage/distributor/distributor.h> @@ -22,6 +23,7 @@ using namespace storage::lib; using config::ConfigGetter; using config::FileSpec; using vespalib::string; +using storage::test::makeDocumentBucket; class UpdateOperation_Test : public CppUnit::TestFixture, public DistributorTestUtil @@ -84,7 +86,7 @@ UpdateOperation_Test::sendUpdate(const std::string& bucketState) addNodesToBucketDB(_bId, bucketState); std::shared_ptr<api::UpdateCommand> msg( - new api::UpdateCommand(document::BucketId(0), + new api::UpdateCommand(makeDocumentBucket(document::BucketId(0)), update, 100)); |