test(unit-tests): silence captured stdout in Testing env
The unit-test suite was spending most of its wall clock writing logs. NUnit captures stdout per test and embeds it in the trx; with HttpLogging emitting full request/response per controller call, EF Core SQL at Information level, and ReferenceDataImporter banners running ~500x (once per factory construction), the trx grew to 3.2 GB and the NUnit result-XML serializer OOMed in StringBuilder.ToString() — which the runner reported as one mysteriously failed test, masking a real date-dependent failure underneath. Three sources silenced under environment "Testing": - appsettings.Testing.json drops Default + Microsoft.AspNetCore + HttpLoggingMiddleware + EntityFrameworkCore to Warning. - Program.cs skips app.UseHttpLogging() entirely (avoids the middleware overhead, not just the log emission). - ReferenceDataImporter takes optional TextWriters; the test factory passes TextWriter.Null. Per-importer helpers become instance methods so they can use the injected writer. Result on a fresh run with ParallelScope.Fixtures already in place: - Test duration: 1m46s -> 59s - Wall clock: 2m23s -> 1m00s - trx size: 3.2 GB -> 1.7 MB The previously-masked date-dependent failure (PackControllerFullCatalog .Info_returns_full_35_pack_catalog_from_production_seed asserting 35 active packs as of 2026-05-23 against a live clock) is now visible and can be addressed separately. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -78,7 +78,8 @@ internal sealed class SVSimTestFactory : WebApplicationFactory<Program>
|
||||
// production uses so tests exercise the same code path. CardCosmeticRewards skipped —
|
||||
// FK to Cards would reject every row against the minimal 3-card test seed below.
|
||||
var dataDir = Path.Combine(AppContext.BaseDirectory, "Data");
|
||||
new ReferenceDataImporter().ImportAllAsync(db, dataDir).GetAwaiter().GetResult();
|
||||
new ReferenceDataImporter(TextWriter.Null, TextWriter.Null)
|
||||
.ImportAllAsync(db, dataDir).GetAwaiter().GetResult();
|
||||
|
||||
// Seed a minimal card set so card-pool tests can resolve a non-empty pool without
|
||||
// requiring the full CardImporter tool or a cards.json file. The set is marked
|
||||
|
||||
Reference in New Issue
Block a user