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

Consistent ConfigureAwait on Loopback, RemoteExecutor.DisposeAsync #102699

Merged
merged 34 commits into from
Jun 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b35b727
Add ConfigureAwait(false) to various place
liveans May 26, 2024
adb4656
Revert "Disable parallel test execution for QUIC and HTTP/3 (#101569)"
liveans May 26, 2024
e9cab4d
Disable another AltSvc test
liveans May 26, 2024
2558f17
Disable AltSvc for H/3
liveans May 27, 2024
10eeef1
Add ConfigureAwait to Loopback
liveans May 27, 2024
cc2401b
Put unwanted change back
liveans May 27, 2024
e025609
Revert "Put unwanted change back"
liveans May 27, 2024
b335fab
Delete ConfigureAwait from test code
liveans May 27, 2024
ba37b90
Increase Idle Timeout for Http3LoopbackServer
liveans May 29, 2024
f2c4731
Convert RemoteExecutor Disposal to async
liveans May 30, 2024
8ce9194
Add using
liveans May 30, 2024
9c10f97
Delete custom IdleTimeout
liveans May 30, 2024
1d8afca
Delete Async Disposal of RemoteExecutor
liveans May 30, 2024
d5b78b0
Add RemoteExecutor.DisposeAsync and use it on System.Net.Mail
liveans May 31, 2024
febf3dd
Add RemoteExecutor.DisposeAsync and use it on System.Net.
liveans May 31, 2024
e1117e2
Add RemoteExecutor.DisposeAsync and use it on System.Net.Primitives
liveans May 31, 2024
229304e
Add RemoteExecutor.DisposeAsync and use it on System.Net.Quic
liveans May 31, 2024
d6fba45
Add RemoteExecutor.DisposeAsync and use it on System.Net.Requests
liveans May 31, 2024
e52bce6
Add RemoteExecutor.DisposeAsync and use it on System.Net.Security
liveans May 31, 2024
8759f94
Add RemoteExecutor.DisposeAsync and use it on System.Net.Sockets
liveans May 31, 2024
99cd44e
Add RemoteExecutor.DisposeAsync and use it on Common System.Net
liveans May 31, 2024
e3dbb51
Add RemoteExecutor.DisposeAsync and use it on System.Net.Http - 2
liveans May 31, 2024
9c7184c
Add RemoteExecutor.DisposeAsync and use it on System.Net.Ping
liveans May 31, 2024
0e2c152
Add RemoteExecutor.DisposeAsync and use it on System.Net.Requests - 2
liveans May 31, 2024
13045c9
Add RemoteExecutor.DisposeAsync and use it on System.Net.Security - 2
liveans May 31, 2024
5c5bb53
Add RemoteExecutor.DisposeAsync and use it on System.Net.Sockets - 2
liveans May 31, 2024
3ede1e0
Add RemoteExecutor.DisposeAsync and use it on Common System.Net - 2
liveans May 31, 2024
6bd462f
Merge branch 'main' into attempt_to_fix_an_http3_test
liveans May 31, 2024
dbd5b01
Review Feedback
liveans May 31, 2024
896f0f1
Change DisposeAsync return value signature to ValueTask from Task
liveans Jun 2, 2024
6c01d86
Reapply "Disable parallel test execution for QUIC and HTTP/3 (#101569)"
liveans Jun 3, 2024
4574aa9
Put ActiveIssue's back
liveans Jun 3, 2024
fcb6d45
Delete ActiveIssue to make disable it in other pr with other changes
liveans Jun 3, 2024
e19b233
Add SkipTest back
liveans Jun 3, 2024
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
Prev Previous commit
Next Next commit
Add RemoteExecutor.DisposeAsync and use it on System.Net.Sockets - 2
liveans committed May 31, 2024
commit 5c5bb53ae68196a696679679e6a881facc15c863
Original file line number Diff line number Diff line change
@@ -131,14 +131,14 @@ public void Ctor_Raw_NotSupported_ExpectedError(AddressFamily addressFamily, Pro
[InlineData(false, 1)]
[InlineData(true, 2)] // Begin/EndAccept
[InlineData(false, 2)]
public void CtorAndAccept_SocketNotKeptAliveViaInheritance(bool validateClientOuter, int acceptApiOuter)
public async Task CtorAndAccept_SocketNotKeptAliveViaInheritance(bool validateClientOuter, int acceptApiOuter)
{
// 300 ms should be long enough to connect if the socket is actually present & listening.
const int ConnectionTimeoutMs = 300;

// Run the test in another process so as to not have trouble with other tests
// launching child processes that might impact inheritance.
RemoteExecutor.Invoke((validateClientString, acceptApiString) =>
await RemoteExecutor.Invoke((validateClientString, acceptApiString) =>
{
bool validateClient = bool.Parse(validateClientString);
int acceptApi = int.Parse(acceptApiString);
@@ -211,7 +211,7 @@ public void CtorAndAccept_SocketNotKeptAliveViaInheritance(bool validateClientOu
}
}
}
}, validateClientOuter.ToString(), acceptApiOuter.ToString()).Dispose();
}, validateClientOuter.ToString(), acceptApiOuter.ToString()).DisposeAsync();
}

