Skip to content

Commit

Permalink
disable container reuse for now as its not stable yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsonax committed Apr 5, 2024
1 parent 5970e2b commit eb72030
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TestExamplesDotnet.Mssql/MsSqlDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public MsSqlDatabase(MsSqlContainer container, IDatabaseInitializer databaseInit
ConnectionString = $"Server=127.0.0.1,{container.GetMappedPublicPort(1433)};Database={databaseInitializer.GetUniqueDataBaseName()};User Id=sa;Password=yourStrong(!)Password;TrustServerCertificate=True";
}

public void Initialize(IHost host)
public void EnsureInitialized(IHost host)
{
if (!_initialized)
{
Expand Down
1 change: 0 additions & 1 deletion TestExamplesDotnet.Mssql/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public static void RegisterMssqlContainer(this IServiceCollection services)
services.AddTransient<IPooledObjectPolicy<IDatabase>, MsSqlDatabasePoolPolicy>();

var container = new MsSqlBuilder()
.WithReuse(true)
.Build();
Utils.RunWithoutSynchronizationContext(() => container.StartAsync().Wait());
services.AddSingleton(container);
Expand Down
2 changes: 1 addition & 1 deletion TestExamplesDotnet.PostgreSql/PostgreSqlDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PostgreSqlDatabase(PostgreSqlContainer container, IDatabaseInitializer da
ConnectionString = $"Host=127.0.0.1;Port={container.GetMappedPublicPort(5432)};Database={databaseInitializer.GetUniqueDataBaseName()};Username=postgres;Password=postgres;Include Error Detail=true";
}

public void Initialize(IHost host)
public void EnsureInitialized(IHost host)
{
if (!_initialized)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public static void RegisterPostgreSqlContainer(this IServiceCollection services)
services.AddTransient<IPooledObjectPolicy<IDatabase>, PostgreSqlDatabasePoolPolicy>();

var container = new PostgreSqlBuilder()
.WithReuse(true)
.Build();
Utils.RunWithoutSynchronizationContext(() => container.StartAsync().Wait());

Expand Down
2 changes: 1 addition & 1 deletion TestExamplesDotnet/IDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public interface IDatabase
{
string ConnectionString { get; }

public void Initialize(IHost host);
public void EnsureInitialized(IHost host);
public Task Clean();
}
3 changes: 2 additions & 1 deletion TestExamplesDotnet/PooledDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ internal PooledDatabase(ObjectPool<IDatabase> pool)

public void EnsureDatabaseIsReadyForTest(IHost host)
{
_database.Initialize(host);
_database.EnsureInitialized(host);
// Clean the database before and not after the test so that after a test is run you can inspect the database.
Utils.RunWithoutSynchronizationContext(() =>
{
_database.Clean().GetAwaiter().GetResult();
Expand Down

0 comments on commit eb72030

Please sign in to comment.