public async Task <MsSqlStreamStoreFixture> Get(
            ITestOutputHelper outputHelper,
            string schema = "dbo")
        {
            var fixturePool = _fixturePoolBySchema.GetOrAdd(
                schema,
                _ => new ConcurrentQueue <MsSqlStreamStoreFixture>());

            if (!fixturePool.TryDequeue(out var fixture))
            {
                var databaseName   = $"sss-v2-{Guid.NewGuid():N}";
                var dockerInstance = new SqlServerContainer(databaseName);
                await dockerInstance.Start();

                await dockerInstance.CreateDatabase();

                fixture = new MsSqlStreamStoreFixture(
                    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);
        }
Esempio n. 2
0
        private async Task CreateDatabase()
        {
            if (_databaseNameOverride == null)
            {
                await _containerInstance.Start();

                await _containerInstance.CreateDatabase();
            }
        }
        private async Task CreateDatabase()
        {
            await _containerInstance.Start();

            await _containerInstance.CreateDatabase();
        }