[Theory]
Original file line number Diff line number Diff line change
@@ -324,17 +324,20 @@ public async Task DuplicateAndClose_TcpServerHandler(AddressFamily addressFamily
if (sameProcess)
{
Task handlerCode = Task.Run(() => HandlerServerCode(_ipcPipeName));
RunCommonHostLogic(Environment.ProcessId);
await RunCommonHostLogic(Environment.ProcessId);
await handlerCode;
}
else
{
using RemoteInvokeHandle hServerProc = RemoteExecutor.Invoke(HandlerServerCode, _ipcPipeName);
RunCommonHostLogic(hServerProc.Process.Id);
RemoteInvokeHandle hServerProc = RemoteExecutor.Invoke(HandlerServerCode, _ipcPipeName);
await RunCommonHostLogic(hServerProc.Process.Id);
await hServerProc.DisposeAsync();
}

void RunCommonHostLogic(int processId)
async Task RunCommonHostLogic(int processId)
{
await Task.Yield();
liveans marked this conversation as resolved.
Show resolved Hide resolved

pipeServerStream.WaitForConnection();

// Duplicate the socket:
Original file line number Diff line number Diff line change
@@ -107,9 +107,9 @@ private static SocketHelperBase GetHelperBase(string socketMethod)
[OuterLoop]
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[MemberData(nameof(SocketMethods_Matrix_MemberData))]
public void EventSource_SocketConnectsLoopback_LogsConnectAcceptStartStop(string connectMethod, string acceptMethod)
public async Task EventSource_SocketConnectsLoopback_LogsConnectAcceptStartStop(string connectMethod, string acceptMethod)
{
RemoteExecutor.Invoke(async (connectMethod, acceptMethod) =>
await RemoteExecutor.Invoke(async (connectMethod, acceptMethod) =>
{
using var listener = new TestEventListener("System.Net.Sockets", EventLevel.Verbose, 0.1);
listener.AddActivityTracking();
@@ -149,7 +149,7 @@ await listener.RunWithCallbackAsync(e =>
VerifyEvents(events, connect: true, expectedCount: 1);
VerifyEvents(events, connect: false, expectedCount: 1);
VerifyEventCounters(events, connectCount: 1, hasCurrentConnectCounter: true);
}, connectMethod, acceptMethod).Dispose();
}, connectMethod, acceptMethod).DisposeAsync();
}

[OuterLoop]
@@ -162,7 +162,7 @@ public async Task EventSource_SocketConnectsRemote_LogsConnectStartStop(string c
throw new SkipTestException("The remote server is not reachable");
}

RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) =>
await RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) =>
{
using var listener = new TestEventListener("System.Net.Sockets", EventLevel.Verbose, 0.1);
listener.AddActivityTracking();
@@ -184,14 +184,14 @@ await listener.RunWithCallbackAsync(e => events.Enqueue((e, e.ActivityId)), asyn

VerifyEvents(events, connect: true, expectedCount: 1);
VerifyEventCounters(events, connectCount: 1, connectOnly: true);
}, connectMethod, useDnsEndPoint.ToString()).Dispose();
}, connectMethod, useDnsEndPoint.ToString()).DisposeAsync();
}

