Skip to content

Commit

Permalink
Lengthen timeout so test passes on slower servers. This fixes issue d…
Browse files Browse the repository at this point in the history
  • Loading branch information
paul1956 committed Sep 14, 2024
1 parent 5cec4ac commit 34c49e6
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ public void IsAvailable()
Assert.Equal(System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable(), network.IsAvailable);
}

/// <summary>
/// The ping API exposed by <see cref="Network"/> is in units of Milliseconds, Pinging
/// local server takes approximately 1 Millisecond so there is no reliable way
/// to test a short timeout that for a timeout exception.
/// </summary>
[Fact]
public void Ping_ShortTimeout_Success()
public void Ping_LongTimeout_Success()
{
Network network = new();
network.Ping("127.0.0.1", 1).Should().BeTrue();
Expand All @@ -33,14 +38,11 @@ public void Ping_Throw()
Assert.Throws<ArgumentNullException>(() => network.Ping((string)null));
}

[ActiveIssue("https://github.com/dotnet/winforms/issues/12140")]
[Fact]
[SkipOnArchitecture(TestArchitectures.Any,
"Flaky tests, see: https://github.com/dotnet/winforms/issues/12140")]
public void PingUri_ShortTimeout_Success()
{
Network network = new();
network.Ping(new Uri("http://127.0.0.1"), 1).Should().BeTrue();
network.Ping(new Uri("http://127.0.0.1"), 100).Should().BeTrue();
}

[Fact]
Expand Down

0 comments on commit 34c49e6

Please sign in to comment.