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

Method TestDoExchangeError

cpp/src/arrow/flight/test_definitions.cc:541–574  ·  view source on GitHub ↗

Ensure server errors get propagated no matter what we try

Source from the content-addressed store, hash-verified

539}
540// Ensure server errors get propagated no matter what we try
541void DataTest::TestDoExchangeError() {
542 auto descr = FlightDescriptor::Command("error");
543 std::unique_ptr<FlightStreamWriter> writer;
544 std::unique_ptr<FlightStreamReader> reader;
545 {
546 ASSERT_OK_AND_ASSIGN(auto exchange, client_->DoExchange(descr));
547 writer = std::move(exchange.writer);
548 reader = std::move(exchange.reader);
549 auto status = writer->Close();
550 EXPECT_RAISES_WITH_MESSAGE_THAT(
551 NotImplemented, ::testing::HasSubstr("Expected error"), writer->Close());
552 }
553 {
554 ASSERT_OK_AND_ASSIGN(auto exchange, client_->DoExchange(descr));
555 writer = std::move(exchange.writer);
556 reader = std::move(exchange.reader);
557 EXPECT_RAISES_WITH_MESSAGE_THAT(
558 NotImplemented, ::testing::HasSubstr("Expected error"), reader->Next());
559 ARROW_UNUSED(writer->Close());
560 }
561 {
562 ASSERT_OK_AND_ASSIGN(auto exchange, client_->DoExchange(descr));
563 writer = std::move(exchange.writer);
564 reader = std::move(exchange.reader);
565 EXPECT_RAISES_WITH_MESSAGE_THAT(
566 NotImplemented, ::testing::HasSubstr("Expected error"), reader->GetSchema());
567 ARROW_UNUSED(writer->Close());
568 }
569 // writer->Begin isn't tested here because, as noted in client.cc,
570 // OpenRecordBatchWriter lazily writes the initial message - hence
571 // Begin() won't fail. Additionally, transports are allowed to
572 // buffer writes - a write won't immediately fail even if the server
573 // would immediately return an error.
574}
575void DataTest::TestDoExchangeConcurrency() {
576 // Ensure that we can do reads/writes on separate threads
577 auto descr = FlightDescriptor::Command("echo");

Callers

nothing calls this directly

Calls 4

CommandFunction · 0.70
CloseMethod · 0.45
NextMethod · 0.45
GetSchemaMethod · 0.45

Tested by

no test coverage detected