From 0ed9361f50133fc98faed94d3910049f4f9ba49a Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 10:20:34 +0200
Subject: [PATCH 01/20] docs: Use codeinclude in module examples
---
docs/examples/aspnet.md | 2 +-
docs/modules/elasticsearch.md | 42 +++----------------
.../Testcontainers.Elasticsearch.Tests.csproj | 2 +
3 files changed, 9 insertions(+), 37 deletions(-)
diff --git a/docs/examples/aspnet.md b/docs/examples/aspnet.md
index 7c5ffda29..dfde6a277 100644
--- a/docs/examples/aspnet.md
+++ b/docs/examples/aspnet.md
@@ -81,7 +81,7 @@ dotnet add package Testcontainers.MsSql --version 3.0.0
!!! note
- The Microsoft SQL Server Docker image is not compatible with ARM devices, such as Macs with Apple Silicon. Instead, you can use the [SqlEdge](https://www.nuget.org/packages/Testcontainers.SqlEdge) module or [Testcontainers Cloud](https://www.testcontainers.cloud/).
+ When running on Macs with Apple Silicon, make sure that you are using Docker Desktop for macOS version 4.16 or newer, and that the Virtualization Framework is enabled, with Rosetta 2 installed to run [x86-64](https://techcommunity.microsoft.com/t5/sql-server-blog/azure-sql-edge-update-september-2023/ba-p/3930827) based containers.
The `WeatherForecastContainer` class configures in the default constructor all dependencies to start the container that hosts our application.
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index 3d141524d..bbe76459c 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -4,47 +4,17 @@
The following example uses the following NuGet packages:
-```console title="Install the NuGet dependencies"
-dotnet add package Testcontainers.Elasticsearch
-dotnet add package Elastic.Clients.Elasticsearch
-dotnet add package xunit
-```
+
+[Dependencies](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:Dependencies
+
IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
Copy and paste the following code into a new `.cs` test file within an existing test project.
-```csharp
-using Elastic.Clients.Elasticsearch;
-using Elastic.Transport;
-using Testcontainers.Elasticsearch;
-using Xunit;
-
-public sealed class ElasticsearchContainerTest : IAsyncLifetime
-{
- private readonly ElasticsearchContainer _elasticsearch
- = new ElasticsearchBuilder().Build();
-
- [Fact]
- public async Task ReadFromElasticsearch()
- {
- var settings = new ElasticsearchClientSettings(new Uri(_elasticsearch.GetConnectionString()));
- settings.ServerCertificateValidationCallback(CertificateValidations.AllowAll);
-
- var client = new ElasticsearchClient(settings);
-
- var stats = await client.PingAsync();
-
- Assert.True(stats.IsValidResponse);
- }
-
- public Task InitializeAsync()
- => _elasticsearch.StartAsync();
-
- public Task DisposeAsync()
- => _elasticsearch.DisposeAsync().AsTask();
-}
-```
+
+[Elasticsearch Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) block:ElasticsearchContainerTest
+
To execute the tests, use the command `dotnet test` from a terminal.
diff --git a/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj b/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
index 1af74e878..14d3572cf 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
+++ b/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From ad9e4de4e79eca41776e568cfce2b1fc5e0e3a0c Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 10:33:34 +0200
Subject: [PATCH 02/20] test: Add code block to cs sources
---
docs/modules/elasticsearch.md | 4 ++--
.../ElasticsearchContainerTest.cs | 2 ++
.../Testcontainers.Elasticsearch.Tests.csproj | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index bbe76459c..61bf89af1 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -5,7 +5,7 @@
The following example uses the following NuGet packages:
-[Dependencies](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:Dependencies
+[Dependencies](../../tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj) inside_block:Dependencies
IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
@@ -13,7 +13,7 @@ IDEs and editors may also require the following packages to run tests: `xunit.ru
Copy and paste the following code into a new `.cs` test file within an existing test project.
-[Elasticsearch Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) block:ElasticsearchContainerTest
+[Elasticsearch Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:ElasticsearchContainerTest
To execute the tests, use the command `dotnet test` from a terminal.
diff --git a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
index 146df0e04..cb5e6f8b4 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
+++ b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
@@ -2,6 +2,7 @@ namespace Testcontainers.Elasticsearch;
public sealed class ElasticsearchContainerTest : IAsyncLifetime
{
+ // Elasticsearch {
private readonly ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();
public Task InitializeAsync()
@@ -30,4 +31,5 @@ public void PingReturnsValidResponse()
// Then
Assert.True(response.IsValidResponse);
}
+ // }
}
\ No newline at end of file
diff --git a/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj b/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
index 14d3572cf..b53ed9b15 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
+++ b/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
@@ -5,13 +5,13 @@
false
-
+
-
+
From 3d24d8c5e4a750d5f4bfad25fe9401b13446e909 Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 10:43:47 +0200
Subject: [PATCH 03/20] fix: Use correct codeinclude name
---
docs/modules/elasticsearch.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index 61bf89af1..10a8144a4 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -13,7 +13,7 @@ IDEs and editors may also require the following packages to run tests: `xunit.ru
Copy and paste the following code into a new `.cs` test file within an existing test project.
-[Elasticsearch Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:ElasticsearchContainerTest
+[Elasticsearch Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:Elasticsearch
To execute the tests, use the command `dotnet test` from a terminal.
From 6cd798f78ecc76bbe02c0869f8e74a2bf69f6d8b Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 11:12:35 +0200
Subject: [PATCH 04/20] test: Do not use same text for title and code block
---
docs/modules/elasticsearch.md | 8 +++-----
.../ElasticsearchContainerTest.cs | 2 +-
.../Testcontainers.Elasticsearch.Tests.csproj | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index 10a8144a4..9ad69c74b 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -2,18 +2,16 @@
[Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease.
-The following example uses the following NuGet packages:
+The following example uses the following NuGet dependencies:
-[Dependencies](../../tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj) inside_block:Dependencies
+[Package References](../../tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj) inside_block:PackageReferences
-IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
-
Copy and paste the following code into a new `.cs` test file within an existing test project.
-[Elasticsearch Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:Elasticsearch
+[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:CreateElasticsearchContainer
To execute the tests, use the command `dotnet test` from a terminal.
diff --git a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
index cb5e6f8b4..9e2e737c7 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
+++ b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
@@ -2,7 +2,7 @@ namespace Testcontainers.Elasticsearch;
public sealed class ElasticsearchContainerTest : IAsyncLifetime
{
- // Elasticsearch {
+ // CreateElasticsearchContainer {
private readonly ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();
public Task InitializeAsync()
diff --git a/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj b/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
index b53ed9b15..a6224b845 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
+++ b/tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj
@@ -5,7 +5,7 @@
false
-
+
From 25f1f5f67d831d41a7b0725049312e54dd642c58 Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 11:35:17 +0200
Subject: [PATCH 05/20] fix: Add pymdownx.tabbed extension
---
mkdocs.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mkdocs.yml b/mkdocs.yml
index 8c43c04de..fa957f190 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -24,6 +24,8 @@ markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
+ - pymdownx.tabbed:
+ alternate_style: true
nav:
- index.md
- cicd/index.md
From 2d0ba1ada4e4585dfb0a04913a19b834414da7eb Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 12:31:24 +0200
Subject: [PATCH 06/20] chore: Update Elasticsearch doc
---
docs/modules/elasticsearch.md | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index 9ad69c74b..9fbf5cd83 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -2,20 +2,26 @@
[Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease.
-The following example uses the following NuGet dependencies:
+Add the following dependency to your project file:
+
+```console title="NuGet"
+dotnet add package Testcontainers.Elasticsearch
+```
+
+You can start an Elasticsearch container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-[Package References](../../tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj) inside_block:PackageReferences
+[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:CreateElasticsearchContainer
-Copy and paste the following code into a new `.cs` test file within an existing test project.
+The test example uses the following NuGet dependencies:
-[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:CreateElasticsearchContainer
+[Package References](../../tests/Testcontainers.Elasticsearch.Tests/Testcontainers.Elasticsearch.Tests.csproj) inside_block:PackageReferences
To execute the tests, use the command `dotnet test` from a terminal.
## A Note To Developers
-The Testcontainers module creates a container that listens to requests over **HTTPS**. To communicate with the Elasticsearch instance, developers must create a `ElasticsearchClientSettings` instance and set the `ServerCertificateValidationCallback` delegate to `CertificateValidations.AllowAll`. Failing to do so will result in a communication failure as the .NET will reject the certificate coming from the container.
+The Testcontainers module creates a container that listens to requests over **HTTPS**. To communicate with the Elasticsearch instance, developers must create a `ElasticsearchClientSettings` instance and set the `ServerCertificateValidationCallback` delegate to `CertificateValidations.AllowAll`. Failing to do so will result in a communication failure as the .NET will reject the certificate coming from the container.
\ No newline at end of file
From 4f3decc94231ac27c07a70777cc2986240c1abb3 Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 14:49:18 +0200
Subject: [PATCH 07/20] docs: Use codeinclude for MongoDB doc
---
docs/modules/elasticsearch.md | 2 +-
docs/modules/mongodb.md | 54 +++++++------------
.../ElasticsearchContainerTest.cs | 2 +-
.../MongoDbContainerTest.cs | 6 +++
.../Testcontainers.MongoDb.Tests.csproj | 2 +
5 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index 9fbf5cd83..f06cdc459 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -11,7 +11,7 @@ dotnet add package Testcontainers.Elasticsearch
You can start an Elasticsearch container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:CreateElasticsearchContainer
+[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:UseElasticsearchContainer
The test example uses the following NuGet dependencies:
diff --git a/docs/modules/mongodb.md b/docs/modules/mongodb.md
index 7ebbdc6b1..b977251f8 100644
--- a/docs/modules/mongodb.md
+++ b/docs/modules/mongodb.md
@@ -2,54 +2,36 @@
[MongoDB](https://www.mongodb.com/what-is-mongodb) is a cross-platform document-oriented database. MongoDB's document model is simple for developers to use within their applications, while still providing all the complex capabilities of traditional relational databases.
-The following example uses the following NuGet packages:
+Add the following dependency to your project file:
-```console title="Install the NuGet dependencies"
+```console title="NuGet"
dotnet add package Testcontainers.MongoDb
-dotnet add package MongoDB.Driver
-dotnet add package xunit
```
-IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
+You can start an MongoDB container instance from any .NET application. Here, we create different container instances and pass them to the base test class. This allows us to test different configurations.
-Copy and paste the following code into a new `.cs` test file within an existing test project.
+
+[Create Container Instance](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) block:CreateMongoDbContainer
+
-```csharp
-using MongoDB.Driver;
-using Testcontainers.MongoDb;
-using Xunit;
+This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-namespace TestcontainersModules;
+
+[Usage Example](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) inside_block:UseMongoDbContainer
+
-public sealed class MongoDbContainerTest : IAsyncLifetime
-{
- private readonly MongoDbContainer _mongoDbContainer =
- new MongoDbBuilder().Build();
+The test example uses the following NuGet dependencies:
- [Fact]
- public async Task ReadFromMongoDbDatabase()
- {
- var client = new MongoClient(_mongoDbContainer.GetConnectionString());
-
- using var databases = await client.ListDatabasesAsync();
-
- Assert.True(await databases.AnyAsync());
- }
-
- public Task InitializeAsync()
- => _mongoDbContainer.StartAsync();
-
- public Task DisposeAsync()
- => _mongoDbContainer.DisposeAsync().AsTask();
-}
-```
+
+[Package References](../../tests/Testcontainers.MongoDb.Tests/Testcontainers.MongoDb.Tests.csproj) inside_block:PackageReferences
+
To execute the tests, use the command `dotnet test` from a terminal.
## MongoDb Replica Set
-By default, MongoDB runs as a standalone instance. If your tests require a MongoDB replica set, use the code below which will initialize it as a single-node replica set:
+By default, MongoDB runs as a standalone instance. If your tests require a MongoDB replica set, use the following configuration which will initialize a single-node replica set:
-```csharp
-MongoDbContainer _mongoDbContainer = new MongoDbBuilder().WithReplicaSet().Build();
-```
+
+[Usage Example](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) block:ReplicaSetContainerConfiguration
+
\ No newline at end of file
diff --git a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
index 9e2e737c7..974f628c4 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
+++ b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
@@ -2,7 +2,7 @@ namespace Testcontainers.Elasticsearch;
public sealed class ElasticsearchContainerTest : IAsyncLifetime
{
- // CreateElasticsearchContainer {
+ // UseElasticsearchContainer {
private readonly ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();
public Task InitializeAsync()
diff --git a/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs b/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs
index 81cfa2e46..a054f03b6 100644
--- a/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs
+++ b/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs
@@ -12,6 +12,7 @@ private MongoDbContainerTest(MongoDbContainer mongoDbContainer, bool replicaSetE
_replicaSetEnabled = replicaSetEnabled;
}
+ // UseMongoDbContainer {
public Task InitializeAsync()
{
return _mongoDbContainer.StartAsync();
@@ -51,6 +52,7 @@ public async Task ExecScriptReturnsSuccessful()
Assert.True(0L.Equals(execResult.ExitCode), execResult.Stderr);
Assert.Empty(execResult.Stderr);
}
+ // }
[Fact]
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
@@ -76,6 +78,7 @@ public async Task ReplicaSetStatus()
}
}
+ // CreateMongoDbContainer
[UsedImplicitly]
public sealed class MongoDbDefaultConfiguration : MongoDbContainerTest
{
@@ -93,6 +96,7 @@ public MongoDbNoAuthConfiguration()
{
}
}
+ // }
[UsedImplicitly]
public sealed class MongoDbV5Configuration : MongoDbContainerTest
@@ -121,6 +125,7 @@ public MongoDbReplicaSetDefaultConfiguration()
}
}
+ // ReplicaSetContainerConfiguration {
[UsedImplicitly]
public sealed class MongoDbNamedReplicaSetConfiguration : MongoDbContainerTest
{
@@ -129,4 +134,5 @@ public MongoDbNamedReplicaSetConfiguration()
{
}
}
+ // }
}
\ No newline at end of file
diff --git a/tests/Testcontainers.MongoDb.Tests/Testcontainers.MongoDb.Tests.csproj b/tests/Testcontainers.MongoDb.Tests/Testcontainers.MongoDb.Tests.csproj
index 1051176ee..d50ee4594 100644
--- a/tests/Testcontainers.MongoDb.Tests/Testcontainers.MongoDb.Tests.csproj
+++ b/tests/Testcontainers.MongoDb.Tests/Testcontainers.MongoDb.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From 098a84f5d57ee07370620e1e448c6791cae83c7a Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 14:59:55 +0200
Subject: [PATCH 08/20] fix: Add missing curly bracket
---
docs/modules/mongodb.md | 4 ++--
tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/modules/mongodb.md b/docs/modules/mongodb.md
index b977251f8..01545eef3 100644
--- a/docs/modules/mongodb.md
+++ b/docs/modules/mongodb.md
@@ -11,7 +11,7 @@ dotnet add package Testcontainers.MongoDb
You can start an MongoDB container instance from any .NET application. Here, we create different container instances and pass them to the base test class. This allows us to test different configurations.
-[Create Container Instance](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) block:CreateMongoDbContainer
+[Create Container Instance](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) inside_block:CreateMongoDbContainer
This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
@@ -33,5 +33,5 @@ To execute the tests, use the command `dotnet test` from a terminal.
By default, MongoDB runs as a standalone instance. If your tests require a MongoDB replica set, use the following configuration which will initialize a single-node replica set:
-[Usage Example](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) block:ReplicaSetContainerConfiguration
+[Usage Example](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) inside_block:ReplicaSetContainerConfiguration
\ No newline at end of file
diff --git a/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs b/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs
index a054f03b6..c71557072 100644
--- a/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs
+++ b/tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs
@@ -78,7 +78,7 @@ public async Task ReplicaSetStatus()
}
}
- // CreateMongoDbContainer
+ // CreateMongoDbContainer {
[UsedImplicitly]
public sealed class MongoDbDefaultConfiguration : MongoDbContainerTest
{
From 932bb9620fdf03f37c8f4926f1fe3b6449ea6ed8 Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 15:13:47 +0200
Subject: [PATCH 09/20] test: Try inline codeblock
---
docs/modules/elasticsearch.md | 4 ++++
docs/modules/mongodb.md | 4 ++--
.../ElasticsearchContainerTest.cs | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index f06cdc459..1083bf990 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -10,6 +10,10 @@ dotnet add package Testcontainers.Elasticsearch
You can start an Elasticsearch container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
+
+[Create Container Instance](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:CreateElasticsearchContainer
+
+
[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:UseElasticsearchContainer
diff --git a/docs/modules/mongodb.md b/docs/modules/mongodb.md
index 01545eef3..8508fdc9e 100644
--- a/docs/modules/mongodb.md
+++ b/docs/modules/mongodb.md
@@ -8,7 +8,7 @@ Add the following dependency to your project file:
dotnet add package Testcontainers.MongoDb
```
-You can start an MongoDB container instance from any .NET application. Here, we create different container instances and pass them to the base test class. This allows us to test different configurations.
+You can start a MongoDB container instance from any .NET application. Here, we create different container instances and pass them to the base test class. This allows us to test different configurations.
[Create Container Instance](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) inside_block:CreateMongoDbContainer
@@ -33,5 +33,5 @@ To execute the tests, use the command `dotnet test` from a terminal.
By default, MongoDB runs as a standalone instance. If your tests require a MongoDB replica set, use the following configuration which will initialize a single-node replica set:
-[Usage Example](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) inside_block:ReplicaSetContainerConfiguration
+[Replica Set Configuration](../../tests/Testcontainers.MongoDb.Tests/MongoDbContainerTest.cs) inside_block:ReplicaSetContainerConfiguration
\ No newline at end of file
diff --git a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
index 974f628c4..7cb65bde0 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
+++ b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
@@ -3,7 +3,7 @@ namespace Testcontainers.Elasticsearch;
public sealed class ElasticsearchContainerTest : IAsyncLifetime
{
// UseElasticsearchContainer {
- private readonly ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();
+ private readonly /* CreateElasticsearchContainer {*/ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();/*}*/
public Task InitializeAsync()
{
From d98c05c3d47c08a220a346a511b7a297e1c1f30a Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 15:16:52 +0200
Subject: [PATCH 10/20] test: Remove inline codeblock
---
docs/modules/elasticsearch.md | 4 ----
.../ElasticsearchContainerTest.cs | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index 1083bf990..f06cdc459 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -10,10 +10,6 @@ dotnet add package Testcontainers.Elasticsearch
You can start an Elasticsearch container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-
-[Create Container Instance](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:CreateElasticsearchContainer
-
-
[Usage Example](../../tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs) inside_block:UseElasticsearchContainer
diff --git a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
index 7cb65bde0..974f628c4 100644
--- a/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
+++ b/tests/Testcontainers.Elasticsearch.Tests/ElasticsearchContainerTest.cs
@@ -3,7 +3,7 @@ namespace Testcontainers.Elasticsearch;
public sealed class ElasticsearchContainerTest : IAsyncLifetime
{
// UseElasticsearchContainer {
- private readonly /* CreateElasticsearchContainer {*/ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();/*}*/
+ private readonly ElasticsearchContainer _elasticsearchContainer = new ElasticsearchBuilder().Build();
public Task InitializeAsync()
{
From 3a25a7436267282cbc1d148bbc3bde726477eafc Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 16:30:44 +0200
Subject: [PATCH 11/20] docs: Use codeinclude for MSSQL doc
---
docs/modules/mssql.md | 55 ++++++-------------
.../MsSqlContainerTest.cs | 4 ++
.../Testcontainers.MsSql.Tests.csproj | 2 +
3 files changed, 22 insertions(+), 39 deletions(-)
diff --git a/docs/modules/mssql.md b/docs/modules/mssql.md
index 63ff6c70d..4c25776a0 100644
--- a/docs/modules/mssql.md
+++ b/docs/modules/mssql.md
@@ -1,56 +1,33 @@
# Microsoft SQL Server
-[Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server), also known as MSSQL, is a relational database engine developed by Microsoft and is a popular choice in enterprise systems. The following example provides .NET developers with a starting point to use a Microsoft SQL Server instance in the [xUnit][xunit] tests.
+[Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server), also known as MSSQL, is a relational database engine developed by Microsoft and is a popular choice in enterprise systems.
-The following example uses the following NuGet packages:
+Add the following dependency to your project file:
-```console title="Install the NuGet dependencies"
+```console title="NuGet"
dotnet add package Testcontainers.MsSql
-dotnet add package Microsoft.Data.SqlClient
-dotnet add package xunit
```
-IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
+You can start a MSSQL container instance from any .NET application. Here, we create different container instances and pass them to the base test class. This allows us to test different configurations.
-Copy and paste the following code into a new `.cs` test file within an existing test project.
+
+[Create Container Instance](../../tests/Testcontainers.MsSql.Tests/MsSqlContainerTest.cs) inside_block:CreateMsSqlContainer
+
-```csharp
-using Microsoft.Data.SqlClient;
-using Testcontainers.MsSql;
-using Xunit;
+This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-namespace TestcontainersModules;
+
+[Usage Example](../../tests/Testcontainers.MsSql.Tests/MsSqlContainerTest.cs) inside_block:UseMsSqlContainer
+
-public sealed class MsSqlServerContainerTest : IAsyncLifetime
-{
- private readonly MsSqlContainer _msSqlContainer
- = new MsSqlBuilder().Build();
+The test example uses the following NuGet dependencies:
- [Fact]
- public async Task ReadFromMsSqlDatabase()
- {
- await using var connection = new SqlConnection(_msSqlContainer.GetConnectionString());
- await connection.OpenAsync();
-
- await using var command = connection.CreateCommand();
- command.CommandText = "SELECT 1;";
-
- var actual = await command.ExecuteScalarAsync() as int?;
- Assert.Equal(1, actual.GetValueOrDefault());
- }
-
- public Task InitializeAsync()
- => _msSqlContainer.StartAsync();
-
- public Task DisposeAsync()
- => _msSqlContainer.DisposeAsync().AsTask();
-}
-```
+
+[Package References](../../tests/Testcontainers.MsSql.Tests/Testcontainers.MsSql.Tests.csproj) inside_block:PackageReferences
+
To execute the tests, use the command `dotnet test` from a terminal.
## A Note To Developers
-Once Testcontainers creates a server instance, developers may use the connection string with any of the popular data-access technologies found in the .NET Ecosystem. Some of these libraries include [Entity Framework Core](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore), [Dapper](https://www.nuget.org/packages/Dapper), and [NHibernate](https://www.nuget.org/packages/NHibernate). At which point, developers can execute database migrations and SQL scripts.
-
-[xunit]: https://xunit.net/
+Once Testcontainers creates a server instance, developers may use the connection string with any of the popular data-access technologies found in the .NET ecosystem. Some of these libraries include [Entity Framework Core](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore), [Dapper](https://www.nuget.org/packages/Dapper), and [NHibernate](https://www.nuget.org/packages/NHibernate). At which point, developers can execute database migrations and SQL scripts.
\ No newline at end of file
diff --git a/tests/Testcontainers.MsSql.Tests/MsSqlContainerTest.cs b/tests/Testcontainers.MsSql.Tests/MsSqlContainerTest.cs
index 1f94c3b82..3e65695cc 100644
--- a/tests/Testcontainers.MsSql.Tests/MsSqlContainerTest.cs
+++ b/tests/Testcontainers.MsSql.Tests/MsSqlContainerTest.cs
@@ -9,6 +9,7 @@ public MsSqlContainerTest(MsSqlContainer msSqlContainer)
_msSqlContainer = msSqlContainer;
}
+ // UseMsSqlContainer {
public Task InitializeAsync()
{
return _msSqlContainer.StartAsync();
@@ -48,7 +49,9 @@ public async Task ExecScriptReturnsSuccessful()
Assert.True(0L.Equals(execResult.ExitCode), execResult.Stderr);
Assert.Empty(execResult.Stderr);
}
+ // }
+ // CreateMsSqlContainer {
[UsedImplicitly]
public sealed class MsSqlDefaultConfiguration : MsSqlContainerTest
{
@@ -57,6 +60,7 @@ public MsSqlDefaultConfiguration()
{
}
}
+ // }
[UsedImplicitly]
public sealed class MsSqlTools18Configuration : MsSqlContainerTest
diff --git a/tests/Testcontainers.MsSql.Tests/Testcontainers.MsSql.Tests.csproj b/tests/Testcontainers.MsSql.Tests/Testcontainers.MsSql.Tests.csproj
index 1d4ec0882..2ef4d6469 100644
--- a/tests/Testcontainers.MsSql.Tests/Testcontainers.MsSql.Tests.csproj
+++ b/tests/Testcontainers.MsSql.Tests/Testcontainers.MsSql.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From 368e1da258c96e3d33061199a9d05400a2cb0864 Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 16:34:24 +0200
Subject: [PATCH 12/20] docs: Use codeinclude for Neo4j doc
---
docs/modules/neo4j.md | 50 +++++--------------
.../Neo4jContainerTest.cs | 2 +
.../Testcontainers.Neo4j.Tests.csproj | 2 +
3 files changed, 16 insertions(+), 38 deletions(-)
diff --git a/docs/modules/neo4j.md b/docs/modules/neo4j.md
index c93e7189a..70e1b7be4 100644
--- a/docs/modules/neo4j.md
+++ b/docs/modules/neo4j.md
@@ -1,49 +1,23 @@
# Neo4j
-[Neo4j](https://neo4j.com/product/neo4j-graph-database/) is a graph database designed to work with nodes and edges. It is a ACID-compliant transactional graph database engine, and developers can communicate with it using the HTTP endpoint or by using the **Bolt** protocol.
+[Neo4j](https://neo4j.com/product/neo4j-graph-database/) is a graph database designed to work with nodes and edges. It is an ACID-compliant transactional graph database engine, and developers can communicate with it using the HTTP endpoint or by using the **Bolt** protocol.
-The following example uses the following NuGet packages:
+Add the following dependency to your project file:
-```console title="Install the NuGet dependencies"
+```console title="NuGet"
dotnet add package Testcontainers.Neo4j
-dotnet add package Neo4j.Driver
-dotnet add package xunit
```
-IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
+You can start an Neo4j container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-Copy and paste the following code into a new `.cs` test file within an existing test project.
+
+[Usage Example](../../tests/Testcontainers.Neo4j.Tests/Neo4jContainerTest.cs) inside_block:UseNeo4jContainer
+
-```csharp
-using Neo4j.Driver;
-using Testcontainers.Neo4j;
-using Xunit;
+The test example uses the following NuGet dependencies:
-namespace TestcontainersModules;
+
+[Package References](../../tests/Testcontainers.Neo4j.Tests/Testcontainers.Neo4j.Tests.csproj) inside_block:PackageReferences
+
-public sealed class Neo4jContainerTest : IAsyncLifetime
-{
- private readonly Neo4jContainer _neo4jContainer
- = new Neo4jBuilder().Build();
-
- [Fact]
- public async Task CanReadNeo4jDatabase()
- {
- const string database = "neo4j";
-
- await using var client = GraphDatabase.Driver(_neo4jContainer.GetConnectionString());
-
- await using var session = client.AsyncSession(cfg => cfg.WithDatabase(database));
-
- Assert.Equal(database, session.SessionConfig.Database);
- }
-
- public Task InitializeAsync()
- => _neo4jContainer.StartAsync();
-
- public Task DisposeAsync()
- => _neo4jContainer.DisposeAsync().AsTask();
-}
-```
-
-To execute the tests, use the command `dotnet test` from a terminal.
+To execute the tests, use the command `dotnet test` from a terminal.
\ No newline at end of file
diff --git a/tests/Testcontainers.Neo4j.Tests/Neo4jContainerTest.cs b/tests/Testcontainers.Neo4j.Tests/Neo4jContainerTest.cs
index 0e08ff3e3..9609e557b 100644
--- a/tests/Testcontainers.Neo4j.Tests/Neo4jContainerTest.cs
+++ b/tests/Testcontainers.Neo4j.Tests/Neo4jContainerTest.cs
@@ -2,6 +2,7 @@ namespace Testcontainers.Neo4j;
public sealed class Neo4jContainerTest : IAsyncLifetime
{
+ // UseNeo4jContainer {
private readonly Neo4jContainer _neo4jContainer = new Neo4jBuilder().Build();
public Task InitializeAsync()
@@ -29,4 +30,5 @@ public void SessionReturnsDatabase()
// Then
Assert.Equal(database, session.SessionConfig.Database);
}
+ // }
}
\ No newline at end of file
diff --git a/tests/Testcontainers.Neo4j.Tests/Testcontainers.Neo4j.Tests.csproj b/tests/Testcontainers.Neo4j.Tests/Testcontainers.Neo4j.Tests.csproj
index f1b09b5b7..91d78f450 100644
--- a/tests/Testcontainers.Neo4j.Tests/Testcontainers.Neo4j.Tests.csproj
+++ b/tests/Testcontainers.Neo4j.Tests/Testcontainers.Neo4j.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From 1f389f71ad360252229596bed3ba95e44f7691bb Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 16:37:48 +0200
Subject: [PATCH 13/20] docs: Use codeinclude for RabbitMQ doc
---
docs/modules/rabbitmq.md | 78 +++----------------
.../RabbitMqContainerTest.cs | 2 +
.../Testcontainers.RabbitMq.Tests.csproj | 2 +
3 files changed, 16 insertions(+), 66 deletions(-)
diff --git a/docs/modules/rabbitmq.md b/docs/modules/rabbitmq.md
index 16b6f89d6..85d8dfc2e 100644
--- a/docs/modules/rabbitmq.md
+++ b/docs/modules/rabbitmq.md
@@ -1,77 +1,23 @@
# RabbitMQ
-Here is an example of a pre-configured RabbitMQ [module](https://www.nuget.org/packages/Testcontainers.RabbitMq). In this example, Testcontainers is utilized to launch a RabbitMQ server within an [xUnit.net](https://xunit.net/) test. The purpose is to establish a connection to the server, send a message, and subsequently validate the successful transmission and consumption of the message. The process also ensures that the received message corresponds accurately to the originally sent message.
+[RabbitMQ](https://www.rabbitmq.com/) is a message broker that enables reliable communication between distributed applications by managing and routing messages between them.
-Before running the test, make sure to install the required dependencies:
+Add the following dependency to your project file:
-```console title="Install the NuGet dependencies"
+```console title="NuGet"
dotnet add package Testcontainers.RabbitMq
-dotnet add package RabbitMQ.Client
-dotnet add package xunit
```
-Copy and paste the following code into a new `.cs` test file:
+You can start an RabbitMq container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
-```csharp
-using System.Text;
-using System.Threading;
-using RabbitMQ.Client;
-using RabbitMQ.Client.Events;
-using Testcontainers.RabbitMq;
-using Xunit;
+
+[Usage Example](../../tests/Testcontainers.RabbitMq.Tests/RabbitMqContainerTest.cs) inside_block:UseRabbitMqContainer
+
-public sealed class RabbitMqContainerTest : IAsyncLifetime
-{
- private readonly RabbitMqContainer _rabbitMqContainer = new RabbitMqBuilder().Build();
+The test example uses the following NuGet dependencies:
- public Task InitializeAsync()
- {
- return _rabbitMqContainer.StartAsync();
- }
+
+[Package References](../../tests/Testcontainers.RabbitMq.Tests/Testcontainers.RabbitMq.Tests.csproj) inside_block:PackageReferences
+
- public Task DisposeAsync()
- {
- return _rabbitMqContainer.DisposeAsync().AsTask();
- }
-
- [Fact]
- public void ConsumeMessageFromQueue()
- {
- const string queue = "hello";
-
- const string message = "Hello World!";
-
- string actualMessage = null;
-
- // Signal the completion of message reception.
- EventWaitHandle waitHandle = new ManualResetEvent(false);
-
- // Create and establish a connection.
- var connectionFactory = new ConnectionFactory();
- connectionFactory.Uri = new Uri(_rabbitMqContainer.GetConnectionString());
- using var connection = connectionFactory.CreateConnection();
-
- // Send a message to the channel.
- using var channel = connection.CreateModel();
- channel.QueueDeclare(queue, false, false, false, null);
- channel.BasicPublish(string.Empty, queue, null, Encoding.Default.GetBytes(message));
-
- // Consume a message from the channel.
- var consumer = new EventingBasicConsumer(channel);
- consumer.Received += (_, eventArgs) =>
- {
- actualMessage = Encoding.Default.GetString(eventArgs.Body.ToArray());
- waitHandle.Set();
- };
-
- channel.BasicConsume(queue, true, consumer);
- waitHandle.WaitOne(TimeSpan.FromSeconds(1));
-
- Assert.Equal(message, actualMessage);
- }
-}
-```
-
-To execute the tests, use the command `dotnet test` from your terminal.
-
-Read more about the usage of RabbitMQ and .NET [here](https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html).
+To execute the tests, use the command `dotnet test` from a terminal.
\ No newline at end of file
diff --git a/tests/Testcontainers.RabbitMq.Tests/RabbitMqContainerTest.cs b/tests/Testcontainers.RabbitMq.Tests/RabbitMqContainerTest.cs
index 7e1a08f6f..d745848d2 100644
--- a/tests/Testcontainers.RabbitMq.Tests/RabbitMqContainerTest.cs
+++ b/tests/Testcontainers.RabbitMq.Tests/RabbitMqContainerTest.cs
@@ -2,6 +2,7 @@ namespace Testcontainers.RabbitMq;
public sealed class RabbitMqContainerTest : IAsyncLifetime
{
+ // UseRabbitMqContainer {
private readonly RabbitMqContainer _rabbitMqContainer = new RabbitMqBuilder().Build();
public Task InitializeAsync()
@@ -28,4 +29,5 @@ public void IsOpenReturnsTrue()
// Then
Assert.True(connection.IsOpen);
}
+ // }
}
\ No newline at end of file
diff --git a/tests/Testcontainers.RabbitMq.Tests/Testcontainers.RabbitMq.Tests.csproj b/tests/Testcontainers.RabbitMq.Tests/Testcontainers.RabbitMq.Tests.csproj
index ad9f4d6f0..71fd05fb9 100644
--- a/tests/Testcontainers.RabbitMq.Tests/Testcontainers.RabbitMq.Tests.csproj
+++ b/tests/Testcontainers.RabbitMq.Tests/Testcontainers.RabbitMq.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From 5a424f47d4dec4e02446bb0b1c95bda7627109cc Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 16:56:45 +0200
Subject: [PATCH 14/20] docs: Use codeinclude for PostgreSQL doc
---
docs/modules/postgres.md | 43 ++++++-------------
docs/modules/rabbitmq.md | 2 +-
.../PostgreSqlContainerTest.cs | 2 +
.../Testcontainers.PostgreSql.Tests.csproj | 2 +
4 files changed, 19 insertions(+), 30 deletions(-)
diff --git a/docs/modules/postgres.md b/docs/modules/postgres.md
index 9d0567b51..92df22227 100644
--- a/docs/modules/postgres.md
+++ b/docs/modules/postgres.md
@@ -1,36 +1,21 @@
# PostgreSQL
-Here is an example of a pre-configured PostgreSQL [module](https://www.nuget.org/packages/Testcontainers.PostgreSql). In the example, Testcontainers starts a PostgreSQL database in a [xUnit.net][xunit] test and executes a SQL query against it.
+Add the following dependency to your project file:
-```csharp
-public sealed class PostgreSqlContainerTest : IAsyncLifetime
-{
- private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder().Build();
+```console title="NuGet"
+dotnet add package Testcontainers.PostgreSql
+```
- public Task InitializeAsync()
- {
- return _postgreSqlContainer.StartAsync();
- }
+You can start an PostgreSQL container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
- public Task DisposeAsync()
- {
- return _postgreSqlContainer.DisposeAsync().AsTask();
- }
+
+[Usage Example](../../tests/Testcontainers.PostgreSql.Tests/PostgreSqlContainerTest.cs) inside_block:UsePostgreSqlContainer
+
- [Fact]
- public void ExecuteCommand()
- {
- using (DbConnection connection = new NpgsqlConnection(_postgreSqlContainer.GetConnectionString()))
- {
- using (DbCommand command = new NpgsqlCommand())
- {
- connection.Open();
- command.Connection = connection;
- command.CommandText = "SELECT 1";
- }
- }
- }
-}
-```
+The test example uses the following NuGet dependencies:
+
+
+[Package References](../../tests/Testcontainers.PostgreSql.Tests/Testcontainers.PostgreSql.Tests.csproj) inside_block:PackageReferences
+
-[xunit]: https://xunit.net/
+To execute the tests, use the command `dotnet test` from a terminal.
\ No newline at end of file
diff --git a/docs/modules/rabbitmq.md b/docs/modules/rabbitmq.md
index 85d8dfc2e..d0557fb89 100644
--- a/docs/modules/rabbitmq.md
+++ b/docs/modules/rabbitmq.md
@@ -8,7 +8,7 @@ Add the following dependency to your project file:
dotnet add package Testcontainers.RabbitMq
```
-You can start an RabbitMq container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
+You can start a RabbitMQ container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
[Usage Example](../../tests/Testcontainers.RabbitMq.Tests/RabbitMqContainerTest.cs) inside_block:UseRabbitMqContainer
diff --git a/tests/Testcontainers.PostgreSql.Tests/PostgreSqlContainerTest.cs b/tests/Testcontainers.PostgreSql.Tests/PostgreSqlContainerTest.cs
index a92461dbd..ab03d8aa9 100644
--- a/tests/Testcontainers.PostgreSql.Tests/PostgreSqlContainerTest.cs
+++ b/tests/Testcontainers.PostgreSql.Tests/PostgreSqlContainerTest.cs
@@ -2,6 +2,7 @@ namespace Testcontainers.PostgreSql;
public sealed class PostgreSqlContainerTest : IAsyncLifetime
{
+ // UsePostgreSqlContainer {
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder().Build();
public Task InitializeAsync()
@@ -43,6 +44,7 @@ public async Task ExecScriptReturnsSuccessful()
Assert.True(0L.Equals(execResult.ExitCode), execResult.Stderr);
Assert.Empty(execResult.Stderr);
}
+ // }
public sealed class ReuseContainerTest : IClassFixture, IDisposable
{
diff --git a/tests/Testcontainers.PostgreSql.Tests/Testcontainers.PostgreSql.Tests.csproj b/tests/Testcontainers.PostgreSql.Tests/Testcontainers.PostgreSql.Tests.csproj
index d254639c5..6c20b7979 100644
--- a/tests/Testcontainers.PostgreSql.Tests/Testcontainers.PostgreSql.Tests.csproj
+++ b/tests/Testcontainers.PostgreSql.Tests/Testcontainers.PostgreSql.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From 9d8e668a7ba3432b0321bccf7eb82376b8613dac Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 17:06:42 +0200
Subject: [PATCH 15/20] docs: Use codeinclude for Apache Pulsar doc
---
docs/modules/postgres.md | 2 +
docs/modules/pulsar.md | 84 +++++--------------
.../PulsarContainerTest.cs | 4 +
.../Testcontainers.Pulsar.Tests.csproj | 2 +
4 files changed, 27 insertions(+), 65 deletions(-)
diff --git a/docs/modules/postgres.md b/docs/modules/postgres.md
index 92df22227..82d0f2d48 100644
--- a/docs/modules/postgres.md
+++ b/docs/modules/postgres.md
@@ -1,5 +1,7 @@
# PostgreSQL
+[PostgreSQL](https://www.postgresql.org/) is a powerful, open-source relational database management system (RDBMS) used to store, manage, and retrieve structured data.
+
Add the following dependency to your project file:
```console title="NuGet"
diff --git a/docs/modules/pulsar.md b/docs/modules/pulsar.md
index 39b582a23..fc4521e02 100644
--- a/docs/modules/pulsar.md
+++ b/docs/modules/pulsar.md
@@ -1,86 +1,40 @@
# Apache Pulsar
-Testcontainers can be used to automatically create [Apache Pulsar](https://pulsar.apache.org) containers without the need for external services. Based on the official Apache Pulsar Docker image, it is recommended to read the official [getting started](https://pulsar.apache.org/docs/next/getting-started-docker/) guide.
+[Apache Pulsar](https://pulsar.apache.org/) is a distributed messaging and event streaming platform designed for high-throughput, low-latency data processing across multiple topics.
-The following example uses the following NuGet packages:
+Add the following dependency to your project file:
-```console title="Install the NuGet dependencies"
+```console title="NuGet"
dotnet add package Testcontainers.Pulsar
-dotnet add package DotPulsar
-dotnet add package xunit
```
-IDEs and editors may also require the following packages to run tests: `xunit.runner.visualstudio` and `Microsoft.NET.Test.Sdk`.
+You can start a Apache Pulsar container instance from any .NET application. Here, we create different container instances and pass them to the base test class. This allows us to test different configurations.
-Copy and paste the following code into a new `.cs` test file within an existing test project.
+
+[Create Container Instance](../../tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs) inside_block:CreatePulsarContainer
+
-```csharp
-using System;
-using System.Text;
-using System.Threading.Tasks;
-using DotPulsar;
-using DotPulsar.Extensions;
-using Xunit;
-
-namespace Testcontainers.Pulsar;
-
-public sealed class PulsarContainerTest : IAsyncLifetime
-{
- private readonly PulsarContainer _pulsarContainer =
- new PulsarBuilder().Build();
-
- [Fact]
- public async Task ConsumerReceivesSendMessage()
- {
- const string helloPulsar = "Hello, Pulsar!";
-
- var topic = $"persistent://public/default/{Guid.NewGuid():D}";
-
- var name = Guid.NewGuid().ToString("D");
-
- await using var client = PulsarClient.Builder()
- .ServiceUrl(new Uri(_pulsarContainer.GetBrokerAddress()))
- .Build();
-
- await using var producer = client.NewProducer(Schema.String)
- .Topic(topic)
- .Create();
+This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method.
- await using var consumer = client.NewConsumer(Schema.String)
- .Topic(topic)
- .SubscriptionName(name)
- .InitialPosition(SubscriptionInitialPosition.Earliest)
- .Create();
+
+[Usage Example](../../tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs) inside_block:UsePulsarContainer
+
- _ = await producer.Send(helloPulsar)
- .ConfigureAwait(true);
+The test example uses the following NuGet dependencies:
- var message = await consumer.Receive()
- .ConfigureAwait(true);
-
- Assert.Equal(helloPulsar, Encoding.Default.GetString(message.Data));
- }
-
- public Task InitializeAsync()
- => _pulsarContainer.StartAsync();
-
- public Task DisposeAsync()
- => _pulsarContainer.DisposeAsync().AsTask();
-}
-```
+
+[Package References](../../tests/Testcontainers.Pulsar.Tests/Testcontainers.Pulsar.Tests.csproj) inside_block:PackageReferences
+
To execute the tests, use the command `dotnet test` from a terminal.
-## Access Pulsar
+## Access Apache Pulsar
-To get the Pulsar broker URL use:
-
-```csharp
+```csharp title="Gets the Pulsar broker URL"
string pulsarBrokerUrl = _pulsarContainer.GetPulsarBrokerUrl();
```
-To get the Pulsar service URL use:
-```csharp
+```csharp title="Gets the Pulsar service URL"
string pulsarServiceUrl = _pulsarContainer.GetHttpServiceUrl();
```
@@ -112,4 +66,4 @@ If you need to use Pulsar Functions, use the following builder configuration to
```csharp
PulsarContainer _pulsarContainer = PulsarBuilder().WithFunctions().Build();
-```
+```
\ No newline at end of file
diff --git a/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs b/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
index 997ccfd59..4c726d735 100644
--- a/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
+++ b/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
@@ -11,6 +11,7 @@ private PulsarContainerTest(PulsarContainer pulsarContainer)
protected abstract Task CreateClientAsync(CancellationToken ct = default);
+ // UsePulsarContainer {
public Task InitializeAsync()
{
return _pulsarContainer.StartAsync();
@@ -54,14 +55,17 @@ public async Task ConsumerReceivesSendMessage()
// Then
Assert.Equal(helloPulsar, Encoding.Default.GetString(message.Data));
}
+ // }
[UsedImplicitly]
public sealed class PulsarDefaultConfiguration : PulsarContainerTest
{
+ // CreatePulsarContainer {
public PulsarDefaultConfiguration()
: base(new PulsarBuilder().Build())
{
}
+ // }
protected override Task CreateClientAsync(CancellationToken ct = default)
{
diff --git a/tests/Testcontainers.Pulsar.Tests/Testcontainers.Pulsar.Tests.csproj b/tests/Testcontainers.Pulsar.Tests/Testcontainers.Pulsar.Tests.csproj
index 7faabcd5d..63d41e13c 100644
--- a/tests/Testcontainers.Pulsar.Tests/Testcontainers.Pulsar.Tests.csproj
+++ b/tests/Testcontainers.Pulsar.Tests/Testcontainers.Pulsar.Tests.csproj
@@ -5,11 +5,13 @@
false
+
+
From 3e523a71144f13492603f45c1f9fc99e78ea823c Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 17:12:54 +0200
Subject: [PATCH 16/20] chore: Add missing module Milvus
---
docs/modules/index.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/modules/index.md b/docs/modules/index.md
index 2c2cf5ea2..e7455d187 100644
--- a/docs/modules/index.md
+++ b/docs/modules/index.md
@@ -47,6 +47,7 @@ await moduleNameContainer.StartAsync();
| Kusto emulator | `mcr.microsoft.com/azuredataexplorer/kustainer-linux:latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.Kusto) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Kusto) |
| LocalStack | `localstack/localstack:2.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.LocalStack) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.LocalStack) |
| MariaDB | `mariadb:10.10` | [NuGet](https://www.nuget.org/packages/Testcontainers.MariaDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.MariaDb) |
+| Milvus | `milvusdb/milvus:v2.3.10` | [NuGet](https://www.nuget.org/packages/Testcontainers.Milvus) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Milvus) |
| MinIO | `minio/minio:RELEASE.2023-01-31T02-24-19Z` | [NuGet](https://www.nuget.org/packages/Testcontainers.Minio) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Minio) |
| MongoDB | `mongo:6.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.MongoDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.MongoDb) |
| MySQL | `mysql:8.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.MySql) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.MySql) |
From cad4aa8aa46c8d765d1a50cbddfe971d161238ad Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 17:54:56 +0200
Subject: [PATCH 17/20] chore: Move authenticationEnabled to test class
(Pulsar)
---
.../PulsarContainerTest.cs | 39 ++++++++-----------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs b/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
index 4c726d735..41b71f6cf 100644
--- a/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
+++ b/tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs
@@ -4,13 +4,14 @@ public abstract class PulsarContainerTest : IAsyncLifetime
{
private readonly PulsarContainer _pulsarContainer;
- private PulsarContainerTest(PulsarContainer pulsarContainer)
+ private readonly bool _authenticationEnabled;
+
+ private PulsarContainerTest(PulsarContainer pulsarContainer, bool authenticationEnabled)
{
_pulsarContainer = pulsarContainer;
+ _authenticationEnabled = authenticationEnabled;
}
- protected abstract Task CreateClientAsync(CancellationToken ct = default);
-
// UsePulsarContainer {
public Task InitializeAsync()
{
@@ -32,8 +33,15 @@ public async Task ConsumerReceivesSendMessage()
var name = Guid.NewGuid().ToString("D");
- await using var client = await CreateClientAsync()
- .ConfigureAwait(true);
+ var clientBuilder = PulsarClient.Builder().ServiceUrl(new Uri(_pulsarContainer.GetBrokerAddress()));
+
+ if (_authenticationEnabled)
+ {
+ var authToken = await _pulsarContainer.CreateAuthenticationTokenAsync(Timeout.InfiniteTimeSpan);
+ _ = clientBuilder.Authentication(new TokenAuthentication(authToken));
+ }
+
+ var client = clientBuilder.Build();
await using var producer = client.NewProducer(Schema.String)
.Topic(topic)
@@ -57,36 +65,23 @@ public async Task ConsumerReceivesSendMessage()
}
// }
+ // CreatePulsarContainer {
[UsedImplicitly]
public sealed class PulsarDefaultConfiguration : PulsarContainerTest
{
- // CreatePulsarContainer {
public PulsarDefaultConfiguration()
- : base(new PulsarBuilder().Build())
+ : base(new PulsarBuilder().Build(), false)
{
}
- // }
-
- protected override Task CreateClientAsync(CancellationToken ct = default)
- {
- return Task.FromResult(PulsarClient.Builder().ServiceUrl(new Uri(_pulsarContainer.GetBrokerAddress())).Build());
- }
}
+ // }
[UsedImplicitly]
public sealed class PulsarAuthConfiguration : PulsarContainerTest
{
public PulsarAuthConfiguration()
- : base(new PulsarBuilder().WithAuthentication().Build())
+ : base(new PulsarBuilder().WithAuthentication().Build(), true)
{
}
-
- protected override async Task CreateClientAsync(CancellationToken ct = default)
- {
- var authToken = await _pulsarContainer.CreateAuthenticationTokenAsync(Timeout.InfiniteTimeSpan, ct)
- .ConfigureAwait(false);
-
- return PulsarClient.Builder().ServiceUrl(new Uri(_pulsarContainer.GetBrokerAddress())).Authentication(new TokenAuthentication(authToken)).Build();
- }
}
}
\ No newline at end of file
From 733561ae5b44db05063398f1d0cec19480b83d74 Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 18:02:29 +0200
Subject: [PATCH 18/20] chore: Add ref to our test projects
---
docs/modules/_call_out_test_projects.md | 3 +++
docs/modules/elasticsearch.md | 2 ++
docs/modules/mongodb.md | 2 ++
docs/modules/mssql.md | 2 ++
docs/modules/neo4j.md | 4 +++-
docs/modules/postgres.md | 4 +++-
docs/modules/pulsar.md | 2 ++
docs/modules/rabbitmq.md | 4 +++-
mkdocs.yml | 1 +
9 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 docs/modules/_call_out_test_projects.md
diff --git a/docs/modules/_call_out_test_projects.md b/docs/modules/_call_out_test_projects.md
new file mode 100644
index 000000000..460d8c855
--- /dev/null
+++ b/docs/modules/_call_out_test_projects.md
@@ -0,0 +1,3 @@
+!!!tip
+
+ For the complete source code of this example and additional information, please refer to our [test projects](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/tests).
\ No newline at end of file
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index f06cdc459..ce7fc3a38 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -22,6 +22,8 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
+--8<-- "_call_out_test_projects.md"
+
## A Note To Developers
The Testcontainers module creates a container that listens to requests over **HTTPS**. To communicate with the Elasticsearch instance, developers must create a `ElasticsearchClientSettings` instance and set the `ServerCertificateValidationCallback` delegate to `CertificateValidations.AllowAll`. Failing to do so will result in a communication failure as the .NET will reject the certificate coming from the container.
\ No newline at end of file
diff --git a/docs/modules/mongodb.md b/docs/modules/mongodb.md
index 8508fdc9e..a46453149 100644
--- a/docs/modules/mongodb.md
+++ b/docs/modules/mongodb.md
@@ -28,6 +28,8 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
+--8<-- "_call_out_test_projects.md"
+
## MongoDb Replica Set
By default, MongoDB runs as a standalone instance. If your tests require a MongoDB replica set, use the following configuration which will initialize a single-node replica set:
diff --git a/docs/modules/mssql.md b/docs/modules/mssql.md
index 4c25776a0..152dec894 100644
--- a/docs/modules/mssql.md
+++ b/docs/modules/mssql.md
@@ -28,6 +28,8 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
+--8<-- "_call_out_test_projects.md"
+
## A Note To Developers
Once Testcontainers creates a server instance, developers may use the connection string with any of the popular data-access technologies found in the .NET ecosystem. Some of these libraries include [Entity Framework Core](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore), [Dapper](https://www.nuget.org/packages/Dapper), and [NHibernate](https://www.nuget.org/packages/NHibernate). At which point, developers can execute database migrations and SQL scripts.
\ No newline at end of file
diff --git a/docs/modules/neo4j.md b/docs/modules/neo4j.md
index 70e1b7be4..2e08df5f9 100644
--- a/docs/modules/neo4j.md
+++ b/docs/modules/neo4j.md
@@ -20,4 +20,6 @@ The test example uses the following NuGet dependencies:
[Package References](../../tests/Testcontainers.Neo4j.Tests/Testcontainers.Neo4j.Tests.csproj) inside_block:PackageReferences
-To execute the tests, use the command `dotnet test` from a terminal.
\ No newline at end of file
+To execute the tests, use the command `dotnet test` from a terminal.
+
+--8<-- "_call_out_test_projects.md"
\ No newline at end of file
diff --git a/docs/modules/postgres.md b/docs/modules/postgres.md
index 82d0f2d48..2a3d87f1f 100644
--- a/docs/modules/postgres.md
+++ b/docs/modules/postgres.md
@@ -20,4 +20,6 @@ The test example uses the following NuGet dependencies:
[Package References](../../tests/Testcontainers.PostgreSql.Tests/Testcontainers.PostgreSql.Tests.csproj) inside_block:PackageReferences
-To execute the tests, use the command `dotnet test` from a terminal.
\ No newline at end of file
+To execute the tests, use the command `dotnet test` from a terminal.
+
+--8<-- "_call_out_test_projects.md"
\ No newline at end of file
diff --git a/docs/modules/pulsar.md b/docs/modules/pulsar.md
index fc4521e02..bf6f90643 100644
--- a/docs/modules/pulsar.md
+++ b/docs/modules/pulsar.md
@@ -28,6 +28,8 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
+--8<-- "_call_out_test_projects.md"
+
## Access Apache Pulsar
```csharp title="Gets the Pulsar broker URL"
diff --git a/docs/modules/rabbitmq.md b/docs/modules/rabbitmq.md
index d0557fb89..b7773d258 100644
--- a/docs/modules/rabbitmq.md
+++ b/docs/modules/rabbitmq.md
@@ -20,4 +20,6 @@ The test example uses the following NuGet dependencies:
[Package References](../../tests/Testcontainers.RabbitMq.Tests/Testcontainers.RabbitMq.Tests.csproj) inside_block:PackageReferences
-To execute the tests, use the command `dotnet test` from a terminal.
\ No newline at end of file
+To execute the tests, use the command `dotnet test` from a terminal.
+
+--8<-- "_call_out_test_projects.md"
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index fa957f190..1eb519b0b 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -23,6 +23,7 @@ plugins:
markdown_extensions:
- admonition
- pymdownx.details
+ - pymdownx.snippets
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
From 7b8cd2b178c6aa2a76a1ec7d702764e6f13e777e Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 18:13:31 +0200
Subject: [PATCH 19/20] test: Use different md import
---
docs/modules/elasticsearch.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index ce7fc3a38..b74e29e07 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -22,7 +22,7 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
+{{! include '_call_out_test_projects.md' }}
## A Note To Developers
From 888e25f60853119bd3e10381182bb2c3cd383ade Mon Sep 17 00:00:00 2001
From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Date: Fri, 30 Aug 2024 18:57:58 +0200
Subject: [PATCH 20/20] fix: Use absolute path for snippet import
---
docs/modules/elasticsearch.md | 2 +-
docs/modules/mongodb.md | 2 +-
docs/modules/mssql.md | 2 +-
docs/modules/neo4j.md | 2 +-
docs/modules/postgres.md | 2 +-
docs/modules/pulsar.md | 2 +-
docs/modules/rabbitmq.md | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/docs/modules/elasticsearch.md b/docs/modules/elasticsearch.md
index b74e29e07..24c7ffcda 100644
--- a/docs/modules/elasticsearch.md
+++ b/docs/modules/elasticsearch.md
@@ -22,7 +22,7 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
-{{! include '_call_out_test_projects.md' }}
+--8<-- "docs/modules/_call_out_test_projects.md"
## A Note To Developers
diff --git a/docs/modules/mongodb.md b/docs/modules/mongodb.md
index a46453149..ff4be3cb8 100644
--- a/docs/modules/mongodb.md
+++ b/docs/modules/mongodb.md
@@ -28,7 +28,7 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
+--8<-- "docs/modules/_call_out_test_projects.md"
## MongoDb Replica Set
diff --git a/docs/modules/mssql.md b/docs/modules/mssql.md
index 152dec894..30f4f9bfe 100644
--- a/docs/modules/mssql.md
+++ b/docs/modules/mssql.md
@@ -28,7 +28,7 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
+--8<-- "docs/modules/_call_out_test_projects.md"
## A Note To Developers
diff --git a/docs/modules/neo4j.md b/docs/modules/neo4j.md
index 2e08df5f9..2e0038c2e 100644
--- a/docs/modules/neo4j.md
+++ b/docs/modules/neo4j.md
@@ -22,4 +22,4 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
\ No newline at end of file
+--8<-- "docs/modules/_call_out_test_projects.md"
\ No newline at end of file
diff --git a/docs/modules/postgres.md b/docs/modules/postgres.md
index 2a3d87f1f..eeff3f1e3 100644
--- a/docs/modules/postgres.md
+++ b/docs/modules/postgres.md
@@ -22,4 +22,4 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
\ No newline at end of file
+--8<-- "docs/modules/_call_out_test_projects.md"
\ No newline at end of file
diff --git a/docs/modules/pulsar.md b/docs/modules/pulsar.md
index bf6f90643..05818ccd7 100644
--- a/docs/modules/pulsar.md
+++ b/docs/modules/pulsar.md
@@ -28,7 +28,7 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
+--8<-- "docs/modules/_call_out_test_projects.md"
## Access Apache Pulsar
diff --git a/docs/modules/rabbitmq.md b/docs/modules/rabbitmq.md
index b7773d258..39ac69d33 100644
--- a/docs/modules/rabbitmq.md
+++ b/docs/modules/rabbitmq.md
@@ -22,4 +22,4 @@ The test example uses the following NuGet dependencies:
To execute the tests, use the command `dotnet test` from a terminal.
---8<-- "_call_out_test_projects.md"
\ No newline at end of file
+--8<-- "docs/modules/_call_out_test_projects.md"
\ No newline at end of file