Skip to content

feat: Add KurrentDb module#1583

Merged
HofmeisterAn merged 8 commits intotestcontainers:developfrom
diegosasw:feature/add-kurrentdb
Nov 22, 2025
Merged

feat: Add KurrentDb module#1583
HofmeisterAn merged 8 commits intotestcontainers:developfrom
diegosasw:feature/add-kurrentdb

Conversation

@diegosasw
Copy link
Contributor

What does this PR do?

Completes already started work from @HofmeisterAn to support KurrentDB TestContainer.
It uses latest kurrentplatform/kurrentdb:25.1 and the new KurrentDB.Client in test project to assert that it's possible to write and read in KurrentDB stream.

Why is it important?

There was support for the old EventStoreDB but not for the new KurrentDB, which is a well-known leading event sourcing database. The work was commenced in branch https://github.com/testcontainers/testcontainers-dotnet/tree/feature/add-kurrent-db

Related issues

How to test this PR

Run automated test that writes and reads from KurrentDB test container

@netlify
Copy link

netlify bot commented Nov 17, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 4c2a35c
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/69216ec5ce153000087b04c8
😎 Deploy Preview https://deploy-preview-1583--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Summary by CodeRabbit

  • New Features

    • Added support for KurrentDB containers with connection string generation and stream event operations.
  • Deprecated

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Adds a new KurrentDb module (builder, configuration, container), project and tests; marks EventStoreDb builder as obsolete; updates solution files and package props to include KurrentDB.Client v1.2.0; adds CI runner and editorconfig files for the new projects.

Changes

Cohort / File(s) Summary
Package & Solution
Directory.Packages.props, Testcontainers.sln, Testcontainers.slnx
Added PackageVersion for KurrentDB.Client v1.2.0; registered Testcontainers.KurrentDb and Testcontainers.KurrentDb.Tests projects with GUIDs and solution build/platform mappings (legacy and modern .sln/.slnx).
Deprecation
src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs
Marked EventStoreDbBuilder class as [Obsolete] with a migration URL to KurrentDB.
KurrentDb Implementation
src/Testcontainers.KurrentDb/KurrentDbBuilder.cs, src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs, src/Testcontainers.KurrentDb/KurrentDbContainer.cs, src/Testcontainers.KurrentDb/Usings.cs, src/Testcontainers.KurrentDb/.editorconfig
Added KurrentDbBuilder (fluent builder, image/port constants, init/clone/merge), KurrentDbConfiguration (immutable constructors), KurrentDbContainer (constructor + GetConnectionString), global usings and editorconfig.
KurrentDb Project File
src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj
New project targeting net8.0/net9.0/net10.0/netstandard2.0/netstandard2.1; references JetBrains.Annotations and Testcontainers project.
KurrentDb Tests
tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj, tests/Testcontainers.KurrentDb.Tests/Usings.cs, tests/Testcontainers.KurrentDb.Tests/KurrentDbContainerTest.cs, tests/Testcontainers.KurrentDb.Tests/.editorconfig, tests/Testcontainers.KurrentDb.Tests/.runs-on
Added test project and global usings; integration test exercising append/read via KurrentDB client; set CI runner to ubuntu-24.04 and added package references (xUnit, KurrentDB.Client).

Sequence Diagram(s)

sequenceDiagram
    actor Test as Test Code
    participant Builder as KurrentDbBuilder
    participant Config as KurrentDbConfiguration
    participant Container as KurrentDbContainer
    participant Docker as Docker Engine

    Test->>Builder: new KurrentDbBuilder()
    Test->>Builder: Build()
    Builder->>Config: Init() -> create config
    Builder->>Docker: Create & start container (image, env, ports)
    Docker-->>Container: container ready
    Builder-->>Test: KurrentDbContainer
    Test->>Container: GetConnectionString()
    Container-->>Test: returns esdb://host:port/?tls=false
    Test->>KurrentDB.Client: use connection string to append/read stream
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review cloning/merging semantics in KurrentDbBuilder/KurrentDbConfiguration for consistency with other modules.
  • Verify GetConnectionString() port mapping and query parameter correctness.
  • Confirm solution (.sln/.slnx) entries and GUIDs are consistent.

