|
| 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 |
0 commit comments