lidavidm commented on code in PR #36517:
URL: https://github.com/apache/arrow/pull/36517#discussion_r1287200242
##########
cpp/src/arrow/flight/test_definitions.cc:
##########
@@ -1656,5 +1812,107 @@ void ErrorHandlingTest::TestDoExchange() {
reader_thread.join();
}
+//------------------------------------------------------------
+// Test async clients
+
+void AsyncClientTest::SetUpTest() {
+ if (!supports_async()) {
+ GTEST_SKIP() << "async is not supported";
+ }
+
+ ASSERT_OK_AND_ASSIGN(auto location, Location::ForScheme(transport(),
"127.0.0.1", 0));
+
+ server_ = ExampleTestServer();
+ FlightServerOptions server_options(location);
+ ASSERT_OK(server_->Init(server_options));
+
+ std::string uri = location.scheme() + "://127.0.0.1:" +
std::to_string(server_->port());
+ ASSERT_OK_AND_ASSIGN(auto real_location, Location::Parse(uri));
+ FlightClientOptions client_options = FlightClientOptions::Defaults();
+ ASSERT_OK_AND_ASSIGN(client_, FlightClient::Connect(real_location,
client_options));
+
+ ASSERT_TRUE(client_->supports_async());
+}
+void AsyncClientTest::TearDownTest() {
+ if (supports_async()) {
+ ASSERT_OK(client_->Close());
+ ASSERT_OK(server_->Shutdown());
+ }
+}
+
+void AsyncClientTest::TestGetFlightInfo() {
+ class Listener : public AsyncListener<FlightInfo> {
+ public:
+ void OnNext(FlightInfo info) override {
+ info_ = std::move(info);
+ counter_++;
+ }
+
+ void OnFinish(Status status) override {
+ ASSERT_FALSE(future_.is_finished());
+ if (status.ok()) {
+ future_.MarkFinished(std::move(info_));
+ } else {
+ future_.MarkFinished(std::move(status));
+ }
+ }
+
+ int counter_ = 0;
Review Comment:
No, it can only be called once anyways.
--
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]