From b0bf08ed4ace219e94da2b213d2f02209f2a318e Mon Sep 17 00:00:00 2001 From: Widthdom Date: Sat, 22 Aug 2026 03:34:06 +0900 Subject: [PATCH] Decouple plugin fixtures from test assembly size (#5121) --- changelog.d/unreleased/5121.fixed.md | 16 ++++++++++++++++ .../ExtractorPluginRegistryTests.cs | 16 +++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 changelog.d/unreleased/5121.fixed.md diff --git a/changelog.d/unreleased/5121.fixed.md b/changelog.d/unreleased/5121.fixed.md new file mode 100644 index 000000000..99a2fa041 --- /dev/null +++ b/changelog.d/unreleased/5121.fixed.md @@ -0,0 +1,16 @@ +--- +category: fixed +issues: + - 5121 +affected: + - tests/CodeIndex.Tests/ExtractorPluginRegistryTests.cs + - tests/CodeIndex.PluginIsolationFixture/PluginIsolationFixture.cs +--- + +## English + +- **Plugin tests no longer depend on the size of `CodeIndex.Tests.dll` (#5121)** — executable extractor-plugin coverage now enforces use of the dedicated bounded `CodeIndex.PluginIsolationFixture` assembly, so growth in the main test assembly cannot exceed the production 4,096-type inspection limit and break the `net9.0` suite. + +## 日本語 + +- **pluginテストが`CodeIndex.Tests.dll`のサイズに依存しなくなりました (#5121)** — 実行可能なextractor pluginのカバレッジで、専用かつ上限内の`CodeIndex.PluginIsolationFixture` assemblyを使うことを保証し、main test assemblyの増加によってproductionの4,096-type検査上限を超えて`net9.0` suiteが失敗しないようにしました。 diff --git a/tests/CodeIndex.Tests/ExtractorPluginRegistryTests.cs b/tests/CodeIndex.Tests/ExtractorPluginRegistryTests.cs index 36696c811..e833cdb02 100644 --- a/tests/CodeIndex.Tests/ExtractorPluginRegistryTests.cs +++ b/tests/CodeIndex.Tests/ExtractorPluginRegistryTests.cs @@ -8,8 +8,6 @@ using CodeIndex.Models; using CodeIndex.PluginIsolationFixture; -[assembly: CdidxPlugin(ExtractorPluginRegistry.CurrentApiVersion, ExtractorPluginRegistry.CurrentApiVersion)] - namespace CodeIndex.Tests; [Collection("Plugin registry sensitive")] @@ -26,6 +24,18 @@ public ExtractorPluginRegistryTests(TrustedPluginAssemblyFixture trustedPluginAs internal const string SlowPluginConstructorEnvironmentVariable = PluginIsolationFixtureEnvironment.SlowConstructor; internal const string CrashingPluginConstructorEnvironmentVariable = PluginIsolationFixtureEnvironment.CrashingConstructor; + [Fact] + public void PluginFixture_IsDedicatedAndBounded_Issue5121() + { + var testAssembly = typeof(ExtractorPluginRegistryTests).Assembly; + var pluginAssembly = typeof(CollectiblePluginSymbolExtractor).Assembly; + + Assert.NotSame(testAssembly, pluginAssembly); + Assert.Empty(testAssembly.GetCustomAttributes()); + Assert.Single(pluginAssembly.GetCustomAttributes()); + Assert.InRange(pluginAssembly.GetTypes().Length, 1, ExtractorPluginRegistry.MaxExtensionAssemblyTypes); + } + [Fact] public void DoctorIntegrations_DoesNotStartConfiguredPluginWorker_Issue5102() { @@ -337,7 +347,7 @@ public void LoadPluginAssemblies_RejectsUnsafeDirectoryModeAndAncestorSymlink_Is try { Directory.CreateDirectory(pluginDirectory); - File.Copy(Assembly.GetExecutingAssembly().Location, Path.Combine(pluginDirectory, "plugin.dll")); + File.Copy(pluginAssemblyFixturePath, Path.Combine(pluginDirectory, "plugin.dll")); ExtractorPluginRegistry.ResetForTests(); File.SetUnixFileMode(