diff --git a/Lite.Tests/AnomalyDetectorTests.cs b/Lite.Tests/AnomalyDetectorTests.cs index a66a8eb..1efdab9 100644 --- a/Lite.Tests/AnomalyDetectorTests.cs +++ b/Lite.Tests/AnomalyDetectorTests.cs @@ -15,7 +15,6 @@ namespace PerformanceMonitorLite.Tests; /// methods (batch requests, sessions, query duration, memory), per-metric thresholds, /// and baseline context metadata. /// -[Collection(BaselineProviderCollection.Name)] public class AnomalyDetectorTests : IDisposable { private readonly string _tempDir; diff --git a/Lite.Tests/BaselineProviderCollection.cs b/Lite.Tests/BaselineProviderCollection.cs deleted file mode 100644 index aa299ec..0000000 --- a/Lite.Tests/BaselineProviderCollection.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Xunit; - -namespace PerformanceMonitorLite.Tests; - -/* BaselineProviderTests and AnomalyDetectorTests both mutate the static - BaselineProvider.CacheTtl field. With assembly-level parallelization - enabled, those two classes must share a collection so they don't run - concurrently and stomp on each other's TTL writes. */ -[CollectionDefinition(Name, DisableParallelization = true)] -public class BaselineProviderCollection -{ - public const string Name = "BaselineProvider"; -} diff --git a/Lite.Tests/BaselineProviderTests.cs b/Lite.Tests/BaselineProviderTests.cs index 2746aba..cdf9cad 100644 --- a/Lite.Tests/BaselineProviderTests.cs +++ b/Lite.Tests/BaselineProviderTests.cs @@ -13,7 +13,6 @@ namespace PerformanceMonitorLite.Tests; /// Tests for BaselineProvider: time-bucketed baseline computation, bucket collapse /// with hysteresis, restart poisoning exclusion, and division-by-zero handling. /// -[Collection(BaselineProviderCollection.Name)] public class BaselineProviderTests : IDisposable { private readonly string _tempDir; diff --git a/Lite.Tests/FinOpsDuckDbFixture.cs b/Lite.Tests/FinOpsDuckDbFixture.cs deleted file mode 100644 index 1afc3d4..0000000 --- a/Lite.Tests/FinOpsDuckDbFixture.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.IO; -using PerformanceMonitorLite.Database; - -namespace PerformanceMonitorLite.Tests; - -/* Shared DuckDB fixture for FinOpsTests. xUnit instantiates this once per - test class (via IClassFixture<>), so all tests in the class share a - single DuckDB file. Each test seeder calls ClearTestDataAsync first - (via the *Async helpers in TestDataSeeder), so cross-test pollution - is prevented without paying the schema-init cost on every test. */ -public sealed class FinOpsDuckDbFixture : IDisposable -{ - public string TempDir { get; } - public string DbPath { get; } - public DuckDbInitializer DuckDb { get; } - - public FinOpsDuckDbFixture() - { - TempDir = Path.Combine(Path.GetTempPath(), "FinOpsTests_" + Guid.NewGuid().ToString("N")[..8]); - Directory.CreateDirectory(TempDir); - DbPath = Path.Combine(TempDir, "test.duckdb"); - DuckDb = new DuckDbInitializer(DbPath); - } - - public void Dispose() - { - try - { - if (Directory.Exists(TempDir)) - Directory.Delete(TempDir, recursive: true); - } - catch { /* Best-effort cleanup */ } - } -} diff --git a/Lite.Tests/FinOpsTests.cs b/Lite.Tests/FinOpsTests.cs index 00bc2c4..60dc3af 100644 --- a/Lite.Tests/FinOpsTests.cs +++ b/Lite.Tests/FinOpsTests.cs @@ -15,13 +15,28 @@ namespace PerformanceMonitorLite.Tests; /// Each test seeds a specific server profile into DuckDB, runs the recommendation or /// scoring engine, and validates the output (categories, findings, severity, savings). /// -public class FinOpsTests : IClassFixture +public class FinOpsTests : IDisposable { + private readonly string _tempDir; + private readonly string _dbPath; private readonly DuckDbInitializer _duckDb; - public FinOpsTests(FinOpsDuckDbFixture fixture) + public FinOpsTests() { - _duckDb = fixture.DuckDb; + _tempDir = Path.Combine(Path.GetTempPath(), "FinOpsTests_" + Guid.NewGuid().ToString("N")[..8]); + Directory.CreateDirectory(_tempDir); + _dbPath = Path.Combine(_tempDir, "test.duckdb"); + _duckDb = new DuckDbInitializer(_dbPath); + } + + public void Dispose() + { + try + { + if (Directory.Exists(_tempDir)) + Directory.Delete(_tempDir, recursive: true); + } + catch { /* Best-effort cleanup */ } } /* ── Over-Provisioned Enterprise ── */ diff --git a/Lite.Tests/Lite.Tests.csproj b/Lite.Tests/Lite.Tests.csproj index 9c973a7..a1c9583 100644 --- a/Lite.Tests/Lite.Tests.csproj +++ b/Lite.Tests/Lite.Tests.csproj @@ -20,8 +20,4 @@ - - - - diff --git a/Lite.Tests/xunit.runner.json b/Lite.Tests/xunit.runner.json deleted file mode 100644 index 078ec50..0000000 --- a/Lite.Tests/xunit.runner.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://xunit.net/schema/v3/xunit.runner.schema.json", - "parallelizeAssembly": true, - "parallelizeTestCollections": true, - "maxParallelThreads": -1, - "parallelAlgorithm": "aggressive" -}