Skip to content
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 @@ -902,13 +902,11 @@ public sealed class TelemetryTest_Http11 : TelemetryTest
public TelemetryTest_Http11(ITestOutputHelper output) : base(output) { }

[OuterLoop]
[ActiveIssue("https://github.com/dotnet/runtime/issues/89035", TestPlatforms.OSX)]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void EventSource_ParallelRequests_LogsNewConnectionIdForEachRequest()
{
RemoteExecutor.Invoke(async () =>
{
TimeSpan timeout = TimeSpan.FromSeconds(60);
const int NumParallelRequests = 4;

using var listener = new TestEventListener("System.Net.Http", EventLevel.Verbose, eventCounterInterval: 0.1d);
Expand All @@ -926,29 +924,35 @@ await Http11LoopbackServerFactory.Singleton.CreateClientAndServerAsync(async uri
Task<HttpResponseMessage>[] responseTasks = Enumerable.Repeat(uri, NumParallelRequests)
.Select(_ => client.GetAsync(uri))
.ToArray();
await Task.WhenAll(responseTasks).WaitAsync(timeout);
}, async server =>

await TestHelper.WhenAllCompletedOrAnyFailed(responseTasks);
},
async server =>
{
ManualResetEventSlim allConnectionsOpen = new(false);
TaskCompletionSource allConnectionsOpen = new(TaskCreationOptions.RunContinuationsAsynchronously);
int connectionCounter = 0;

Task[] parallelConnectionTasks = Enumerable.Repeat(server, NumParallelRequests)
.Select(_ => server.AcceptConnectionAsync(HandleConnectionAsync))
.ToArray();

await Task.WhenAll(parallelConnectionTasks);
await TestHelper.WhenAllCompletedOrAnyFailed(parallelConnectionTasks);

async Task HandleConnectionAsync(GenericLoopbackConnection connection)
{
await connection.ReadRequestDataAsync().WaitAsync(TestHelper.PassingTestTimeout);

if (Interlocked.Increment(ref connectionCounter) == NumParallelRequests)
{
allConnectionsOpen.Set();
allConnectionsOpen.SetResult();
}
await connection.ReadRequestDataAsync().WaitAsync(timeout);
allConnectionsOpen.Wait(timeout);

await allConnectionsOpen.Task.WaitAsync(TestHelper.PassingTestTimeout);

await connection.SendResponseAsync(HttpStatusCode.OK);
}
});
}, options: new GenericLoopbackOptions { ListenBacklog = NumParallelRequests });

await WaitForEventCountersAsync(events);
});

Expand Down