Skip to content
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
15 changes: 15 additions & 0 deletions changelog.d/unreleased/2419.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
category: fixed
issues:
- 2419
affected:
- tests/CodeIndex.Tests/HttpMcpTransportTests.cs
---

## English

- **Stabilized the HTTP MCP request logger regression test (#2419)** — the test now gives the asynchronous request log callback a longer full-suite grace period and reports the records it observed on timeout.

## 日本語

- **HTTP MCP request logger の回帰テストを安定化しました (#2419)** — 非同期 request log callback にフルスイート実行時の猶予を長めに取り、timeout 時には観測済み record を表示するようにしました。
13 changes: 9 additions & 4 deletions tests/CodeIndex.Tests/HttpMcpTransportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ public async Task HttpTransport_RequestLogger_RecordsMethodStatusDurationAndAuth
Assert.Equal(HttpStatusCode.OK, okResponse.StatusCode);
}

// Issue #2434: the successful POST response can reach the client before its
// best-effort request log callback runs, so assert after the async sink catches up.
// Issue #2419: full-suite runs can be slow enough that the successful POST response
// reaches the client noticeably before its best-effort request log callback runs, so
// assert after the async sink catches up.
var snapshot = await WaitForRequestLogRecordsAsync(records, 3);
Assert.Equal(3, snapshot.Length);

Expand Down Expand Up @@ -364,7 +365,8 @@ public void Dispose()
ConcurrentQueue<HttpMcpTransport.HttpRequestLogRecord> records,
int expectedCount)
{
for (var attempt = 0; attempt < 100; attempt++)
var deadline = DateTimeOffset.UtcNow.AddSeconds(5);
while (DateTimeOffset.UtcNow < deadline)
{
if (records.Count >= expectedCount)
return records.ToArray();
Expand All @@ -373,7 +375,10 @@ public void Dispose()
}

var snapshot = records.ToArray();
Assert.Equal(expectedCount, snapshot.Length);
var observed = string.Join(
", ",
snapshot.Select(record => $"{record.Method} {record.Path} {record.StatusCode} auth={record.AuthOutcome} id={record.RequestId ?? "<none>"}"));
Assert.Fail($"Expected {expectedCount} request log records, but observed {snapshot.Length}: {observed}");
return snapshot;
}

Expand Down
Loading