Skip to content

Commit a8482b5

Browse files
authored
docs(Redis): Add example (#1641)
1 parent 5e97c58 commit a8482b5

19 files changed

Lines changed: 112 additions & 22 deletions

docs/api/connection_string_provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The Connection String Provider API provides a standardized way to access and manage connection information for Testcontainers (modules). It allows developers to customize module-provided connection strings or add their own, and to access module-specific connection strings or endpoints (e.g., database connection strings, HTTP API base addresses) in a uniform way.
44

5-
!!!note
5+
!!! note
66

77
Testcontainers modules do not yet implement this feature. Developers can use the provider to define and manage their own connection strings or endpoints. Providers will be integrated by modules in future releases.
88

docs/api/create_docker_container.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _ = new ContainerBuilder()
2222
.WithImage(new DockerImage("postgres:15.1", new Platform("linux/amd64")));
2323
```
2424

25-
!!!tip
25+
!!! tip
2626

2727
A specifier has the format `<os>|<arch>|<os>/<arch>[/<variant>]`. The user can provide either the operating system or the architecture or both. For more details, see [containerd/platforms](https://github.com/containerd/platforms).
2828

@@ -42,7 +42,7 @@ _ = new ContainerBuilder("nginx:1.26.3-alpine3.20")
4242

4343
Apps or services running inside a container are usually configured either with environment variables or configuration files. `WithEnvironment(string, string)` sets an environment variable, while `WithResourceMapping(string, string)` copies a file into a container before it starts. This covers common use cases among many .NET applications.
4444

45-
!!!tip
45+
!!! tip
4646

4747
The majority of builder methods are overloaded and have different parameters to set configurations.
4848

@@ -177,7 +177,7 @@ var postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1")
177177

178178
Using `OverwriteEnumerable<string>(Array.Empty<string>())` removes all default command configurations. This is useful when you want full control over the PostgreSQL startup or when the default configurations do not match your requirements.
179179

180-
!!!tip
180+
!!! tip
181181

182182
You can create your own `ComposableEnumerable<T>` implementation to control exactly how configuration values are composed or modified.
183183

@@ -232,7 +232,7 @@ var magicNumber = await magicNumberReader.ReadLineAsync()
232232
Assert.Equal(MagicNumber, magicNumber);
233233
```
234234

235-
!!!tip
235+
!!! tip
236236

237237
To avoid port conflicts, do not bind a fix host port. Instead, assign a random host port by using `WithPortBinding(80, true)` and retrieve it from the container instance by using `GetMappedPublicPort(80)`.
238238

@@ -269,10 +269,10 @@ Assert.Equal(MagicNumber, magicNumber);
269269
| `WithStartupCallback` | Sets the startup callback to invoke after the container start. |
270270
| `WithCreateParameterModifier` | Allows low level modifications of the Docker container create parameter. |
271271

272-
!!!tip
272+
!!! tip
273273

274274
Testcontainers for .NET detects your Docker host configuration. You do **not** have to set the Docker daemon socket.
275275

276-
!!!tip
276+
!!! tip
277277

278278
Testcontainers for .NET detects private Docker registry configurations and applies the credentials automatically to authenticate against registries.

docs/api/create_docker_image.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To build a Docker image with Testcontainers, it's important to understand the bu
2222
2. **Dockerfile name**: The name of the Dockerfile to use
2323
3. **Dockerfile directory**: Where the Dockerfile is located
2424

25-
!!!tip
25+
!!! tip
2626

2727
The build context is optional. If you don't specify one, it defaults to the Dockerfile directory.
2828

@@ -56,7 +56,7 @@ _ = new ImageFromDockerfileBuilder()
5656

5757
As the tarball's content is based on `/Users/testcontainers/WeatherForecast/`, all paths inside the Dockerfile must be relative to this path. For example, Docker's `COPY` instruction copies all files inside the `WeatherForecast/` directory to the image.
5858

59-
!!!tip
59+
!!! tip
6060

6161
To improve the build time and to reduce the size of the image, it is recommended to include only necessary files. Exclude unnecessary files or directories such as `bin/`, `obj/` and `tests/` with the `.dockerignore` file.
6262

@@ -119,7 +119,7 @@ _ = new ImageFromDockerfileBuilder()
119119
| `WithBuildArgument` | Sets build-time variables e.g `--build-arg "MAGIC_NUMBER=42"`. |
120120
| `WithCreateParameterModifier` | Allows low level modifications of the Docker image build parameter. |
121121

122-
!!!tip
122+
!!! tip
123123

124124
Testcontainers for .NET detects your Docker host configuration. You do **not** have to set the Docker daemon socket.
125125

docs/api/resource_reaper.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Testcontainers automatically assigns a Resource Reaper session id to each Docker resource. After the tests are finished — whether they are successful or not — [Moby Ryuk](https://github.com/testcontainers/moby-ryuk) will take care of the remaining Docker resources and removes them. You can change the Resource Reaper session and group Docker resources together. Right now, only Linux containers are supported.
44

5-
!!!tip
5+
!!! tip
66

77
Whenever possible, do **not** disable the Resource Reaper. It keeps your machine and CI/CD environment clean. If at all, consider disabling the Resource Reaper only for environments that have a mechanism to cleanup Docker resources, e.g. ephemeral CI nodes.
88

@@ -23,6 +23,6 @@ await new ContainerBuilder("alpine:3.20.0")
2323
.ConfigureAwait(false);
2424
```
2525
26-
!!!warning
26+
!!! warning
2727
2828
Testcontainers for .NET assigns a default session id. You do not have to override the Resource Reaper session id usually. -->

docs/api/resource_reuse.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ _ = new ContainerBuilder("alpine:3.20.0")
1717

1818
The current implementation considers the following resource configurations and their corresponding builder APIs when calculating the hash value.
1919

20-
!!!note
20+
!!! note
2121

2222
Version 3.8.0 did not include the container configuration's name in the hash value.
2323

@@ -41,7 +41,7 @@ The current implementation considers the following resource configurations and t
4141

4242
By default, all module resource configurations are included. This works well for simple value and reference types that can be serialized and deserialized to JSON without custom converters. However, more complex resource configurations may require a custom converter to properly serialize and deserialize their values.
4343

44-
!!!warning
44+
!!! warning
4545

4646
Reuse does not replace singleton implementations to improve test performance. Prefer proper shared instances according to your chosen test framework.
4747

docs/api/wait_strategies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ _ = Wait.ForUnixContainer()
7474
.UntilInternalTcpPortIsAvailable(8080);
7575
```
7676

77-
!!!note
77+
!!! note
7878

7979
Just because a service is listening on the internal TCP port does not necessarily mean it is fully ready to handle requests. Often, wait strategies such as checking for specific log messages or verifying a health endpoint provide more reliable confirmation that the service is operational.
8080

@@ -87,7 +87,7 @@ _ = Wait.ForUnixContainer()
8787
.UntilExternalTcpPortIsAvailable(8080);
8888
```
8989

90-
!!!note
90+
!!! note
9191

9292
External TCP port availability doesn't guarantee that the actual service inside the container is ready to handle requests. It only confirms that the port mapping is established and a connection can be made to the host-side proxy.
9393

docs/custom_configuration/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ In .NET logging usually goes through the test framework. Testcontainers is not a
115115
[testcontainers.org 00:00:06.26] Start Docker container 027af397344d08d5fc174bf5b5d449f6b352a8a506306d3d96390aaa2bb0445d
116116
[testcontainers.org 00:00:06.64] Delete Docker container 027af397344d08d5fc174bf5b5d449f6b352a8a506306d3d96390aaa2bb0445d
117117

118-
!!!tip
118+
!!! tip
119119

120120
These log messages are from the Testcontainers library and contain information about the test resources. They do not include log messages from the containers. To get the container log messages, see: [Getting log messages](https://dotnet.testcontainers.org/api/create_docker_container/#getting-log-messages).
121121

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
!!!tip
1+
!!! tip
22

33
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).

docs/modules/garnet.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Garnet
2+
3+
[Garnet](https://github.com/microsoft/garnet) is a high-performance, Redis-compatible in-memory data store.
4+
5+
The Testcontainers Redis module is compatible with the Garnet container image. You can use the existing [`Testcontainers.Redis`](/modules/redis/) package without requiring a separate Garnet module.
6+
7+
!!! note
8+
9+
If Garnet introduces features or configuration options that require dedicated support in the future, we can introduce a separate module at that time.
10+
11+
## Usage
12+
13+
Add the Redis module:
14+
15+
```shell title="NuGet"
16+
dotnet add package Testcontainers.Redis
17+
```
18+
19+
Start a Garnet container using the Redis builder:
20+
21+
```csharp
22+
var garnetContainer = new RedisBuilder("ghcr.io/microsoft/garnet:1.0.99").Build();
23+
await garnetContainer.StartAsync();
24+
```
25+
26+
--8<-- "docs/modules/_call_out_test_projects.txt"

docs/modules/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ await moduleNameContainer.StartAsync();
4848
| K3s | `rancher/k3s:v1.26.2-k3s1` | [NuGet](https://www.nuget.org/packages/Testcontainers.K3s) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.K3s) |
4949
| Kafka | `confluentinc/cp-kafka:6.1.9` | [NuGet](https://www.nuget.org/packages/Testcontainers.Kafka) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Kafka) |
5050
| Keycloak | `quay.io/keycloak/keycloak:21.1` | [NuGet](https://www.nuget.org/packages/Testcontainers.Keycloak) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Keycloak) |
51+
| KurrentDb | `kurrentplatform/kurrentdb:25.1` | [NuGet](https://www.nuget.org/packages/Testcontainers.KurrentDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.KurrentDb) |
5152
| 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) |
5253
| 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) |
5354
| Lowkey Vault | `nagyesta/lowkey-vault:2.7.1-ubi9-minimal` | [NuGet](https://www.nuget.org/packages/Testcontainers.LowkeyVault) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.LowkeyVault) |
@@ -59,6 +60,7 @@ await moduleNameContainer.StartAsync();
5960
| MySQL | `mysql:8.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.MySql) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.MySql) |
6061
| NATS | `nats:2.9` | [NuGet](https://www.nuget.org/packages/Testcontainers.Nats) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Nats) |
6162
| Neo4j | `neo4j:5.4` | [NuGet](https://www.nuget.org/packages/Testcontainers.Neo4j) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Neo4j) |
63+
| Ollama | `ollama/ollama:0.6.6` | [NuGet](https://www.nuget.org/packages/Testcontainers.Ollama) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Ollama) |
6264
| OpenSearch | `opensearchproject/opensearch:2.12.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.OpenSearch) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.OpenSearch) |
6365
| Oracle | `gvenzl/oracle-xe:21.3.0-slim-faststart` | [NuGet](https://www.nuget.org/packages/Testcontainers.Oracle) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Oracle) |
6466
| Papercut | `changemakerstudiosus/papercut-smtp:latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.Papercut) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Papercut) |
@@ -71,8 +73,10 @@ await moduleNameContainer.StartAsync();
7173
| 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) |
7274
| Redis | `redis:7.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Redis) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Redis) |
7375
| 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) |
76+
| Seq | `datalust/seq:2025.2` | [NuGet](https://www.nuget.org/packages/Testcontainers.Seq) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Seq) |
7477
| Sftp | `atmoz/sftp:alpine` | [NuGet](https://www.nuget.org/packages/Testcontainers.Sftp) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Sftp) |
7578
| 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) |
79+
| Temporal | `temporalio/temporal:1.5.1` | [NuGet](https://www.nuget.org/packages/Testcontainers.Temporal) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Temporal) |
7680
| Toxiproxy | `ghcr.io/shopify/toxiproxy:2.12.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Toxiproxy) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Toxiproxy) |
7781
| Typesense | `typesense/typesense:28.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Typesense) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Typesense) |
7882
| 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) |

0 commit comments

Comments
 (0)