Skip to content

Commit

Permalink
ARROW-16795: [C#][Flight] Nightly verify-rc-source-csharp-macos-arm64…
Browse files Browse the repository at this point in the history
… fails (#15235)

* Closes: #15234

Authored-by: Weston Pace <weston.pace@gmail.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
  • Loading branch information
westonpace authored Jan 7, 2023
1 parent 14ec80f commit 21d6374
Showing 1 changed file with 14 additions and 2 deletions.
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

0 comments on commit 21d6374

Please sign in to comment.