Ignore disconnected interfaces in HttpListenerRequestTest.HttpRequestIsLocal
authorNiklas Therning <niklas@therning.org>
Tue, 22 Nov 2016 13:27:59 +0000 (14:27 +0100)
committerNiklas Therning <niklas@therning.org>
Tue, 22 Nov 2016 13:27:59 +0000 (14:27 +0100)
This test creates an HttpListener for every IP address of all network
interfaces. On Windows disconnected network interfaces have unroutable IP
addresses (169.254.XXX.XXX) and this test fails when it tries to listen to
such an IP address. This patch adds a check to the test to ignore network
interfaces which don't have OperationalStatus == Up.

mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs

index d782103f33e33709321e1c7f2211d2b4fccf8a90..18dedcae32dbe27dbc0f7863ae84c0b22c0b7130 100644 (file)
@@ -211,6 +211,8 @@ namespace MonoTests.System.Net
                        var ips = new List<IPAddress> ();
                        ips.Add (IPAddress.Loopback);
                        foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces ()) {
+                               if (adapter.OperationalStatus != OperationalStatus.Up)
+                                       continue;
                                foreach (var ip in adapter.GetIPProperties ().UnicastAddresses) {
                                        ips.Add (ip.Address);
                                }