public async Task <MySqlStreamStoreFixture> Get(ITestOutputHelper outputHelper)
        {
            if (!_fixturePool.TryDequeue(out var fixture))
            {
                var dbUniqueName   = (DateTime.UtcNow - DateTime.UnixEpoch).TotalMilliseconds;
                var databaseName   = $"sss-v3-{dbUniqueName}";
                var dockerInstance = new MySqlContainer(databaseName);
                await dockerInstance.Start();

                await dockerInstance.CreateDatabase();

                fixture = new MySqlStreamStoreFixture(
                    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);
        }
Beispiel #2
0
 public DatabaseFixture()
 {
     Environment.SetEnvironmentVariable("REAPER_DISABLED", true.ToString());
     this.databaseContainer = new ContainerBuilder <MySqlContainer>()
                              .ConfigureDockerImageName("mysql:5.6")
                              .ConfigureDatabaseConfiguration("root", "integration123", "defaultdb")
                              .Build();
 }
        private void PerformMySqlContainer(ContainerBuilder builder)
        {
            //configuration.ConnectionString = "Data Source=localhost,1433;Initial Catalog=EventStoreDb;Persist Security Info=True;User ID=sa;Password=TTTttt456!@#;Max Pool Size=80;";
            var mySqlContainer = new MySqlContainer("localhost", "EventStoreDb", "TTTttt456", 3306);

            mySqlContainer.InitializeAsync().GetAwaiter().GetResult();
            mySqlContainer.CreateDatabaseAsync().GetAwaiter().GetResult();
            builder.RegisterInstance(mySqlContainer).As <MySqlContainer>().IfNotRegistered(typeof(MySqlContainer)).SingleInstance();
        }
 public DatabaseFixture()
 {
     this.useServiceDatabase = Debugger.IsAttached;
     if (!this.useServiceDatabase)
     {
         Environment.SetEnvironmentVariable("REAPER_DISABLED", true.ToString());
         this.databaseContainer = new ContainerBuilder <MySqlContainer>()
                                  .ConfigureDockerImageName("mysql:5.7")
                                  .ConfigureDatabaseConfiguration("root", "integration123", "integrationdefaultdb")
                                  .Build();
     }
 }
        public MySqlStreamStoreFixture(
            MySqlContainer dockerInstance,
            string databaseName,
            Action onDispose)
        {
            _onDispose   = onDispose;
            DatabaseName = databaseName;
            var connectionString = dockerInstance.ConnectionString;

            _settings = new MySqlStreamStoreSettings(connectionString)
            {
                GetUtcNow = () => GetUtcNow(),
                DisableDeletionTracking     = false,
                AppendDeadlockRetryAttempts = 25
            };
        }
 public MySqlStreamStoreDb(ITestOutputHelper testOutputHelper)
 {
     _databaseManager = new MySqlContainer($"test_{Guid.NewGuid():n}");
 }
 public MySqlMessagesRepositoryTestsFixture()
 {
     _mySql = new MySqlContainer();
     _mySql.Start();
 }