diff --git a/client-dotnet/src/EvoMaster.DatabaseController/Containers/DockerContainerBase.cs b/client-dotnet/src/EvoMaster.DatabaseController/Containers/DockerContainerBase.cs index 14f231c694..1bd7efd08e 100644 --- a/client-dotnet/src/EvoMaster.DatabaseController/Containers/DockerContainerBase.cs +++ b/client-dotnet/src/EvoMaster.DatabaseController/Containers/DockerContainerBase.cs @@ -14,7 +14,7 @@ namespace EvoMaster.DatabaseController.Containers // credits to https://www.meziantou.net/2018/10/08/integration-testing-using-a-docker-container internal abstract class DockerContainerBase { - protected const string ContainerPrefix = "EvoMaster-DbContainer-"; + protected const string ContainerPrefix = "EvoMaster-DB-"; protected DockerContainerBase(string imageName, string containerName) { diff --git a/client-dotnet/src/EvoMaster.DatabaseController/PostgresDatabaseStarter.cs b/client-dotnet/src/EvoMaster.DatabaseController/PostgresDatabaseStarter.cs index 887bfabfa1..3788e8bd28 100644 --- a/client-dotnet/src/EvoMaster.DatabaseController/PostgresDatabaseStarter.cs +++ b/client-dotnet/src/EvoMaster.DatabaseController/PostgresDatabaseStarter.cs @@ -1,4 +1,5 @@ -using System.Data.Common; +using System; +using System.Data.Common; using System.Threading.Tasks; using DotNet.Testcontainers.Containers.Builders; using DotNet.Testcontainers.Containers.Configurations.Databases; @@ -21,6 +22,7 @@ public PostgresDatabaseController(string databaseName, int port, string password Timeout = timeout; Password = password; } + public string DatabaseName { get; } public int Port { get; } public int Timeout { get; } @@ -29,13 +31,14 @@ public PostgresDatabaseController(string databaseName, int port, string password public async Task<(string, DbConnection)> StartAsync() { var postgresBuilder = new TestcontainersBuilder() + .WithName($"EvoMaster-DB-Postgres-{Guid.NewGuid()}") .WithDatabase(new PostgreSqlTestcontainerConfiguration { Database = DatabaseName, Username = "user", Password = Password }) - .WithExposedPort(Port); + .WithExposedPort(Port).WithCleanUp(true); _database = postgresBuilder.Build(); await _database.StartAsync();