Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-16795: [C#][Flight] Nightly verify-rc-source-csharp-macos-arm64 fails #15235

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions csharp/test/Apache.Arrow.Flight.Tests/TestWebFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Apache.Arrow.Flight.TestWeb;
using Grpc.Net.Client;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand All @@ -29,11 +32,20 @@ namespace Apache.Arrow.Flight.Tests
public class TestWebFactory : IDisposable
{
readonly IHost host;
private int _port;

public TestWebFactory(FlightStore flightStore)
{
host = WebHostBuilder(flightStore).Build(); //Create the server
host.Start();
var addressInfo = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>();
if (addressInfo == null)
{
throw new Exception("No address info could be found for configured server");
}
var address = addressInfo.Addresses.First();
var addressUri = new Uri(address);
_port = addressUri.Port;
AppContext.SetSwitch(
"System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
}
Expand All @@ -46,7 +58,7 @@ private IHostBuilder WebHostBuilder(FlightStore flightStore)
webBuilder
.ConfigureKestrel(c =>
{
c.Listen(IPEndPoint.Parse("0.0.0.0:5001"), l => l.Protocols = HttpProtocols.Http2);
c.ListenAnyIP(0, l => l.Protocols = HttpProtocols.Http2);
})
.UseStartup<Startup>()
.ConfigureServices(services =>
Expand All @@ -58,7 +70,7 @@ private IHostBuilder WebHostBuilder(FlightStore flightStore)

public string GetAddress()
{
return "http://127.0.0.1:5001";
return $"http://127.0.0.1:{_port}";
}

public GrpcChannel GetChannel()
Expand Down