aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Thornton <thornbill@users.noreply.github.com>2021-05-05 00:10:11 -0400
committerGitHub <noreply@github.com>2021-05-05 00:10:11 -0400
commit7d8fca92f96feccd6cc63de27cb915e618789a36 (patch)
treeb0860719f631d381043c2ef270689cbe35791578
parentcd543f7e5084e438f8f7402e934b335739539d7d (diff)
parent10d358c8da4f5e323c81a5880625737e025d2ba0 (diff)
Merge pull request #5762 from BaronGreenback/networkTestHardening
Fix network test on dns failure
-rw-r--r--tests/Jellyfin.Networking.Tests/NetworkParseTests.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs
index 9b0da2b3c..671b8598d 100644
--- a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs
+++ b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs
@@ -384,6 +384,9 @@ namespace Jellyfin.Networking.Tests
[InlineData("jellyfin.org", "eth16", false, "eth16")]
// User on external network, no binding - so result is the 1st external.
[InlineData("jellyfin.org", "", false, "eth11")]
+ // Dns failure - should skip the test.
+ // https://en.wikipedia.org/wiki/.test
+ [InlineData("invalid.domain.test", "", false, "eth11")]
// User assumed to be internal, no binding - so result is the 1st internal.
[InlineData("", "", false, "eth16")]
public void TestBindInterfaces(string source, string bindAddresses, bool ipv6enabled, string result)
@@ -416,10 +419,13 @@ namespace Jellyfin.Networking.Tests
_ = nm.TryParseInterface(result, out Collection<IPObject>? resultObj);
- if (resultObj != null)
+ // Check to see if dns resolution is working. If not, skip test.
+ _ = IPHost.TryParse(source, out var host);
+
+ if (resultObj != null && host?.HasAddress == true)
{
result = ((IPNetAddress)resultObj[0]).ToString(true);
- var intf = nm.GetBindInterface(source, out int? _);
+ var intf = nm.GetBindInterface(source, out _);
Assert.Equal(intf, result);
}