Unify service configuration for ISseEventStreamStore, IMcpTaskStore, and ISessionMigrationHandler (#1362)

This commit is contained in:
Mackinnon Buck 2026-02-23 23:22:59 -08:00 • committed by GitHub
commit 669c36b229
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,17 +22,18 @@ namespace ModelContextProtocol.AspNetCore.Tests;
/// </remarks>
public class DistributedCacheResumabilityIntegrationTests(ITestOutputHelper testOutputHelper) : ResumabilityIntegrationTestsBase(testOutputHelper)
{
private MemoryDistributedCache? _cache;
/// <inheritdoc />
protected override ValueTask<ISseEventStreamStore> CreateEventStreamStoreAsync()
{
// Create a new in-memory distributed cache for each test
_cache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions()));
var cache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions()));
// Configure the store with shorter expiration times suitable for testing
var options = new DistributedCacheEventStreamStoreOptions
{
// Use the in-memory distributed cache
Cache = cache,
// Use shorter polling interval for faster test execution
StreamReaderPollingInterval = TimeSpan.FromMilliseconds(50),
@ -43,7 +44,7 @@ public class DistributedCacheResumabilityIntegrationTests(ITestOutputHelper test
MetadataAbsoluteExpiration = TimeSpan.FromMinutes(10),
};
var store = new DistributedCacheEventStreamStore(_cache, options, LoggerFactory.CreateLogger<DistributedCacheEventStreamStore>());
var store = new DistributedCacheEventStreamStore(Options.Create(options), LoggerFactory.CreateLogger<DistributedCacheEventStreamStore>());
return new ValueTask<ISseEventStreamStore>(store);
}
}