[OuterLoop]
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[SkipOnPlatform(TestPlatforms.OSX | TestPlatforms.FreeBSD, "Same as Connect.ConnectGetsCanceledByDispose")]
[MemberData(nameof(SocketMethods_WithBools_MemberData))]
public void EventSource_SocketConnectFailure_LogsConnectFailed(string connectMethod, bool useDnsEndPoint)
public async Task EventSource_SocketConnectFailure_LogsConnectFailed(string connectMethod, bool useDnsEndPoint)
{
// Skip test on Linux kernels that may have a regression that was fixed in 6.6.
// See TcpReceiveSendGetsCanceledByDispose test for additional information.
@@ -200,7 +200,7 @@ public void EventSource_SocketConnectFailure_LogsConnectFailed(string connectMet
return;
}

RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) =>
await RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) =>
{
EndPoint endPoint = await GetRemoteEndPointAsync(useDnsEndPointString, port: 12345);

@@ -236,15 +236,15 @@ await listener.RunWithCallbackAsync(e => events.Enqueue((e, e.ActivityId)), asyn
int? expectedCount = bool.Parse(useDnsEndPointString) ? null : 1;
VerifyEvents(events, connect: true, expectedCount, shouldHaveFailures: true);
VerifyEventCounters(events, connectCount: 0);
}, connectMethod, useDnsEndPoint.ToString()).Dispose();
}, connectMethod, useDnsEndPoint.ToString()).DisposeAsync();
}

[OuterLoop]
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[MemberData(nameof(SocketMethods_MemberData))]
public void EventSource_SocketAcceptFailure_LogsAcceptFailed(string acceptMethod)
public async Task EventSource_SocketAcceptFailure_LogsAcceptFailed(string acceptMethod)
{
RemoteExecutor.Invoke(async acceptMethod =>
await RemoteExecutor.Invoke(async acceptMethod =>
{
using var listener = new TestEventListener("System.Net.Sockets", EventLevel.Verbose, 0.1);
listener.AddActivityTracking();
@@ -271,7 +271,7 @@ await Assert.ThrowsAnyAsync<Exception>(async () =>

VerifyEvents(events, connect: false, expectedCount: 1, shouldHaveFailures: true);
VerifyEventCounters(events, connectCount: 0);
}, acceptMethod).Dispose();
}, acceptMethod).DisposeAsync();
}

[OuterLoop]
@@ -280,9 +280,9 @@ await Assert.ThrowsAnyAsync<Exception>(async () =>
[InlineData("Task", false)]
[InlineData("Eap", true)]
[InlineData("Eap", false)]
public void EventSource_ConnectAsyncCanceled_LogsConnectFailed(string connectMethod, bool useDnsEndPoint)
public async Task EventSource_ConnectAsyncCanceled_LogsConnectFailed(string connectMethod, bool useDnsEndPoint)
{
RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) =>
await RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) =>
{
EndPoint endPoint = await GetRemoteEndPointAsync(useDnsEndPointString, port: 12345);

@@ -336,7 +336,7 @@ await Assert.ThrowsAnyAsync<Exception>(async () =>
int? expectedCount = bool.Parse(useDnsEndPointString) ? null : 1;
VerifyEvents(events, connect: true, expectedCount, shouldHaveFailures: true);
VerifyEventCounters(events, connectCount: 0);
}, connectMethod, useDnsEndPoint.ToString()).Dispose();
}, connectMethod, useDnsEndPoint.ToString()).DisposeAsync();
}

[OuterLoop]
Original file line number Diff line number Diff line change
@@ -467,13 +467,13 @@ public void Socket_CreateUnixDomainSocket_Throws_OnWindows()

[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets in our CI environment")]
public void UnixDomainSocketEndPoint_RelativePathDeletesFile()
public async Task UnixDomainSocketEndPoint_RelativePathDeletesFile()
{
if (!Socket.OSSupportsUnixDomainSockets)
{
return;
}
RemoteExecutor.Invoke(() =>
await RemoteExecutor.Invoke(() =>
{
using (Socket socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified))
{
@@ -501,7 +501,7 @@ public void UnixDomainSocketEndPoint_RelativePathDeletesFile()
Directory.Delete(otherDir);
}
}
}).Dispose();
}).DisposeAsync();
}

[ConditionalFact(typeof(Socket), nameof(Socket.OSSupportsUnixDomainSockets))]