Possibly related PRs

Suggested labels

enhancement, module

Poem

🐰 I hopped a patch across the stream,

KurrentDb now joins the team.
Builders, configs, tests in tow,
EventStore waved goodbye — hop, go!
Containers ready — one-two-three, let’s row!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description covers all mandatory sections (What and Why) with clear explanations, includes related issues, and provides testing instructions as recommended in the template.
Title check ✅ Passed The title 'feat: Add KurrentDb module' directly and clearly summarizes the main change: introducing a new KurrentDb module to the Testcontainers project.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3bba364 and 896a9e5.

📒 Files selected for processing (15)
  • .github/workflows/cicd.yml (1 hunks)
  • Directory.Packages.props (1 hunks)
  • Testcontainers.sln (6 hunks)
  • Testcontainers.slnx (1 hunks)
  • src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs (1 hunks)
  • src/Testcontainers.KurrentDb/.editorconfig (1 hunks)
  • src/Testcontainers.KurrentDb/KurrentDbBuilder.cs (1 hunks)
  • src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs (1 hunks)
  • src/Testcontainers.KurrentDb/KurrentDbContainer.cs (1 hunks)
  • src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj (1 hunks)
  • src/Testcontainers.KurrentDb/Usings.cs (1 hunks)
  • tests/Testcontainers.KurrentDb.Tests/.editorconfig (1 hunks)
  • tests/Testcontainers.KurrentDb.Tests/KurrentDbContainerTest.cs (1 hunks)
  • tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj (1 hunks)
  • tests/Testcontainers.KurrentDb.Tests/Usings.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-08T09:04:00.045Z
Learnt from: HofmeisterAn
Repo: testcontainers/testcontainers-dotnet PR: 1509
File: tests/Testcontainers.Grafana.Tests/GrafanaContainerTest.cs:45-46
Timestamp: 2025-11-08T09:04:00.045Z
Learning: In xUnit.net test methods in the testcontainers-dotnet project, ConfigureAwait(true) is recommended and correct to use, as it ensures proper synchronization context capture for xUnit's test parallelism management. Do not suggest changing ConfigureAwait(true) to ConfigureAwait(false) in test methods.

Applied to files:

  • tests/Testcontainers.KurrentDb.Tests/Usings.cs
🧬 Code graph analysis (4)
src/Testcontainers.KurrentDb/KurrentDbContainer.cs (2)
src/Testcontainers.KurrentDb/KurrentDbBuilder.cs (8)
  • PublicAPI (4-69)
  • KurrentDbContainer (34-37)
  • KurrentDbBuilder (14-18)
  • KurrentDbBuilder (24-28)
  • KurrentDbBuilder (40-50)
  • KurrentDbBuilder (53-56)
  • KurrentDbBuilder (59-62)
  • KurrentDbBuilder (65-68)
src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs (6)
  • PublicAPI (4-53)
  • KurrentDbConfiguration (10-12)
  • KurrentDbConfiguration (18-22)
  • KurrentDbConfiguration (28-32)
  • KurrentDbConfiguration (38-42)
  • KurrentDbConfiguration (49-52)
tests/Testcontainers.KurrentDb.Tests/KurrentDbContainerTest.cs (2)
src/Testcontainers.KurrentDb/KurrentDbBuilder.cs (7)
  • KurrentDbContainer (34-37)
  • KurrentDbBuilder (14-18)
  • KurrentDbBuilder (24-28)
  • KurrentDbBuilder (40-50)
  • KurrentDbBuilder (53-56)
  • KurrentDbBuilder (59-62)
  • KurrentDbBuilder (65-68)
src/Testcontainers.KurrentDb/KurrentDbContainer.cs (2)
  • KurrentDbContainer (11-14)
  • GetConnectionString (20-25)
src/Testcontainers.KurrentDb/KurrentDbBuilder.cs (3)
src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs (1)
  • PublicAPI (4-70)
src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs (6)
  • PublicAPI (4-53)
  • KurrentDbConfiguration (10-12)
  • KurrentDbConfiguration (18-22)
  • KurrentDbConfiguration (28-32)
  • KurrentDbConfiguration (38-42)
  • KurrentDbConfiguration (49-52)
