Skip to content

Commit 3f9de42

Browse files
feat: Add KurrentDb module (#1583)
Co-authored-by: Andre Hofmeister <[email protected]>
1 parent 3bba364 commit 3f9de42

File tree

15 files changed

+257
-0
lines changed

15 files changed

+257
-0
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<PackageVersion Include="JanusGraph.Net" Version="1.1.0"/>
6666
<PackageVersion Include="Keycloak.Net.Core" Version="1.0.20"/>
6767
<PackageVersion Include="KubernetesClient" Version="17.0.14"/>
68+
<PackageVersion Include="KurrentDB.Client" Version="1.2.0"/>
6869
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.32.1"/>
6970
<PackageVersion Include="Microsoft.Azure.Kusto.Data" Version="12.2.8"/>
7071
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2"/>

Testcontainers.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kafka", "src
7474
EndProject
7575
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Keycloak", "src\Testcontainers.Keycloak\Testcontainers.Keycloak.csproj", "{AA8834A3-82A7-4E83-8E4C-88D37F74056A}"
7676
EndProject
77+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.KurrentDb", "src\Testcontainers.KurrentDb\Testcontainers.KurrentDb.csproj", "{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}"
78+
EndProject
7779
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kusto", "src\Testcontainers.Kusto\Testcontainers.Kusto.csproj", "{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}"
7880
EndProject
7981
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.LocalStack", "src\Testcontainers.LocalStack\Testcontainers.LocalStack.csproj", "{3792268A-EF08-4569-8118-991E08FD61C4}"
@@ -198,6 +200,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kafka.Tests"
198200
EndProject
199201
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Keycloak.Tests", "tests\Testcontainers.Keycloak.Tests\Testcontainers.Keycloak.Tests.csproj", "{4827D606-89D5-4E00-8341-47A6E95817BA}"
200202
EndProject
203+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.KurrentDb.Tests", "tests\Testcontainers.KurrentDb.Tests\Testcontainers.KurrentDb.Tests.csproj", "{C339291C-A7A5-430A-8534-05C645BFBA2F}"
204+
EndProject
201205
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kusto.Tests", "tests\Testcontainers.Kusto.Tests\Testcontainers.Kusto.Tests.csproj", "{FA59D75A-8D3A-412C-92E6-4A56033162DD}"
202206
EndProject
203207
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.LocalStack.Tests", "tests\Testcontainers.LocalStack.Tests\Testcontainers.LocalStack.Tests.csproj", "{728CBE16-1D52-4F84-AF01-7229E6013512}"
@@ -394,6 +398,10 @@ Global
394398
{AA8834A3-82A7-4E83-8E4C-88D37F74056A}.Debug|Any CPU.Build.0 = Debug|Any CPU
395399
{AA8834A3-82A7-4E83-8E4C-88D37F74056A}.Release|Any CPU.ActiveCfg = Release|Any CPU
396400
{AA8834A3-82A7-4E83-8E4C-88D37F74056A}.Release|Any CPU.Build.0 = Release|Any CPU
401+
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
402+
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Debug|Any CPU.Build.0 = Debug|Any CPU
403+
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Release|Any CPU.ActiveCfg = Release|Any CPU
404+
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Release|Any CPU.Build.0 = Release|Any CPU
397405
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
398406
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
399407
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -642,6 +650,10 @@ Global
642650
{4827D606-89D5-4E00-8341-47A6E95817BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
643651
{4827D606-89D5-4E00-8341-47A6E95817BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
644652
{4827D606-89D5-4E00-8341-47A6E95817BA}.Release|Any CPU.Build.0 = Release|Any CPU
653+
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
654+
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
655+
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
656+
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Release|Any CPU.Build.0 = Release|Any CPU
645657
{FA59D75A-8D3A-412C-92E6-4A56033162DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
646658
{FA59D75A-8D3A-412C-92E6-4A56033162DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
647659
{FA59D75A-8D3A-412C-92E6-4A56033162DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -839,6 +851,7 @@ Global
839851
{111B840F-9DB0-4166-83E6-0580FD418F07} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
840852
{E93E40CE-59AA-4561-9B4C-E7B0A686326E} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
841853
{AA8834A3-82A7-4E83-8E4C-88D37F74056A} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
854+
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
842855
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
843856
{3792268A-EF08-4569-8118-991E08FD61C4} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
844857
{436486CE-E855-43DA-A2C7-9832E98BD86E} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
@@ -901,6 +914,7 @@ Global
901914
{F0F40AE2-70FF-4191-ADDA-26A19E0D1A0F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
902915
{6F2AEE03-629A-4B49-BD5B-25CA3C61FFB7} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
903916
{4827D606-89D5-4E00-8341-47A6E95817BA} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
917+
{C339291C-A7A5-430A-8534-05C645BFBA2F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
904918
{FA59D75A-8D3A-412C-92E6-4A56033162DD} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
905919
{728CBE16-1D52-4F84-AF01-7229E6013512} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
906920
{CB4F241B-EB79-49D5-A45F-050BEE2191B8} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}

Testcontainers.slnx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<Project Path="src/Testcontainers.K3s/Testcontainers.K3s.csproj"/>
3838
<Project Path="src/Testcontainers.Kafka/Testcontainers.Kafka.csproj"/>
3939
<Project Path="src/Testcontainers.Keycloak/Testcontainers.Keycloak.csproj"/>
40+
<Project Path="src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj"/>
4041
<Project Path="src/Testcontainers.Kusto/Testcontainers.Kusto.csproj"/>
4142
<Project Path="src/Testcontainers.LocalStack/Testcontainers.LocalStack.csproj"/>
4243
<Project Path="src/Testcontainers.LowkeyVault/Testcontainers.LowkeyVault.csproj"/>
@@ -101,6 +102,7 @@
101102
<Project Path="tests/Testcontainers.K3s.Tests/Testcontainers.K3s.Tests.csproj"/>
102103
<Project Path="tests/Testcontainers.Kafka.Tests/Testcontainers.Kafka.Tests.csproj"/>
103104
<Project Path="tests/Testcontainers.Keycloak.Tests/Testcontainers.Keycloak.Tests.csproj"/>
105+
<Project Path="tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj"/>
104106
<Project Path="tests/Testcontainers.Kusto.Tests/Testcontainers.Kusto.Tests.csproj"/>
105107
<Project Path="tests/Testcontainers.LocalStack.Tests/Testcontainers.LocalStack.Tests.csproj"/>
106108
<Project Path="tests/Testcontainers.LowkeyVault.Tests/Testcontainers.LowkeyVault.Tests.csproj"/>

src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace Testcontainers.EventStoreDb;
22

33
/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
44
[PublicAPI]
5+
[Obsolete("Use KurrentDB instead of the EventStoreDB module. More info: https://www.kurrent.io/blog/kurrent-re-brand-faq.")]
56
public sealed class EventStoreDbBuilder : ContainerBuilder<EventStoreDbBuilder, EventStoreDbContainer, EventStoreDbConfiguration>
67
{
78
public const string EventStoreDbImage = "eventstore/eventstore:22.10.1-buster-slim";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root = true
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
namespace Testcontainers.KurrentDb;
2+
3+
/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
4+
[PublicAPI]
5+
public sealed class KurrentDbBuilder : ContainerBuilder<KurrentDbBuilder, KurrentDbContainer, KurrentDbConfiguration>
6+
{
7+
public const string KurrentDbImage = "kurrentplatform/kurrentdb:25.1";
8+
9+
public const ushort KurrentDbPort = 2113;
10+
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="KurrentDbBuilder" /> class.
13+
/// </summary>
14+
public KurrentDbBuilder()
15+
: this(new KurrentDbConfiguration())
16+
{
17+
DockerResourceConfiguration = Init().DockerResourceConfiguration;
18+
}
19+
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="KurrentDbBuilder" /> class.
22+
/// </summary>
23+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
24+
private KurrentDbBuilder(KurrentDbConfiguration resourceConfiguration)
25+
: base(resourceConfiguration)
26+
{
27+
DockerResourceConfiguration = resourceConfiguration;
28+
}
29+
30+
/// <inheritdoc />
31+
protected override KurrentDbConfiguration DockerResourceConfiguration { get; }
32+
33+
/// <inheritdoc />
34+
public override KurrentDbContainer Build()
35+
{
36+
return new KurrentDbContainer(DockerResourceConfiguration);
37+
}
38+
39+
/// <inheritdoc />
40+
protected override KurrentDbBuilder Init()
41+
{
42+
return base.Init()
43+
.WithImage(KurrentDbImage)
44+
.WithPortBinding(KurrentDbPort, true)
45+
.WithEnvironment("KURRENTDB_CLUSTER_SIZE", "1")
46+
.WithEnvironment("KURRENTDB_RUN_PROJECTIONS", "All")
47+
.WithEnvironment("KURRENTDB_START_STANDARD_PROJECTIONS", "true")
48+
.WithEnvironment("KURRENTDB_INSECURE", "true")
49+
.WithWaitStrategy(Wait.ForUnixContainer().UntilContainerIsHealthy());
50+
}
51+
52+
/// <inheritdoc />
53+
protected override KurrentDbBuilder Clone(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
54+
{
55+
return Merge(DockerResourceConfiguration, new KurrentDbConfiguration(resourceConfiguration));
56+
}
57+
58+
/// <inheritdoc />
59+
protected override KurrentDbBuilder Clone(IContainerConfiguration resourceConfiguration)
60+
{
61+
return Merge(DockerResourceConfiguration, new KurrentDbConfiguration(resourceConfiguration));
62+
}
63+
64+
/// <inheritdoc />
65+
protected override KurrentDbBuilder Merge(KurrentDbConfiguration oldValue, KurrentDbConfiguration newValue)
66+
{
67+
return new KurrentDbBuilder(new KurrentDbConfiguration(oldValue, newValue));
68+
}
69+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace Testcontainers.KurrentDb;
2+
3+
/// <inheritdoc cref="ContainerConfiguration" />
4+
[PublicAPI]
5+
public sealed class KurrentDbConfiguration : ContainerConfiguration
6+
{
7+
/// <summary>
8+
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
9+
/// </summary>
10+
public KurrentDbConfiguration()
11+
{
12+
}
13+
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
16+
/// </summary>
17+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
18+
public KurrentDbConfiguration(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
19+
: base(resourceConfiguration)
20+
{
21+
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
22+
}
23+
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
26+
/// </summary>
27+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
28+
public KurrentDbConfiguration(IContainerConfiguration resourceConfiguration)
29+
: base(resourceConfiguration)
30+
{
31+
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
32+
}
33+
34+
/// <summary>
35+
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
36+
/// </summary>
37+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
38+
public KurrentDbConfiguration(KurrentDbConfiguration resourceConfiguration)
39+
: this(new KurrentDbConfiguration(), resourceConfiguration)
40+
{
41+
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
42+
}
43+
44+
/// <summary>
45+
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
46+
/// </summary>
47+
/// <param name="oldValue">The old Docker resource configuration.</param>
48+
/// <param name="newValue">The new Docker resource configuration.</param>
49+
public KurrentDbConfiguration(KurrentDbConfiguration oldValue, KurrentDbConfiguration newValue)
50+
: base(oldValue, newValue)
51+
{
52+
}
53+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace Testcontainers.KurrentDb;
2+
3+
/// <inheritdoc cref="DockerContainer" />
4+
[PublicAPI]
5+
public sealed class KurrentDbContainer : DockerContainer
6+
{
7+
/// <summary>
8+
/// Initializes a new instance of the <see cref="KurrentDbContainer" /> class.
9+
/// </summary>
10+
/// <param name="configuration">The container configuration.</param>
11+
public KurrentDbContainer(KurrentDbConfiguration configuration)
12+
: base(configuration)
13+
{
14+
}
15+
16+
/// <summary>
17+
/// Gets the KurrentDb connection string.
18+
/// </summary>
19+
/// <returns>The KurrentDb connection string.</returns>
20+
public string GetConnectionString()
21+
{
22+
var endpoint = new UriBuilder("kurrentdb", Hostname, GetMappedPublicPort(KurrentDbBuilder.KurrentDbPort));
23+
endpoint.Query = "tls=false";
24+
return endpoint.ToString();
25+
}
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1</TargetFrameworks>
4+
<LangVersion>latest</LangVersion>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<ProjectReference Include="../Testcontainers/Testcontainers.csproj"/>
11+
</ItemGroup>
12+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global using System;
2+
global using Docker.DotNet.Models;
3+
global using DotNet.Testcontainers.Builders;
4+
global using DotNet.Testcontainers.Configurations;
5+
global using DotNet.Testcontainers.Containers;
6+
global using JetBrains.Annotations;

0 commit comments

Comments
 (0)