summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/externaloperationhandlertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/src/tests/distributor/externaloperationhandlertest.cpp')
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp
index eae7ad7fcde..a95418b0b74 100644
--- a/storage/src/tests/distributor/externaloperationhandlertest.cpp
+++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp
@@ -1,19 +1,20 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/distributor/distributortestutil.h>
-#include <vespa/storage/distributor/externaloperationhandler.h>
+#include <vespa/document/fieldset/fieldsets.h>
+#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/test/make_document_bucket.h>
+#include <vespa/document/update/assignvalueupdate.h>
+#include <vespa/document/update/documentupdate.h>
+#include <vespa/storage/common/reindexing_constants.h>
#include <vespa/storage/distributor/distributor.h>
#include <vespa/storage/distributor/distributor_bucket_space.h>
#include <vespa/storage/distributor/distributormetricsset.h>
+#include <vespa/storage/distributor/externaloperationhandler.h>
#include <vespa/storage/distributor/operations/external/getoperation.h>
#include <vespa/storage/distributor/operations/external/read_for_write_visitor_operation.h>
-#include <vespa/storage/common/reindexing_constants.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storageapi/message/visitor.h>
-#include <vespa/document/repo/documenttyperepo.h>
-#include <vespa/document/update/documentupdate.h>
-#include <vespa/document/fieldset/fieldsets.h>
-#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vespalib/gtest/gtest.h>
using document::test::makeDocumentBucket;
@@ -582,6 +583,28 @@ TEST_F(ExternalOperationHandlerTest, puts_are_rejected_if_feed_is_blocked) {
_sender.reply(0)->getResult().toString());
}
+TEST_F(ExternalOperationHandlerTest, non_trivial_updates_are_rejected_if_feed_is_blocked) {
+ set_up_distributor_with_feed_blocked_state();
+
+ auto cmd = makeUpdateCommand("testdoctype1", "id:foo:testdoctype1::foo");
+ const auto* doc_type = _testDocMan.getTypeRepo().getDocumentType("testdoctype1");
+ document::FieldUpdate upd(doc_type->getField("title"));
+ upd.addUpdate(document::AssignValueUpdate(document::StringFieldValue("new value")));
+ cmd->getUpdate()->addUpdate(upd);
+
+ ASSERT_NO_FATAL_FAILURE(start_operation_verify_rejected(std::move(cmd)));
+ EXPECT_EQ("ReturnCode(NO_SPACE, External feed is blocked due to resource exhaustion: full disk)",
+ _sender.reply(0)->getResult().toString());
+}
+
+TEST_F(ExternalOperationHandlerTest, trivial_updates_are_not_rejected_if_feed_is_blocked) {
+ set_up_distributor_with_feed_blocked_state();
+
+ Operation::SP generated;
+ ASSERT_NO_FATAL_FAILURE(start_operation_verify_not_rejected(
+ makeUpdateCommand("testdoctype1", "id:foo:testdoctype1::foo"), generated));
+}
+
struct OperationHandlerSequencingTest : ExternalOperationHandlerTest {
void SetUp() override {