aboutsummaryrefslogtreecommitdiffstats
path: root/storageapi/src/tests
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2020-09-24 11:14:06 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2020-09-24 11:26:56 +0000
commit7611e6c6ae1562679545ed6cf590d68dee5fc474 (patch)
tree6527427fd7d0ed904a2b0c35258ae1424390ce79 /storageapi/src/tests
parenteaf00891d19f20e04817830b79a9edc86241ff19 (diff)
Add StatBucket storage protocol (de-)serialization support
Adds both protobuf schema and type ID handling to protocol codec. Old protocol versions are not expected to handle this message, as StatBucket will run over the Document protocol instead of the Storage protocol in such cases.
Diffstat (limited to 'storageapi/src/tests')
-rw-r--r--storageapi/src/tests/mbusprot/storageprotocoltest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
index 37159ab0011..636f9b1f701 100644
--- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
+++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
@@ -5,6 +5,7 @@
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/storageapi/message/internal.h>
#include <vespa/storageapi/message/removelocation.h>
+#include <vespa/storageapi/message/stat.h>
#include <vespa/storageapi/mbusprot/storageprotocol.h>
#include <vespa/storageapi/mbusprot/storagecommand.h>
#include <vespa/storageapi/mbusprot/storagereply.h>
@@ -567,6 +568,24 @@ TEST_P(StorageProtocolTest, remove_location) {
}
}
+TEST_P(StorageProtocolTest, stat_bucket) {
+ if (GetParam().getMajor() < 7) {
+ return; // Only available for protobuf-backed protocol version.
+ }
+ auto cmd = std::make_shared<StatBucketCommand>(_bucket, "id.group == 'mygroup'");
+ auto cmd2 = copyCommand(cmd);
+ EXPECT_EQ("id.group == 'mygroup'", cmd2->getDocumentSelection());
+ EXPECT_EQ(_bucket, cmd2->getBucket());
+
+ auto reply = std::make_shared<StatBucketReply>(*cmd2, "neat bucket info goes here");
+ reply->remapBucketId(_dummy_remap_bucket);
+ auto reply2 = copyReply(reply);
+ EXPECT_EQ(reply2->getResults(), "neat bucket info goes here");
+ EXPECT_TRUE(reply2->hasBeenRemapped());
+ EXPECT_EQ(_dummy_remap_bucket, reply2->getBucketId());
+ EXPECT_EQ(_bucket_id, reply2->getOriginalBucketId());
+}
+
TEST_P(StorageProtocolTest, create_visitor) {
std::vector<document::BucketId> buckets;
buckets.push_back(document::BucketId(16, 1));