Skip to content

[release/6.0] Increase some of the DnsEndPointTest timeouts #58617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace System.Net.Sockets.Tests
public static class TestSettings
{
// Timeout values in milliseconds.
public const int PassingTestTimeout = 10000;
public const int PassingTestTimeout = 10_000;
public const int PassingTestLongTimeout = 30_000;
Comment on lines +11 to +12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just have PassingTestTimeout be 30s rather than having two different timeouts? The purpose of the "passing" timeout is we expect these to always pass in well under this timeout, and if it times out, the test is going to fail. Taking an extra 20 seconds in the case of a failing test shouldn't be a problem, since tests shouldn't be failing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was introduced based on CR feedback in the PR on main: #58129 (comment)
@stephentoub I assume your comment is non-blocking for 6.0 merging. We can reopen the discussion in main once @antonfirsov is back.

public const int FailingTestTimeout = 100;

public static Task WhenAllOrAnyFailedWithTimeout(params Task[] tasks) => tasks.WhenAllOrAnyFailed(PassingTestTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void Socket_ConnectAsyncDnsEndPoint_HostNotFound()
bool willRaiseEvent = sock.ConnectAsync(args);
if (willRaiseEvent)
{
Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection");
complete.Dispose(); // only dispose on success as we know we're done with the instance
}

Expand Down Expand Up @@ -332,7 +332,7 @@ public void Socket_StaticConnectAsync_Success(SocketImplementationType type)

if (Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args))
{
Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection");
}

Assert.Equal(SocketError.Success, args.SocketError);
Expand All @@ -348,7 +348,7 @@ public void Socket_StaticConnectAsync_Success(SocketImplementationType type)

if (Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args))
{
Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection");
}

complete.Dispose(); // only dispose on success as we know we're done with the instance
Expand Down Expand Up @@ -404,7 +404,7 @@ public void Socket_StaticConnectAsync_HostNotFound()
OnConnectAsyncCompleted(null, args);
}

Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection");
complete.Dispose(); // only dispose on success as we know we're done with the instance

AssertHostNotFoundOrNoData(args);
Expand Down