src/Testcontainers.KurrentDb/KurrentDbContainer.cs (2)
  • PublicAPI (4-26)
  • KurrentDbContainer (11-14)
src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs (2)
src/Testcontainers.KurrentDb/KurrentDbBuilder.cs (1)
  • PublicAPI (4-69)
src/Testcontainers.KurrentDb/KurrentDbContainer.cs (1)
  • PublicAPI (4-26)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: analyze (csharp)
🔇 Additional comments (15)
tests/Testcontainers.KurrentDb.Tests/.editorconfig (1)

1-1: LGTM!

Standard EditorConfig root marker.

tests/Testcontainers.KurrentDb.Tests/Usings.cs (1)

1-5: LGTM!

The global using directives are appropriate for a testcontainers test project using xUnit.

src/Testcontainers.KurrentDb/.editorconfig (1)

1-1: LGTM!

Standard EditorConfig root marker.

src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs (1)

5-5: LGTM!

Clear deprecation message with helpful migration guidance and documentation link.

tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj (2)

1-19: Test project configuration looks good otherwise.

The project structure, package references, and project references are correctly configured for a testcontainers test project.


3-3: No changes required.

.NET 10 officially released on November 11, 2025, as a Long-Term Support release, making targeting net10.0 appropriate and supported. The codebase consistently follows this pattern: test projects target only net10.0, while library projects support multiple frameworks for broader compatibility. This is an intentional design choice and no update is needed.

src/Testcontainers.KurrentDb/Usings.cs (1)

1-6: LGTM!

The global using directives are appropriate and consistent with other testcontainers modules in the repository.

Testcontainers.sln (1)

77-78: LGTM! Solution file updates are consistent.

The solution file changes correctly integrate the new KurrentDb project and its tests into the solution structure, following the same pattern as other Testcontainers modules.

Also applies to: 203-204, 401-404, 653-656, 854-854, 917-917

tests/Testcontainers.KurrentDb.Tests/KurrentDbContainerTest.cs (2)

36-37: Review ConfigureAwait usage in test code.

The test uses .ConfigureAwait(true) at lines 36 and 42, which explicitly captures the synchronization context. This is unusual in test code—typically .ConfigureAwait(false) is used in library code or the parameter is omitted in tests.

Verify this is intentional. If the test framework requires continuation on the original context, this is correct; otherwise, consider omitting .ConfigureAwait() or using false.

Also applies to: 41-42


5-18: LGTM! Proper container lifecycle management.

The test correctly implements IAsyncLifetime to manage the container lifecycle, ensuring the container is started before tests and properly disposed afterward.

src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs (1)

1-53: LGTM! Configuration class follows Testcontainers patterns.

The KurrentDbConfiguration class correctly implements the immutable configuration pattern used throughout the Testcontainers library, with all constructors properly delegating to base implementations.

src/Testcontainers.KurrentDb/KurrentDbBuilder.cs (3)

40-50: LGTM! Builder configuration is appropriate for testing.

The Init() method correctly configures KurrentDB for testing with:

  • Single-node cluster (appropriate for tests)
  • All projections enabled
  • Insecure mode (appropriate for test containers)
  • Health check wait strategy

The configuration mirrors the obsolete EventStoreDbBuilder and is well-suited for integration testing.


1-69: Consistent implementation with Testcontainers patterns.

The KurrentDbBuilder class correctly implements the builder pattern used throughout the Testcontainers library, with proper initialization, cloning, and merging behavior.


7-7: Docker image version verified as correct and latest.

The KurrentDB image version 25.1 used in the code is confirmed as the latest stable release and is documented in official KurrentDB installation guidance. No changes required.

src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj (1)

3-3: No action required—.NET 10 is now available.

.NET 10 was officially released on November 11, 2025, so the codebase's consistent targeting of net10.0 across all projects (evident from the script results showing the pattern across the entire solution) is now appropriate and intentional.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/Testcontainers.EventStoreDb.Tests/EventStoreDbContainerTest.cs (1)

29-37: KurrentDB client wiring mirrors previous EventStore client flow; double‑check compatibility and language version

