This is an automated email from the ASF dual-hosted git repository.

assignuser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 21d6374d25 ARROW-16795: [C#][Flight] Nightly 
verify-rc-source-csharp-macos-arm64 fails (#15235)
21d6374d25 is described below

commit 21d6374d2579c07d75832c5baf06479898e82fd5
Author: Weston Pace <[email protected]>
AuthorDate: Fri Jan 6 17:35:11 2023 -0800

    ARROW-16795: [C#][Flight] Nightly verify-rc-source-csharp-macos-arm64 fails 
(#15235)
    
    
    * Closes: #15234
    
    Authored-by: Weston Pace <[email protected]>
    Signed-off-by: Jacob Wujciak-Jens <[email protected]>
---
 csharp/test/Apache.Arrow.Flight.Tests/TestWebFactory.cs | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/csharp/test/Apache.Arrow.Flight.Tests/TestWebFactory.cs 
b/csharp/test/Apache.Arrow.Flight.Tests/TestWebFactory.cs
index 9e6ebc476b..74873e733b 100644
--- a/csharp/test/Apache.Arrow.Flight.Tests/TestWebFactory.cs
+++ b/csharp/test/Apache.Arrow.Flight.Tests/TestWebFactory.cs
@@ -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;
@@ -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);
         }
@@ -46,7 +58,7 @@ namespace Apache.Arrow.Flight.Tests
                             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 =>
@@ -58,7 +70,7 @@ namespace Apache.Arrow.Flight.Tests
 
         public string GetAddress()
         {
-            return "http://127.0.0.1:5001";;
+            return $"http://127.0.0.1:{_port}";;
         }
 
         public GrpcChannel GetChannel()

Reply via email to