Merge pull request #4970 from BaronGreenback/networkTestCorrection

This commit is contained in:
Joshua M. Boniface 2021-01-16 13:28:34 -05:00 committed by GitHub
commit fe9096be94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -387,7 +387,7 @@ namespace Jellyfin.Networking.Manager
// Get the first LAN interface address that isn't a loopback. // Get the first LAN interface address that isn't a loopback.
var interfaces = CreateCollection(_interfaceAddresses var interfaces = CreateCollection(_interfaceAddresses
.Exclude(_bindExclusions) .Exclude(_bindExclusions)
.Where(p => IsInLocalNetwork(p)) .Where(IsInLocalNetwork)
.OrderBy(p => p.Tag)); .OrderBy(p => p.Tag));
if (interfaces.Count > 0) if (interfaces.Count > 0)
@ -591,7 +591,7 @@ namespace Jellyfin.Networking.Manager
else // Used in testing only. else // Used in testing only.
{ {
// Format is <IPAddress>,<Index>,<Name>: <next interface>. Set index to -ve to simulate a gateway. // Format is <IPAddress>,<Index>,<Name>: <next interface>. Set index to -ve to simulate a gateway.
var interfaceList = MockNetworkSettings.Split(':'); var interfaceList = MockNetworkSettings.Split('|');
foreach (var details in interfaceList) foreach (var details in interfaceList)
{ {
var parts = details.Split(','); var parts = details.Split(',');

View File

@ -54,13 +54,13 @@ namespace Jellyfin.Networking.Tests
/// <summary> /// <summary>
/// Checks the ability to ignore interfaces /// Checks the ability to ignore interfaces
/// </summary> /// </summary>
/// <param name="interfaces">Mock network setup, in the format (IP address, interface index, interface name) : .... </param> /// <param name="interfaces">Mock network setup, in the format (IP address, interface index, interface name) | .... </param>
/// <param name="lan">LAN addresses.</param> /// <param name="lan">LAN addresses.</param>
/// <param name="value">Bind addresses that are excluded.</param> /// <param name="value">Bind addresses that are excluded.</param>
[Theory] [Theory]
[InlineData("192.168.1.208/24,-16,eth16:200.200.200.200/24,11,eth11", "192.168.1.0/24;200.200.200.0/24", "[192.168.1.208/24,200.200.200.200/24]")] [InlineData("192.168.1.208/24,-16,eth16|200.200.200.200/24,11,eth11", "192.168.1.0/24;200.200.200.0/24", "[192.168.1.208/24,200.200.200.200/24]")]
[InlineData("192.168.1.208/24,-16,eth16:200.200.200.200/24,11,eth11", "192.168.1.0/24", "[192.168.1.208/24]")] [InlineData("192.168.1.208/24,-16,eth16|200.200.200.200/24,11,eth11", "192.168.1.0/24", "[192.168.1.208/24]")]
[InlineData("192.168.1.208/24,-16,vEthernet1:192.168.1.208/24,-16,vEthernet212;200.200.200.200/24,11,eth11", "192.168.1.0/24", "[192.168.1.208/24]")] [InlineData("192.168.1.208/24,-16,vEthernet1|192.168.1.208/24,-16,vEthernet212|200.200.200.200/24,11,eth11", "192.168.1.0/24", "[192.168.1.208/24]")]
public void IgnoreVirtualInterfaces(string interfaces, string lan, string value) public void IgnoreVirtualInterfaces(string interfaces, string lan, string value)
{ {
var conf = new NetworkConfiguration() var conf = new NetworkConfiguration()
@ -434,7 +434,7 @@ namespace Jellyfin.Networking.Tests
EnableIPV4 = true EnableIPV4 = true
}; };
NetworkManager.MockNetworkSettings = "192.168.1.208/24,-16,eth16:200.200.200.200/24,11,eth11"; NetworkManager.MockNetworkSettings = "192.168.1.208/24,-16,eth16|200.200.200.200/24,11,eth11";
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>()); using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
NetworkManager.MockNetworkSettings = string.Empty; NetworkManager.MockNetworkSettings = string.Empty;
@ -501,7 +501,7 @@ namespace Jellyfin.Networking.Tests
PublishedServerUriBySubnet = new string[] { publishedServers } PublishedServerUriBySubnet = new string[] { publishedServers }
}; };
NetworkManager.MockNetworkSettings = "192.168.1.208/24,-16,eth16:200.200.200.200/24,11,eth11"; NetworkManager.MockNetworkSettings = "192.168.1.208/24,-16,eth16|200.200.200.200/24,11,eth11";
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>()); using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
NetworkManager.MockNetworkSettings = string.Empty; NetworkManager.MockNetworkSettings = string.Empty;