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
12 changes: 6 additions & 6 deletions TESTING_GUIDE.md

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions changelog.d/unreleased/4798.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
category: fixed
issues:
- 4798
affected:
- tests/CodeIndex.Tests/AuditLogSinkTests.cs
- tests/CodeIndex.Tests/CliFlagSchemaTests.cs
- tests/CodeIndex.Tests/CommandErrorWriterTests.cs
- tests/CodeIndex.Tests/TestConsoleLock.cs
- tests/CodeIndex.Tests/ConsoleCaptureTests.cs
- tests/CodeIndex.Tests/DiffCommandHelpersTests.cs
- tests/CodeIndex.Tests/LicensePolicyTests.cs
- tests/CodeIndex.Tests/ProgramCliTests.cs
- tests/CodeIndex.Tests/SymbolExtractorTests.cs
- tests/CodeIndex.Tests/TestTelemetryTests.cs
- TESTING_GUIDE.md
---

## English

- **Console-sensitive tests no longer capture concurrent request-id logs (#4798)** — every test class that owns process-global console streams now belongs to a non-parallel collection, preventing MCP request-id and global diagnostic lines from unrelated tests from entering captured stdout or stderr.

## 日本語

- **console-sensitive test が並行実行された request-id log を取り込まないようになりました (#4798)** — process-global な console stream を占有する全テストクラスを non-parallel collection に所属させ、無関係なテストの MCP request-id や global diagnostic 行が capture 中の stdout / stderr に混入することを防ぎます。
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/AuditLogSinkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace CodeIndex.Tests;

[Collection("Console sensitive")]
public class AuditLogSinkTests
{
[Fact]
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/CliFlagSchemaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace CodeIndex.Tests;
/// #1570 で導入した「フラグ単一情報源」の契約を守るためのテスト群。スキーマと
/// 補完スクリプト、コマンド一覧、parser-vs-completion の許容差分がずれた瞬間に失敗する。
/// </summary>
[Collection("Console sensitive")]
public class CliFlagSchemaTests
{
[Fact]
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/CommandErrorWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CodeIndex.Tests;

[Collection("Console sensitive")]
public class CommandErrorWriterTests
{
[Fact]
Expand Down
36 changes: 30 additions & 6 deletions tests/CodeIndex.Tests/ConsoleCaptureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,38 @@ namespace CodeIndex.Tests;
public class ConsoleCaptureTests
{
[Fact]
public void ImportCancellationFixture_UsesConsoleSensitiveCollection_Issue4650()
public void ConsoleSensitiveCollection_AssignsGlobalCaptureClassesAndDisablesParallelization_Issues4650_4798()
{
var attribute = Assert.Single(
typeof(ExportImportCommandRunnerCancellationTests).CustomAttributes,
static candidate => candidate.AttributeType == typeof(CollectionAttribute));
var collectionName = Assert.Single(attribute.ConstructorArguments);
Type[] consoleSensitiveTypes =
[
typeof(AuditLogSinkTests),
typeof(CliFlagSchemaTests),
typeof(CommandErrorWriterTests),
typeof(DiffCommandHelpersTests),
typeof(ExportImportCommandRunnerCancellationTests),
typeof(LicensePolicyTests),
typeof(ProgramCliTests),
typeof(SymbolExtractorTests),
typeof(TestTelemetryTests),
];

Assert.Equal("Console sensitive", collectionName.Value);
foreach (var type in consoleSensitiveTypes)
{
var attribute = Assert.Single(
type.CustomAttributes,
static candidate => candidate.AttributeType == typeof(CollectionAttribute));
var collectionName = Assert.Single(attribute.ConstructorArguments);
Assert.Equal("Console sensitive", collectionName.Value);
}

var definition = Assert.Single(
typeof(ConsoleSensitiveCollection).CustomAttributes,
static candidate => candidate.AttributeType == typeof(CollectionDefinitionAttribute));
var disableParallelization = Assert.Single(
definition.NamedArguments,
static candidate => candidate.MemberName == nameof(CollectionDefinitionAttribute.DisableParallelization));

Assert.True(Assert.IsType<bool>(disableParallelization.TypedValue.Value));
}

[Fact]
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/DiffCommandHelpersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace CodeIndex.Tests;

[Collection("Console sensitive")]
public sealed class DiffCommandHelpersTests
{
[Fact]
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/LicensePolicyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace CodeIndex.Tests;
/// Guards licensing and distribution metadata from silently drifting back to
/// permissive productization defaults.
/// </summary>
[Collection("Console sensitive")]
public class LicensePolicyTests
{
private static readonly string[] CanonicalLegalNoticeFiles =
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/ProgramCliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace CodeIndex.Tests;
/// Black-box CLI tests for Program entrypoint behavior.
/// Program エントリポイント挙動のブラックボックステスト。
/// </summary>
[Collection("Console sensitive")]
public class ProgramCliTests
{
[ProductionRuntimeFact]
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/SymbolExtractorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace CodeIndex.Tests;
/// Tests for SymbolExtractor.
/// SymbolExtractorのテスト。
/// </summary>
[Collection("Console sensitive")]
public partial class SymbolExtractorTests
{
private static void AssertSymbolsContain(
Expand Down
2 changes: 1 addition & 1 deletion tests/CodeIndex.Tests/TestConsoleLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CodeIndex.Tests;

[CollectionDefinition("Console sensitive")]
[CollectionDefinition("Console sensitive", DisableParallelization = true)]
public sealed class ConsoleSensitiveCollection
{
}
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/TestTelemetryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace CodeIndex.Tests;

[Collection("Console sensitive")]
public sealed class TestTelemetryTests
{
[Fact]
Expand Down
Loading