aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2023-03-13 13:55:29 +0000
committerGeir Storli <geirst@yahooinc.com>2023-03-13 13:59:08 +0000
commit0c657642eff7d85c000464e9edba16ded4845e7d (patch)
tree3315f420e49dd85739089780388007ce1649672a /storage/src/tests/distributor
parenta40183094fd45dbf320dd57f8d56a5a6fac7f247 (diff)
Reduce creation of Document instances without DocumentTypeRepo.
Diffstat (limited to 'storage/src/tests/distributor')
-rw-r--r--storage/src/tests/distributor/getoperationtest.cpp2
-rw-r--r--storage/src/tests/distributor/putoperationtest.cpp10
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp2
3 files changed, 9 insertions, 5 deletions
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index 8d188f6c005..36a1495579f 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -85,7 +85,7 @@ struct GetOperationTest : Test, DistributorStripeTestUtil {
if (!authorVal.empty()) {
const document::DocumentType* type(_repo->getDocumentType("text/html"));
- doc = std::make_unique<document::Document>(*type, docId);
+ doc = std::make_unique<document::Document>(*_repo, *type, docId);
doc->setValue(doc->getField("author"),
document::StringFieldValue(authorVal));
diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp
index 735666e5c89..2a3f06b1e8c 100644
--- a/storage/src/tests/distributor/putoperationtest.cpp
+++ b/storage/src/tests/distributor/putoperationtest.cpp
@@ -83,8 +83,12 @@ public:
return *_testDocMan.getTypeRepo().getDocumentType("testdoctype1");
}
+ const document::DocumentTypeRepo& type_repo() const {
+ return _testDocMan.getTypeRepo();
+ }
+
Document::SP createDummyDocument(const char* ns, const char* id) const {
- return std::make_shared<Document>(doc_type(), DocumentId(vespalib::make_string("id:%s:testdoctype1::%s", ns, id)));
+ return std::make_shared<Document>(type_repo(), doc_type(), DocumentId(vespalib::make_string("id:%s:testdoctype1::%s", ns, id)));
}
static std::shared_ptr<api::PutCommand> createPut(Document::SP doc) {
@@ -98,7 +102,7 @@ PutOperationTest::~PutOperationTest() = default;
document::BucketId
PutOperationTest::createAndSendSampleDocument(vespalib::duration timeout) {
- auto doc = std::make_shared<Document>(doc_type(), DocumentId("id:test:testdoctype1::"));
+ auto doc = std::make_shared<Document>(type_repo(), doc_type(), DocumentId("id:test:testdoctype1::"));
document::BucketId id = operation_context().make_split_bit_constrained_bucket_id(doc->getId());
addIdealNodes(id);
@@ -453,7 +457,7 @@ TEST_F(PutOperationTest, no_storage_nodes) {
TEST_F(PutOperationTest, update_correct_bucket_on_remapped_put) {
setup_stripe(2, 2, "storage:2 distributor:1");
- auto doc = std::make_shared<Document>(doc_type(), DocumentId("id:test:testdoctype1:n=13:uri"));
+ auto doc = std::make_shared<Document>(type_repo(), doc_type(), DocumentId("id:test:testdoctype1:n=13:uri"));
addNodesToBucketDB(document::BucketId(16,13), "0=0,1=0");
sendPut(createPut(doc));
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index 579fd156962..da32225cde3 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -237,7 +237,7 @@ TwoPhaseUpdateOperationTest::replyToGet(
std::shared_ptr<api::StorageReply> reply;
if (haveDocument) {
- auto doc(std::make_shared<Document>(*_doc_type, DocumentId("id:ns:" + _doc_type->getName() + "::1")));
+ auto doc(std::make_shared<Document>(*_repo, *_doc_type, DocumentId("id:ns:" + _doc_type->getName() + "::1")));
doc->setValue("headerval", IntFieldValue(oldTimestamp));
reply = std::make_shared<api::GetReply>(get, doc, oldTimestamp);