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
17 changes: 15 additions & 2 deletions src/MonitorWay.Tests/Integration/ErrorApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,22 @@ public async Task ExceptionLoggedAndRecordedOnItsSpan_IsOneOccurrence()

await client.GetAsync("/pay");
await client.GetAsync("/pay");
app.Services.GetRequiredService<MemoryTraceStore>().Tick();

var page = await PostAsync<ErrorsPageDto>(app, "GetErrors", new { query = new { text = "type:Timeout" } });
// The test server answers before the request's span ends, and on .NET 11 the span is named after its route only
// then, so the traces are read once both requests have been joined to their spans.
var store = app.Services.GetRequiredService<MemoryTraceStore>();
ErrorsPageDto page;
var deadline = DateTime.UtcNow.AddSeconds(5);
do
{
store.Tick();
page = await PostAsync<ErrorsPageDto>(app, "GetErrors", new { query = new { text = "type:Timeout" } });
if (page.Errors is [{ Endpoints: ["GET /pay"] }])
break;
await Task.Delay(20);
}
while (DateTime.UtcNow < deadline);

var row = Assert.Single(page.Errors);
Assert.Equal("System.TimeoutException", row.Type);
Assert.Equal(2, row.Count);
Expand Down
Loading