diff --git a/test/Directory.Packages.props b/test/Directory.Packages.props index c4b619677d..72284efe65 100644 --- a/test/Directory.Packages.props +++ b/test/Directory.Packages.props @@ -39,7 +39,7 @@ - + diff --git a/test/IntegrationTests/AspNetTests.cs b/test/IntegrationTests/AspNetTests.cs index 9b5c5f256f..c1c8d156f7 100644 --- a/test/IntegrationTests/AspNetTests.cs +++ b/test/IntegrationTests/AspNetTests.cs @@ -117,7 +117,7 @@ public async Task SubmitMetrics() collector.AssertExpectations(); } - private async Task StartContainerAsync(int webPort) + private async Task StartContainerAsync(int webPort) { // get path to test application that the profiler will attach to string imageName = $"testapplication-aspnet-netframework"; @@ -131,7 +131,7 @@ private async Task StartContainerAsync(int webPort) Directory.CreateDirectory(logPath); Output.WriteLine("Collecting docker logs to: " + logPath); - var builder = new TestcontainersBuilder() + var builder = new ContainerBuilder() .WithImage(imageName) .WithCleanUp(cleanUp: true) .WithOutputConsumer(Consume.RedirectStdoutAndStderrToConsole()) diff --git a/test/IntegrationTests/Helpers/TestContainers/UntilAsyncOperationIsSucceeded.cs b/test/IntegrationTests/Helpers/TestContainers/UntilAsyncOperationIsSucceeded.cs index 47adaea66e..d51d144c67 100644 --- a/test/IntegrationTests/Helpers/TestContainers/UntilAsyncOperationIsSucceeded.cs +++ b/test/IntegrationTests/Helpers/TestContainers/UntilAsyncOperationIsSucceeded.cs @@ -16,7 +16,6 @@ using DotNet.Testcontainers.Configurations; using DotNet.Testcontainers.Containers; -using Microsoft.Extensions.Logging; namespace IntegrationTests.Helpers.TestContainers; @@ -32,7 +31,7 @@ public UntilAsyncOperationIsSucceeded(Func> operation, int maxCallCou _maxCallCount = maxCallCount; } - public async Task Until(ITestcontainersContainer testcontainers, ILogger logger) + public async Task UntilAsync(IContainer container) { if (++_tryCount > _maxCallCount) { diff --git a/test/IntegrationTests/MongoDBCollection.cs b/test/IntegrationTests/MongoDBCollection.cs index fa81eeb129..d5a85d2dc9 100644 --- a/test/IntegrationTests/MongoDBCollection.cs +++ b/test/IntegrationTests/MongoDBCollection.cs @@ -34,7 +34,7 @@ public class MongoDBFixture : IAsyncLifetime private const int MongoDBPort = 27017; private const string MongoDBImage = "mongo:5.0.6"; - private TestcontainersContainer? _container; + private IContainer? _container; public MongoDBFixture() { @@ -56,9 +56,9 @@ public async Task DisposeAsync() } } - private async Task LaunchMongoContainerAsync(int port) + private async Task LaunchMongoContainerAsync(int port) { - var mongoContainersBuilder = new TestcontainersBuilder() + var mongoContainersBuilder = new ContainerBuilder() .WithImage(MongoDBImage) .WithName($"mongo-db-{port}") .WithPortBinding(port, MongoDBPort) @@ -70,9 +70,8 @@ private async Task LaunchMongoContainerAsync(int port) return container; } - private async Task ShutdownMongoContainerAsync(TestcontainersContainer container) + private async Task ShutdownMongoContainerAsync(IContainer container) { - await container.CleanUpAsync(); await container.DisposeAsync(); } } diff --git a/test/IntegrationTests/MySqlCollection.cs b/test/IntegrationTests/MySqlCollection.cs index 1e7fae3678..507ab90493 100644 --- a/test/IntegrationTests/MySqlCollection.cs +++ b/test/IntegrationTests/MySqlCollection.cs @@ -15,11 +15,9 @@ // #if NET6_0_OR_GREATER -using System.Threading.Tasks; using DotNet.Testcontainers.Builders; using DotNet.Testcontainers.Containers; using IntegrationTests.Helpers; -using Xunit; namespace IntegrationTests; @@ -34,7 +32,7 @@ public class MySqlFixture : IAsyncLifetime private const int MySqlPort = 3306; private const string MySqlImage = "mysql:8.0.29"; - private TestcontainersContainer? _container; + private IContainer? _container; public MySqlFixture() { @@ -56,9 +54,9 @@ public async Task DisposeAsync() } } - private async Task LaunchMySqlContainerAsync(int port) + private async Task LaunchMySqlContainerAsync(int port) { - var containersBuilder = new TestcontainersBuilder() + var containersBuilder = new ContainerBuilder() .WithImage(MySqlImage) .WithName($"mysql-{port}") .WithPortBinding(port, MySqlPort) @@ -71,9 +69,8 @@ private async Task LaunchMySqlContainerAsync(int port) return container; } - private async Task ShutdownMySqlContainerAsync(TestcontainersContainer container) + private async Task ShutdownMySqlContainerAsync(IContainer container) { - await container.CleanUpAsync(); await container.DisposeAsync(); } } diff --git a/test/IntegrationTests/PostgresCollection.cs b/test/IntegrationTests/PostgresCollection.cs index 9796c784ab..8b71abd785 100644 --- a/test/IntegrationTests/PostgresCollection.cs +++ b/test/IntegrationTests/PostgresCollection.cs @@ -14,11 +14,9 @@ // limitations under the License. // -using System.Threading.Tasks; using DotNet.Testcontainers.Builders; using DotNet.Testcontainers.Containers; using IntegrationTests.Helpers; -using Xunit; namespace IntegrationTests; @@ -33,7 +31,7 @@ public class PostgresFixture : IAsyncLifetime private const int PostgresPort = 5432; private const string PostgresImage = "postgres:14.4"; - private TestcontainersContainer? _container; + private IContainer? _container; public PostgresFixture() { @@ -55,9 +53,9 @@ public async Task DisposeAsync() } } - private async Task LaunchPostgresContainerAsync(int port) + private async Task LaunchPostgresContainerAsync(int port) { - var containersBuilder = new TestcontainersBuilder() + var containersBuilder = new ContainerBuilder() .WithImage(PostgresImage) .WithName($"postgres-{port}") .WithPortBinding(port, PostgresPort) @@ -70,9 +68,8 @@ private async Task LaunchPostgresContainerAsync(int por return container; } - private async Task ShutdownPostgresContainerAsync(TestcontainersContainer container) + private async Task ShutdownPostgresContainerAsync(IContainer container) { - await container.CleanUpAsync(); await container.DisposeAsync(); } } diff --git a/test/IntegrationTests/RedisCollection.cs b/test/IntegrationTests/RedisCollection.cs index 33d6017011..3e5dd12aeb 100644 --- a/test/IntegrationTests/RedisCollection.cs +++ b/test/IntegrationTests/RedisCollection.cs @@ -16,11 +16,9 @@ #if NET6_0_OR_GREATER -using System.Threading.Tasks; using DotNet.Testcontainers.Builders; using DotNet.Testcontainers.Containers; using IntegrationTests.Helpers; -using Xunit; namespace IntegrationTests; @@ -35,7 +33,7 @@ public class RedisFixture : IAsyncLifetime private const int RedisPort = 6379; private const string RedisImage = "redis:7.0.4"; - private TestcontainersContainer? _container; + private IContainer? _container; public RedisFixture() { @@ -57,9 +55,9 @@ public async Task DisposeAsync() } } - private async Task LaunchRedisContainerAsync(int port) + private async Task LaunchRedisContainerAsync(int port) { - var containersBuilder = new TestcontainersBuilder() + var containersBuilder = new ContainerBuilder() .WithImage(RedisImage) .WithName($"redis-{port}") .WithPortBinding(port, RedisPort) @@ -71,9 +69,8 @@ private async Task LaunchRedisContainerAsync(int port) return container; } - private async Task ShutdownRedisContainerAsync(TestcontainersContainer container) + private async Task ShutdownRedisContainerAsync(IContainer container) { - await container.CleanUpAsync(); await container.DisposeAsync(); } } diff --git a/test/IntegrationTests/SqlServerCollection.cs b/test/IntegrationTests/SqlServerCollection.cs index aff51cd6ad..24acf4d0f6 100644 --- a/test/IntegrationTests/SqlServerCollection.cs +++ b/test/IntegrationTests/SqlServerCollection.cs @@ -33,7 +33,7 @@ public class SqlServerFixture : IAsyncLifetime private const int DatabasePort = 1433; private const string DatabaseImage = "mcr.microsoft.com/mssql/server:2019-CU17-ubuntu-20.04"; - private TestcontainersContainer? _container; + private IContainer? _container; public SqlServerFixture() { @@ -57,15 +57,14 @@ public async Task DisposeAsync() } } - private static async Task ShutdownSqlServerContainerAsync(TestcontainersContainer container) + private static async Task ShutdownSqlServerContainerAsync(IContainer container) { - await container.CleanUpAsync(); await container.DisposeAsync(); } - private async Task LaunchSqlServerContainerAsync() + private async Task LaunchSqlServerContainerAsync() { - var databaseContainersBuilder = new TestcontainersBuilder() + var databaseContainersBuilder = new ContainerBuilder() .WithImage(DatabaseImage) .WithName($"sql-server-{Port}") .WithPortBinding(Port, DatabasePort)