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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user