| 573 | // would immediately return an error. |
| 574 | } |
| 575 | void DataTest::TestDoExchangeConcurrency() { |
| 576 | // Ensure that we can do reads/writes on separate threads |
| 577 | auto descr = FlightDescriptor::Command("echo"); |
| 578 | ASSERT_OK_AND_ASSIGN(auto exchange, client_->DoExchange(descr)); |
| 579 | std::unique_ptr<FlightStreamReader> reader = std::move(exchange.reader); |
| 580 | std::unique_ptr<FlightStreamWriter> writer = std::move(exchange.writer); |
| 581 | |
| 582 | RecordBatchVector batches; |
| 583 | ASSERT_OK(ExampleIntBatches(&batches)); |
| 584 | ASSERT_OK(writer->Begin(ExampleIntSchema())); |
| 585 | |
| 586 | std::thread reader_thread([&reader, &batches]() { |
| 587 | for (size_t i = 0; i < batches.size(); i++) { |
| 588 | ASSERT_OK_AND_ASSIGN(auto chunk, reader->Next()); |
| 589 | ASSERT_NE(nullptr, chunk.data); |
| 590 | ASSERT_EQ(nullptr, chunk.app_metadata); |
| 591 | AssertBatchesEqual(*batches[i], *chunk.data); |
| 592 | } |
| 593 | ASSERT_OK_AND_ASSIGN(auto chunk, reader->Next()); |
| 594 | ASSERT_EQ(nullptr, chunk.data); |
| 595 | ASSERT_EQ(nullptr, chunk.app_metadata); |
| 596 | }); |
| 597 | |
| 598 | for (const auto& batch : batches) { |
| 599 | ASSERT_OK(writer->WriteRecordBatch(*batch)); |
| 600 | } |
| 601 | ASSERT_OK(writer->DoneWriting()); |
| 602 | reader_thread.join(); |
| 603 | ASSERT_OK(writer->Close()); |
| 604 | } |
| 605 | void DataTest::TestDoExchangeUndrained() { |
| 606 | // Ensure if the application doesn't drain all messages, that the |
| 607 | // server/transport does |
nothing calls this directly
no test coverage detected