kou commented on code in PR #36979:
URL: https://github.com/apache/arrow/pull/36979#discussion_r1281157000
##########
cpp/src/arrow/flight/flight_internals_test.cc:
##########
@@ -651,6 +654,38 @@ TEST_F(TestCookieParsing, CookieCache) {
AddCookieVerifyCache({"id0=0;", "id1=1;", "id2=2"}, "id0=0; id1=1; id2=2");
}
+// ----------------------------------------------------------------------
+// Protobuf tests
+
+TEST(GrpcTransport, FlightDataDeserialize) {
+#ifndef _WIN32
+ pb::FlightData raw;
+ // Tack on known and unknown fields by hand here
+ raw.GetReflection()->MutableUnknownFields(&raw)->AddFixed32(900, 1024);
+ raw.GetReflection()->MutableUnknownFields(&raw)->AddFixed64(901, 1024);
+ raw.GetReflection()->MutableUnknownFields(&raw)->AddVarint(902, 1024);
+ raw.GetReflection()->MutableUnknownFields(&raw)->AddLengthDelimited(903,
"foobar");
+ // Known field comes at end
+ raw.GetReflection()->MutableUnknownFields(&raw)->AddLengthDelimited(
+ pb::FlightData::kDataBodyFieldNumber, "data");
+
+ auto serialized = raw.SerializeAsString();
+
+ grpc_slice slice = grpc_slice_from_copied_buffer(serialized.data(),
serialized.size());
+ // gRPC requires that grpc_slice and grpc::Slice have the same representation
+ grpc::ByteBuffer buffer(reinterpret_cast<const grpc::Slice*>(&slice),
/*nslices=*/1);
+
+ flight::internal::FlightData out;
+ auto status = flight::transport::grpc::FlightDataDeserialize(&buffer, &out);
+ ASSERT_TRUE(status.ok());
Review Comment:
Can we use `ASSERT_OK()` here?
```suggestion
ASSERT_OK(flight::transport::grpc::FlightDataDeserialize(&buffer, &out));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]