Skip to content
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

Sockets.tests: TcpReceiveSendGetsCanceledByDispose: remove Timeout. #52599

Merged
merged 3 commits into from
Jun 8, 2021
Merged
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 @@ -950,7 +950,8 @@ await RetryHelper.ExecuteAsync(async () =>
msDelay *= 2;
Task disposeTask = Task.Run(() => socket.Dispose());

await Task.WhenAny(disposeTask, receiveTask).WaitAsync(TimeSpan.FromSeconds(30));
await Task.WhenAny(disposeTask, receiveTask)
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));
await disposeTask;

SocketError? localSocketError = null;
Expand Down Expand Up @@ -994,7 +995,7 @@ await RetryHelper.ExecuteAsync(async () =>
{ false, true, false },
};

[Theory(Timeout = 40000)]
[Theory]
[MemberData(nameof(TcpReceiveSendGetsCanceledByDispose_Data))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/50568", TestPlatforms.Android)]
public async Task TcpReceiveSendGetsCanceledByDispose(bool receiveOrSend, bool ipv6Server, bool dualModeClient)
Expand Down Expand Up @@ -1025,7 +1026,9 @@ await RetryHelper.ExecuteAsync(async () =>
var buffer = new ArraySegment<byte>(new byte[4096]);
while (true)
{
SendAsync(socket1, buffer).GetAwaiter().GetResult();
SendAsync(socket1, buffer)
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout))
.GetAwaiter().GetResult();
Comment on lines +1030 to +1031
Copy link
Member

Choose a reason for hiding this comment

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

This could also just be:

.Wait(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));

If that fails it'll end up throwing an AggregateException, but I don't see anything paying attention to the exact exception type anyway...

}
});
}
Expand All @@ -1035,14 +1038,17 @@ await RetryHelper.ExecuteAsync(async () =>
msDelay *= 2;
Task disposeTask = Task.Run(() => socket1.Dispose());

await Task.WhenAny(disposeTask, socketOperation).WaitAsync(TimeSpan.FromSeconds(30));
await disposeTask;
await Task.WhenAny(disposeTask, socketOperation)
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));
await disposeTask
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));

SocketError? localSocketError = null;
bool disposedException = false;
try
{
await socketOperation;
await socketOperation
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));
}
catch (SocketException se)
{
Expand Down Expand Up @@ -1077,7 +1083,8 @@ await RetryHelper.ExecuteAsync(async () =>
{
try
{
int received = await ReceiveAsync(socket2, receiveBuffer);
int received = await ReceiveAsync(socket2, receiveBuffer)
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));
if (received == 0)
{
break;
Expand Down