The switch to:

  • KurrentDBClientSettings.Create(_eventStoreDbContainer.GetConnectionString())
  • using var client = new KurrentDBClient(settings);
  • AppendToStreamAsync(streamName, StreamState.NoStream, [eventData], ...)

keeps the test flow intact and correctly reuses the container connection string and cancellation token. Two minor points to verify:

  1. Connection string compatibilityEventStoreDbContainer.GetConnectionString() still returns an esdb://... URI. Ensure this format is fully supported by KurrentDBClientSettings.Create so the client connects without hidden quirks.
  2. Collection expression [eventData] – this uses the newer C# collection expression syntax. Confirm the test project’s LangVersion (or SDK defaults) supports it; otherwise you may want to revert to new[] { eventData } for broader compatibility.

If both are satisfied, this migration looks good.

If you need a more compatible variant, you can revert the collection expression with:

-        _ = await client.AppendToStreamAsync(streamName, StreamState.NoStream, [eventData], cancellationToken: TestContext.Current.CancellationToken)
+        _ = await client.AppendToStreamAsync(streamName, StreamState.NoStream, new[] { eventData }, cancellationToken: TestContext.Current.CancellationToken)
             .ConfigureAwait(true);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f1921f and c76945c.

📒 Files selected for processing (3)
  • tests/Testcontainers.EventStoreDb.Tests/EventStoreDbContainerTest.cs (2 hunks)
  • tests/Testcontainers.EventStoreDb.Tests/Testcontainers.EventStoreDb.Tests.csproj (1 hunks)
  • tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-17T17:58:43.916Z
Learnt from: diegosasw
Repo: testcontainers/testcontainers-dotnet PR: 1583
File: src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj:7-7
Timestamp: 2025-11-17T17:58:43.916Z
Learning: In the testcontainers-dotnet repository, JetBrains.Annotations should use version 2023.3.0 to maintain consistency with the main Testcontainers csproj, rather than always using the latest available version.

Applied to files:

  • tests/Testcontainers.EventStoreDb.Tests/Testcontainers.EventStoreDb.Tests.csproj
  • tests/Testcontainers.EventStoreDb.Tests/EventStoreDbContainerTest.cs
🧬 Code graph analysis (1)
tests/Testcontainers.EventStoreDb.Tests/EventStoreDbContainerTest.cs (1)
src/Testcontainers.EventStoreDb/EventStoreDbContainer.cs (1)
  • GetConnectionString (20-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: ci (Testcontainers.BigQuery, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.ArangoDb, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.Cassandra, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.Azurite, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.ActiveMq, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.Bigtable, ubuntu-24.04)
  • GitHub Check: analyze (csharp)
🔇 Additional comments (2)
tests/Testcontainers.EventStoreDb.Tests/Testcontainers.EventStoreDb.Tests.csproj (1)

14-14: No changes required—package reference is properly configured.

The verification confirms that KurrentDB.Client is correctly defined in Directory.Packages.props with version 1.2.0. The package reference in the test project properly uses the centralized package management pattern with no explicit version, which is the correct approach for this repository.

tests/Testcontainers.EventStoreDb.Tests/EventStoreDbContainerTest.cs (1)

1-1: Using KurrentDB.Client import is consistent with the updated client usage

The added using KurrentDB.Client; matches the new KurrentDBClientSettings / KurrentDBClient types used below and keeps the test focused on the KurrentDB client stack.

Please confirm the referenced KurrentDB.Client package version is the one defined centrally (e.g., in Directory.Packages.props) so test and library projects stay aligned.

@diegosasw diegosasw changed the title Add KurrentDB TestContainer Add KurrentDB TestContainer Module Nov 18, 2025
@HofmeisterAn HofmeisterAn changed the title Add KurrentDB TestContainer Module feat: Add KurrentDb module Nov 22, 2025
@HofmeisterAn HofmeisterAn added enhancement New feature or request breaking change Causing compatibility issues labels Nov 22, 2025
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this. I almost forgot about the branch. I made a few small updates to keep the overall changes to a minimum. We'll remove the EventStoreDb module in the release after the next one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Causing compatibility issues enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants