diff --git a/changelog.d/unreleased/2419.fixed.md b/changelog.d/unreleased/2419.fixed.md new file mode 100644 index 0000000000..cae7abc67c --- /dev/null +++ b/changelog.d/unreleased/2419.fixed.md @@ -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 を表示するようにしました。 diff --git a/tests/CodeIndex.Tests/HttpMcpTransportTests.cs b/tests/CodeIndex.Tests/HttpMcpTransportTests.cs index ed7803e22f..37124595a3 100644 --- a/tests/CodeIndex.Tests/HttpMcpTransportTests.cs +++ b/tests/CodeIndex.Tests/HttpMcpTransportTests.cs @@ -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); @@ -364,7 +365,8 @@ public void Dispose() ConcurrentQueue 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(); @@ -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 ?? ""}")); + Assert.Fail($"Expected {expectedCount} request log records, but observed {snapshot.Length}: {observed}"); return snapshot; }