Skip to content

Commit bc52f9f

Browse files
authored
ARROW-17254: [C++][Go][Java][FlightRPC] Implement and test Flight SQL GetSchema (#13898)
Consistently implements and tests the GetSchema method in Flight SQL. Builds on #13897. Authored-by: David Li <[email protected]> Signed-off-by: David Li <[email protected]>
1 parent 3615d7f commit bc52f9f

19 files changed

Lines changed: 1173 additions & 225 deletions

File tree

‎cpp/src/arrow/flight/integration_tests/CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,14 @@ target_link_libraries(flight-test-integration-client
4040

4141
add_dependencies(arrow-integration flight-test-integration-client
4242
flight-test-integration-server)
43+
44+
if(ARROW_BUILD_TESTS)
45+
add_arrow_test(flight_integration_test
46+
SOURCES
47+
flight_integration_test.cc
48+
test_integration.cc
49+
STATIC_LINK_LIBS
50+
${ARROW_FLIGHT_INTEGRATION_TEST_LINK_LIBS}
51+
LABELS
52+
"arrow_flight")
53+
endif()
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
// Run the integration test scenarios in-process.
19+
20+
#include <gmock/gmock.h>
21+
#include <gtest/gtest.h>
22+
23+
#include "arrow/flight/integration_tests/test_integration.h"
24+
#include "arrow/status.h"
25+
#include "arrow/testing/gtest_util.h"
26+
27+
namespace arrow {
28+
namespace flight {
29+
namespace integration_tests {
30+
31+
Status RunScenario(const std::string& scenario_name) {
32+
std::shared_ptr<Scenario> scenario;
33+
ARROW_RETURN_NOT_OK(GetScenario(scenario_name, &scenario));
34+
35+
std::unique_ptr<FlightServerBase> server;
36+
ARROW_ASSIGN_OR_RAISE(Location bind_location,
37+
arrow::flight::Location::ForGrpcTcp("0.0.0.0", 0));
38+
FlightServerOptions server_options(bind_location);
39+
ARROW_RETURN_NOT_OK(scenario->MakeServer(&server, &server_options));
40+
ARROW_RETURN_NOT_OK(server->Init(server_options));
41+
42+
ARROW_ASSIGN_OR_RAISE(Location location,
43+
arrow::flight::Location::ForGrpcTcp("0.0.0.0", server->port()));
44+
auto client_options = arrow::flight::FlightClientOptions::Defaults();
45+
ARROW_RETURN_NOT_OK(scenario->MakeClient(&client_options));
46+
ARROW_ASSIGN_OR_RAISE(std::unique_ptr<FlightClient> client,
47+
FlightClient::Connect(location, client_options));
48+
ARROW_RETURN_NOT_OK(scenario->RunClient(std::move(client)));
49+
return Status::OK();
50+
}
51+
52+
TEST(FlightIntegration, AuthBasicProto) { ASSERT_OK(RunScenario("auth:basic_proto")); }
53+
54+
TEST(FlightIntegration, Middleware) { ASSERT_OK(RunScenario("middleware")); }
55+
56+
TEST(FlightIntegration, FlightSql) { ASSERT_OK(RunScenario("flight_sql")); }
57+
58+
} // namespace integration_tests
59+
} // namespace flight
60+
} // namespace arrow

‎cpp/src/arrow/flight/integration_tests/test_integration.cc‎

Lines changed: 223 additions & 128 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)