diff --git a/Directory.Packages.props b/Directory.Packages.props
index 0a4db1cff..c516a59f9 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -4,24 +4,24 @@
true
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
@@ -45,7 +45,7 @@
-
+
diff --git a/docs/modules/index.md b/docs/modules/index.md
index 6e6681edb..9d18f1960 100644
--- a/docs/modules/index.md
+++ b/docs/modules/index.md
@@ -34,6 +34,7 @@ await moduleNameContainer.StartAsync();
| Consul | `consul:1.15` | [NuGet](https://www.nuget.org/packages/Testcontainers.Consul) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Consul) |
| Couchbase | `couchbase:community-7.0.2` | [NuGet](https://www.nuget.org/packages/Testcontainers.Couchbase) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Couchbase) |
| CouchDB | `couchdb:3.3` | [NuGet](https://www.nuget.org/packages/Testcontainers.CouchDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.CouchDb) |
+| Db2 | `icr.io/db2_community/db2:12.1.0.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Db2) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Db2) |
| DynamoDB | `amazon/dynamodb-local:1.21.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.DynamoDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.DynamoDb) |
| Elasticsearch | `elasticsearch:8.6.1` | [NuGet](https://www.nuget.org/packages/Testcontainers.Elasticsearch) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Elasticsearch) |
| EventStoreDB | `eventstore/eventstore:22.10.1-buster-slim` | [NuGet](https://www.nuget.org/packages/Testcontainers.EventStoreDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.EventStoreDb) |
@@ -63,7 +64,9 @@ await moduleNameContainer.StartAsync();
| RavenDB | `ravendb/ravendb:5.4-ubuntu-latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.RavenDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.RavenDb) |
| Redis | `redis:7.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Redis) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Redis) |
| Redpanda | `docker.redpanda.com/redpandadata/redpanda:v22.2.1` | [NuGet](https://www.nuget.org/packages/Testcontainers.Redpanda) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Redpanda) |
+| Sftp | `atmoz/sftp:alpine` | [NuGet](https://www.nuget.org/packages/Testcontainers.Sftp) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Sftp) |
| SQL Server | `mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04` | [NuGet](https://www.nuget.org/packages/Testcontainers.MsSql) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.MsSql) |
+| Weaviate | `semitechnologies/weaviate:1.26.14` | [NuGet](https://www.nuget.org/packages/Testcontainers.Weaviate) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Weaviate) |
| WebDriver | `selenium/standalone-chrome:110.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.WebDriver) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.WebDriver) |
## Implement a module
diff --git a/src/Testcontainers.EventHubs/EventHubsBuilder.cs b/src/Testcontainers.EventHubs/EventHubsBuilder.cs
index a24bd217a..3e8fb7476 100644
--- a/src/Testcontainers.EventHubs/EventHubsBuilder.cs
+++ b/src/Testcontainers.EventHubs/EventHubsBuilder.cs
@@ -115,8 +115,8 @@ public override EventHubsContainer Build()
.WithNetworkAliases(AzuriteNetworkAlias)
.Build();
- var eventHubsContainer = WithAzuriteContainer(network, container, AzuriteNetworkAlias);
- return new EventHubsContainer(eventHubsContainer.DockerResourceConfiguration);
+ var eventHubsBuilder = WithAzuriteContainer(network, container, AzuriteNetworkAlias);
+ return new EventHubsContainer(eventHubsBuilder.DockerResourceConfiguration);
}
///
diff --git a/src/Testcontainers.EventHubs/EventHubsContainer.cs b/src/Testcontainers.EventHubs/EventHubsContainer.cs
index c575aec21..9b7259d73 100644
--- a/src/Testcontainers.EventHubs/EventHubsContainer.cs
+++ b/src/Testcontainers.EventHubs/EventHubsContainer.cs
@@ -4,8 +4,6 @@ namespace Testcontainers.EventHubs;
[PublicAPI]
public sealed class EventHubsContainer : DockerContainer
{
- private readonly EventHubsConfiguration _configuration;
-
///
/// Initializes a new instance of the class.
///
@@ -13,7 +11,6 @@ public sealed class EventHubsContainer : DockerContainer
public EventHubsContainer(EventHubsConfiguration configuration)
: base(configuration)
{
- _configuration = configuration;
}
///
diff --git a/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs b/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs
index 7a15b11e2..2d6b0b930 100644
--- a/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs
+++ b/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs
@@ -105,8 +105,8 @@ public override ServiceBusContainer Build()
.WithNetworkAliases(DatabaseNetworkAlias)
.Build();
- var serviceBusContainer = WithMsSqlContainer(network, container, DatabaseNetworkAlias);
- return new ServiceBusContainer(serviceBusContainer.DockerResourceConfiguration);
+ var serviceBusBuilder = WithMsSqlContainer(network, container, DatabaseNetworkAlias);
+ return new ServiceBusContainer(serviceBusBuilder.DockerResourceConfiguration);
}
///
diff --git a/src/Testcontainers.Sftp/SftpBuilder.cs b/src/Testcontainers.Sftp/SftpBuilder.cs
index f294c55a2..d37b7c460 100644
--- a/src/Testcontainers.Sftp/SftpBuilder.cs
+++ b/src/Testcontainers.Sftp/SftpBuilder.cs
@@ -71,7 +71,7 @@ public override SftpContainer Build()
{
Validate();
- var sftpContainer = WithCommand(string.Join(
+ var sftpBuilder = WithCommand(string.Join(
":",
DockerResourceConfiguration.Username,
DockerResourceConfiguration.Password,
@@ -79,7 +79,7 @@ public override SftpContainer Build()
string.Empty,
DockerResourceConfiguration.UploadDirectory));
- return new SftpContainer(sftpContainer.DockerResourceConfiguration);
+ return new SftpContainer(sftpBuilder.DockerResourceConfiguration);
}
///
diff --git a/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs b/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
index b25d6aff2..21af79639 100644
--- a/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
+++ b/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
@@ -41,7 +41,7 @@ public async Task ConsumerReceivesSendMessage()
_ = clientBuilder.Authentication(new TokenAuthentication(authToken));
}
- var client = clientBuilder.Build();
+ await using var client = clientBuilder.Build();
await using var producer = client.NewProducer(Schema.String)
.Topic(topic)
@@ -50,7 +50,6 @@ public async Task ConsumerReceivesSendMessage()
await using var consumer = client.NewConsumer(Schema.String)
.Topic(topic)
.SubscriptionName(name)
- .InitialPosition(SubscriptionInitialPosition.Earliest)
.Create();
// When
diff --git a/tests/Testcontainers.Tests/ContinuousIntegration/JobsTest.cs b/tests/Testcontainers.Tests/ContinuousIntegration/JobsTest.cs
index 16c5e7919..8ec9fb10b 100644
--- a/tests/Testcontainers.Tests/ContinuousIntegration/JobsTest.cs
+++ b/tests/Testcontainers.Tests/ContinuousIntegration/JobsTest.cs
@@ -2,11 +2,11 @@ namespace DotNet.Testcontainers.Tests.ContinuousIntegration
{
using System.IO;
using System.Linq;
- using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
+ using DotNet.Testcontainers.Builders;
using Xunit;
- public partial class JobsTest
+ public sealed partial class JobsTest
{
[GeneratedRegex("name: \"(.+?)\"")]
private static partial Regex ProjectNameRegex();
@@ -15,23 +15,21 @@ public partial class JobsTest
public void AllTestProjectsShouldBeConfiguredForContinuousIntegration()
{
var ciCdFilePath = GetCiCdFilePath();
- var configuredProjects = File.ReadAllLines(ciCdFilePath).Select(line => ProjectNameRegex().Match(line).Groups[1].Value).Where(line => line.Length > 0).ToList();
- Assert.NotEmpty(configuredProjects);
- var existingProjects = Directory.GetFiles(GetTestsPath(), "*.Tests.csproj", SearchOption.AllDirectories).Select(name => Path.GetFileName(name)[..^13]).ToList();
- Assert.NotEmpty(existingProjects);
+ var expectedProjects = File.ReadAllLines(ciCdFilePath).Select(line => ProjectNameRegex().Match(line).Groups[1].Value).Where(line => line.Length > 0).ToList();
+ Assert.NotEmpty(expectedProjects);
- var missingConfiguredProjects = existingProjects.Except(configuredProjects).ToList();
- if (missingConfiguredProjects.Count > 0)
- {
- Assert.Fail($"{string.Join(", ", missingConfiguredProjects)} must be configured in {ciCdFilePath}");
- }
+ var actualProjects = Directory.GetFiles(GetTestsDirectoryPath(), "*.Tests.csproj", SearchOption.AllDirectories).Select(name => Path.GetFileName(name)[..^13]).ToList();
+ Assert.NotEmpty(actualProjects);
+
+ var missingConfiguredProjects = actualProjects.Except(expectedProjects).ToList();
+ Assert.True(missingConfiguredProjects.Count == 0, $"{string.Join(", ", missingConfiguredProjects)} must be configured in '{ciCdFilePath}'.");
}
- private static string GetCiCdFilePath() => Path.Combine(GetRepositoryPath(), ".github", "workflows", "cicd.yml");
+ private static string GetCiCdFilePath() => Path.Combine(GetRepositoryDirectoryPath(), ".github", "workflows", "cicd.yml");
- private static string GetTestsPath() => Path.Combine(GetRepositoryPath(), "tests");
+ private static string GetTestsDirectoryPath() => Path.Combine(GetRepositoryDirectoryPath(), "tests");
- private static string GetRepositoryPath([CallerFilePath] string path = "") => Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path)!, "..", "..", ".."));
+ private static string GetRepositoryDirectoryPath() => CommonDirectoryPath.GetSolutionDirectory().DirectoryPath;
}
}