MCPcopy Create free account
hub / github.com/apache/arrow / ASSERT_OK_AND_ASSIGN

Function ASSERT_OK_AND_ASSIGN

cpp/src/arrow/flight/flight_test.cc:271–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269TEST(TestFlight, ServerCallContextIncomingHeaders) {
270 auto server = TestFlightServer::Make();
271 ASSERT_OK_AND_ASSIGN(auto location, Location::ForGrpcTcp("localhost", 0));
272 FlightServerOptions options(location);
273 ASSERT_OK(server->Init(options));
274
275 ASSERT_OK_AND_ASSIGN(auto client, FlightClient::Connect(server->location()));
276 Action action;
277 action.type = "list-incoming-headers";
278 action.body = Buffer::FromString("test-header");
279 FlightCallOptions call_options;
280 call_options.headers.emplace_back("test-header1", "value1");
281 call_options.headers.emplace_back("test-header2", "value2");
282 ASSERT_OK_AND_ASSIGN(auto stream, client->DoAction(call_options, action));
283 ASSERT_OK_AND_ASSIGN(auto result, stream->Next());
284 ASSERT_NE(result.get(), nullptr);
285 ASSERT_EQ(result->body->ToString(), "test-header1: value1");
286 ASSERT_OK_AND_ASSIGN(result, stream->Next());
287 ASSERT_NE(result.get(), nullptr);
288 ASSERT_EQ(result->body->ToString(), "test-header2: value2");
289 ASSERT_OK_AND_ASSIGN(result, stream->Next());
290 ASSERT_EQ(result.get(), nullptr);
291}
292
293// ----------------------------------------------------------------------
294// Client tests
295
296class TestFlightClient : public ::testing::Test {
297 public:
298 void SetUp() {
299 server_ = TestFlightServer::Make();
300
301 ASSERT_OK_AND_ASSIGN(auto location, Location::ForGrpcTcp("localhost", 0));
302 FlightServerOptions options(location);
303 ASSERT_OK(server_->Init(options));
304
305 ASSERT_OK(ConnectClient());
306 }
307
308 void TearDown() {
309 ASSERT_OK(client_->Close());
310 ASSERT_OK(server_->Shutdown());
311 }
312
313 Status ConnectClient() {
314 ARROW_ASSIGN_OR_RAISE(auto location,
315 Location::ForGrpcTcp("localhost", server_->port()));
316 return FlightClient::Connect(location).Value(&client_);
317 }
318
319 template <typename EndpointCheckFunc>
320 void CheckDoGet(const FlightDescriptor& descr,
321 const RecordBatchVector& expected_batches,
322 EndpointCheckFunc&& check_endpoints) {
323 auto expected_schema = expected_batches[0]->schema();
324
325 ASSERT_OK_AND_ASSIGN(auto info, client_->GetFlightInfo(descr));
326 check_endpoints(info->endpoints());
327
328 ipc::DictionaryMemo dict_memo;

Callers 9

TESTFunction · 0.70
ASSERT_OK_AND_ASSIGNMethod · 0.70
RunValidClientAuthMethod · 0.70
TEST_FMethod · 0.70
acero_test.ccFile · 0.50
SetUpMethod · 0.50
TEST_FFunction · 0.50
SetUpMethod · 0.50
SetUpMethod · 0.50

Calls 15

FromStringFunction · 0.85
optionsFunction · 0.85
MakeRecordBatchReaderFunction · 0.85
emplace_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
MakeFunction · 0.50
OKFunction · 0.50
DoActionMethod · 0.45
NextMethod · 0.45
getMethod · 0.45
ToStringMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected