fix(tools,concelier): xunit helper strict-mode + test async disposal

- scripts/test-targeted-xunit.ps1: replace @(x).Count checks with
  [bool] coercion in Assert-FilterShape; StrictMode 'Latest' rejects
  .Count on null even when wrapped in @().
- ConcelierInfrastructureRegistrationTests.AddConcelierPostgresStorage_
  RegistersDurableObservationAndAffectedSymbolServices: wrap provider
  in try/finally with DisposeAsync — ConcelierDataSource is
  IAsyncDisposable only, so sync Dispose at `using` scope end throws.

Follow-up to SPRINT_20260419_027/028.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-19 14:57:24 +03:00
parent 54e3ca1f1a
commit 2e35bf4591
2 changed files with 61 additions and 25 deletions

View File

@@ -60,29 +60,33 @@ public sealed class ConcelierInfrastructureRegistrationTests
[Trait("Category", TestCategories.Unit)]
[Fact]
public void AddConcelierPostgresStorage_RegistersDurableObservationAndAffectedSymbolServices()
public async Task AddConcelierPostgresStorage_RegistersDurableObservationAndAffectedSymbolServices()
{
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
["Postgres:Concelier:ConnectionString"] = "Host=postgres;Database=stellaops;Username=postgres;Password=postgres"
})
.Build();
var services = new ServiceCollection();
services.AddLogging();
services.AddSingleton(TimeProvider.System);
services.AddConcelierSignalsServices();
services.AddConcelierPostgresStorage(configuration);
services.AddConcelierPostgresStorage(options =>
{
options.ConnectionString = "Host=postgres;Database=stellaops;Username=postgres;Password=postgres";
options.SchemaName = "vuln";
});
using var provider = services.BuildServiceProvider(new ServiceProviderOptions
var provider = services.BuildServiceProvider(new ServiceProviderOptions
{
ValidateScopes = true
});
provider.GetRequiredService<IAdvisoryObservationLookup>().Should().BeOfType<PostgresAdvisoryObservationStore>();
provider.GetRequiredService<IAdvisoryObservationSink>().Should().BeOfType<PostgresAdvisoryObservationStore>();
provider.GetRequiredService<IAffectedSymbolStore>().Should().BeOfType<PostgresAffectedSymbolStore>();
provider.GetRequiredService<IAdvisoryLinksetSink>().Should().BeOfType<AdvisoryLinksetCacheRepository>();
try
{
provider.GetRequiredService<IAdvisoryObservationLookup>().Should().BeOfType<PostgresAdvisoryObservationStore>();
provider.GetRequiredService<IAdvisoryObservationSink>().Should().BeOfType<PostgresAdvisoryObservationStore>();
provider.GetRequiredService<IAffectedSymbolStore>().Should().BeOfType<PostgresAffectedSymbolStore>();
provider.GetRequiredService<IAdvisoryLinksetSink>().Should().BeOfType<AdvisoryLinksetCacheRepository>();
}
finally
{
await provider.DisposeAsync();
}
}
}