aboutsummaryrefslogtreecommitdiffstats
path: root/documentapi/src/tests/messages/error_codes_test.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2016-11-16 12:02:25 +0100
committerGitHub <noreply@github.com>2016-11-16 12:02:25 +0100
commita589b650c81a9d8e2f0bf9a29195e6c160f455c8 (patch)
tree4c41a85843683d52595838f74af8d538a29dac0f /documentapi/src/tests/messages/error_codes_test.cpp
parent1c56eec1f6daf95f8e6b165fcfb15064a28f3a8d (diff)
Implement distributor bucket ownership handover safe time point (#1098)
This adds a period of time after each distributor bucket ownership handover edge where mutations requiring timestamp assignments are bounced back to the client. This is in order to avoid the possibility of generating the same timestamp as a previous distributor whose bucket subset we now own. The time period is configurable in whole seconds based on expected worst-case cluster clock skew and the feature may be disabled entirely by setting the configured value to zero. Read-only operations and mutating operations that don't require new timestamps (such as RemoveLocation are allowed through).
Diffstat (limited to 'documentapi/src/tests/messages/error_codes_test.cpp')
-rw-r--r--documentapi/src/tests/messages/error_codes_test.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/documentapi/src/tests/messages/error_codes_test.cpp b/documentapi/src/tests/messages/error_codes_test.cpp
index 57c97956d0d..7f158b9f451 100644
--- a/documentapi/src/tests/messages/error_codes_test.cpp
+++ b/documentapi/src/tests/messages/error_codes_test.cpp
@@ -14,7 +14,10 @@ using NamedErrorCodes = std::map<std::string, uint32_t>;
// DocumentAPI C++ module uses Ye Olde Test Framework.
class ErrorCodesTest : public vespalib::TestApp {
int Main() override;
+
void error_codes_match_java_definitions();
+ void stringification_is_defined_for_all_error_codes();
+
NamedErrorCodes all_document_protocol_error_codes();
std::string path_prefixed(const std::string& file_name) const;
};
@@ -115,12 +118,31 @@ ErrorCodesTest::error_codes_match_java_definitions()
EXPECT_EQUAL(cpp_golden_data, java_golden_data);
}
+void
+ErrorCodesTest::stringification_is_defined_for_all_error_codes()
+{
+ using documentapi::DocumentProtocol;
+ NamedErrorCodes codes(all_document_protocol_error_codes());
+ for (auto& kv : codes) {
+ // Ugh, special casing due to divergence between Java and C++ naming.
+ // Can we fix this without breaking anything in exciting ways?
+ if (kv.second != DocumentProtocol::ERROR_EXISTS) {
+ EXPECT_EQUAL(kv.first, "ERROR_" +
+ DocumentProtocol::getErrorName(kv.second));
+ } else {
+ EXPECT_EQUAL("EXISTS", DocumentProtocol::getErrorName(kv.second));
+ }
+ }
+}
+
int
ErrorCodesTest::Main()
{
TEST_INIT("error_codes_test");
error_codes_match_java_definitions();
TEST_FLUSH();
+ stringification_is_defined_for_all_error_codes();
+ TEST_FLUSH();
TEST_DONE();
}