public async Task <MsSqlStreamStoreV3Fixture> Get( ITestOutputHelper outputHelper, string schema = "dbo") { var fixturePool = _fixturePoolBySchema.GetOrAdd( schema, _ => new ConcurrentQueue <MsSqlStreamStoreV3Fixture>()); if (!fixturePool.TryDequeue(out var fixture)) { var dbUniqueName = (DateTime.UtcNow - DateTime.UnixEpoch).TotalMilliseconds; var databaseName = $"sss-v3-{dbUniqueName}"; var dockerInstance = new DockerMsSqlServerDatabase(databaseName); await dockerInstance.CreateDatabase(); fixture = new MsSqlStreamStoreV3Fixture( schema, dockerInstance, databaseName, onDispose: () => fixturePool.Enqueue(fixture)); outputHelper.WriteLine($"Using new fixture with db {databaseName}"); } else { outputHelper.WriteLine($"Using pooled fixture with db {fixture.DatabaseName}"); } await fixture.Prepare(); return(fixture); }
private async Task Init() { await _databaseInstance.CreateDatabase(); var settings = new MsSqlStreamStoreV3Settings(ConnectionString) { Schema = _schema, GetUtcNow = () => GetUtcNow(), DisableDeletionTracking = _disableDeletionTracking }; Store = new MsSqlStreamStoreV3(settings); if (_createSchema) { await Store.CreateSchemaIfNotExists(); } }
private async Task Init(bool createV1Schema = false) { await _databaseInstance.CreateDatabase(); var settings = new MsSqlStreamStoreSettings(ConnectionString) { Schema = _schema, GetUtcNow = () => GetUtcNow(), }; Store = new MsSqlStreamStore(settings); if (_createSchema) { if (createV1Schema) { await Store.CreateSchema_v1_ForTests(); } else { await Store.CreateSchema(); } } }