Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<PackageVersion Include="JanusGraph.Net" Version="1.1.0"/>
<PackageVersion Include="Keycloak.Net.Core" Version="1.0.20"/>
<PackageVersion Include="KubernetesClient" Version="17.0.14"/>
<PackageVersion Include="KurrentDB.Client" Version="1.2.0"/>
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.32.1"/>
<PackageVersion Include="Microsoft.Azure.Kusto.Data" Version="12.2.8"/>
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2"/>
Expand Down
14 changes: 14 additions & 0 deletions Testcontainers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kafka", "src
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Keycloak", "src\Testcontainers.Keycloak\Testcontainers.Keycloak.csproj", "{AA8834A3-82A7-4E83-8E4C-88D37F74056A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.KurrentDb", "src\Testcontainers.KurrentDb\Testcontainers.KurrentDb.csproj", "{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kusto", "src\Testcontainers.Kusto\Testcontainers.Kusto.csproj", "{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.LocalStack", "src\Testcontainers.LocalStack\Testcontainers.LocalStack.csproj", "{3792268A-EF08-4569-8118-991E08FD61C4}"
Expand Down Expand Up @@ -198,6 +200,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kafka.Tests"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Keycloak.Tests", "tests\Testcontainers.Keycloak.Tests\Testcontainers.Keycloak.Tests.csproj", "{4827D606-89D5-4E00-8341-47A6E95817BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.KurrentDb.Tests", "tests\Testcontainers.KurrentDb.Tests\Testcontainers.KurrentDb.Tests.csproj", "{C339291C-A7A5-430A-8534-05C645BFBA2F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Kusto.Tests", "tests\Testcontainers.Kusto.Tests\Testcontainers.Kusto.Tests.csproj", "{FA59D75A-8D3A-412C-92E6-4A56033162DD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.LocalStack.Tests", "tests\Testcontainers.LocalStack.Tests\Testcontainers.LocalStack.Tests.csproj", "{728CBE16-1D52-4F84-AF01-7229E6013512}"
Expand Down Expand Up @@ -394,6 +398,10 @@ Global
{AA8834A3-82A7-4E83-8E4C-88D37F74056A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA8834A3-82A7-4E83-8E4C-88D37F74056A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA8834A3-82A7-4E83-8E4C-88D37F74056A}.Release|Any CPU.Build.0 = Release|Any CPU
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14}.Release|Any CPU.Build.0 = Release|Any CPU
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -642,6 +650,10 @@ Global
{4827D606-89D5-4E00-8341-47A6E95817BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4827D606-89D5-4E00-8341-47A6E95817BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4827D606-89D5-4E00-8341-47A6E95817BA}.Release|Any CPU.Build.0 = Release|Any CPU
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C339291C-A7A5-430A-8534-05C645BFBA2F}.Release|Any CPU.Build.0 = Release|Any CPU
{FA59D75A-8D3A-412C-92E6-4A56033162DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA59D75A-8D3A-412C-92E6-4A56033162DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA59D75A-8D3A-412C-92E6-4A56033162DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -839,6 +851,7 @@ Global
{111B840F-9DB0-4166-83E6-0580FD418F07} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{E93E40CE-59AA-4561-9B4C-E7B0A686326E} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{AA8834A3-82A7-4E83-8E4C-88D37F74056A} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{0B68803F-F1D2-4CEB-A4B8-FE72012FEA14} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{FCF59758-2403-4EC9-9EAE-4EC69A3F27AF} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{3792268A-EF08-4569-8118-991E08FD61C4} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{436486CE-E855-43DA-A2C7-9832E98BD86E} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
Expand Down Expand Up @@ -901,6 +914,7 @@ Global
{F0F40AE2-70FF-4191-ADDA-26A19E0D1A0F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{6F2AEE03-629A-4B49-BD5B-25CA3C61FFB7} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{4827D606-89D5-4E00-8341-47A6E95817BA} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{C339291C-A7A5-430A-8534-05C645BFBA2F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{FA59D75A-8D3A-412C-92E6-4A56033162DD} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{728CBE16-1D52-4F84-AF01-7229E6013512} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{CB4F241B-EB79-49D5-A45F-050BEE2191B8} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
Expand Down
2 changes: 2 additions & 0 deletions Testcontainers.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<Project Path="src/Testcontainers.K3s/Testcontainers.K3s.csproj"/>
<Project Path="src/Testcontainers.Kafka/Testcontainers.Kafka.csproj"/>
<Project Path="src/Testcontainers.Keycloak/Testcontainers.Keycloak.csproj"/>
<Project Path="src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj"/>
<Project Path="src/Testcontainers.Kusto/Testcontainers.Kusto.csproj"/>
<Project Path="src/Testcontainers.LocalStack/Testcontainers.LocalStack.csproj"/>
<Project Path="src/Testcontainers.LowkeyVault/Testcontainers.LowkeyVault.csproj"/>
Expand Down Expand Up @@ -101,6 +102,7 @@
<Project Path="tests/Testcontainers.K3s.Tests/Testcontainers.K3s.Tests.csproj"/>
<Project Path="tests/Testcontainers.Kafka.Tests/Testcontainers.Kafka.Tests.csproj"/>
<Project Path="tests/Testcontainers.Keycloak.Tests/Testcontainers.Keycloak.Tests.csproj"/>
<Project Path="tests/Testcontainers.KurrentDb.Tests/Testcontainers.KurrentDb.Tests.csproj"/>
<Project Path="tests/Testcontainers.Kusto.Tests/Testcontainers.Kusto.Tests.csproj"/>
<Project Path="tests/Testcontainers.LocalStack.Tests/Testcontainers.LocalStack.Tests.csproj"/>
<Project Path="tests/Testcontainers.LowkeyVault.Tests/Testcontainers.LowkeyVault.Tests.csproj"/>
Expand Down
1 change: 1 addition & 0 deletions src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace Testcontainers.EventStoreDb;

/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
[PublicAPI]
[Obsolete("Use KurrentDB instead of the EventStoreDB module. More info: https://www.kurrent.io/blog/kurrent-re-brand-faq.")]
public sealed class EventStoreDbBuilder : ContainerBuilder<EventStoreDbBuilder, EventStoreDbContainer, EventStoreDbConfiguration>
{
public const string EventStoreDbImage = "eventstore/eventstore:22.10.1-buster-slim";
Expand Down
1 change: 1 addition & 0 deletions src/Testcontainers.KurrentDb/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root = true
69 changes: 69 additions & 0 deletions src/Testcontainers.KurrentDb/KurrentDbBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
namespace Testcontainers.KurrentDb;

/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
[PublicAPI]
public sealed class KurrentDbBuilder : ContainerBuilder<KurrentDbBuilder, KurrentDbContainer, KurrentDbConfiguration>
{
public const string KurrentDbImage = "kurrentplatform/kurrentdb:25.1";

public const ushort KurrentDbPort = 2113;

/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbBuilder" /> class.
/// </summary>
public KurrentDbBuilder()
: this(new KurrentDbConfiguration())
{
DockerResourceConfiguration = Init().DockerResourceConfiguration;
}

/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbBuilder" /> class.
/// </summary>
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
private KurrentDbBuilder(KurrentDbConfiguration resourceConfiguration)
: base(resourceConfiguration)
{
DockerResourceConfiguration = resourceConfiguration;
}

/// <inheritdoc />
protected override KurrentDbConfiguration DockerResourceConfiguration { get; }

/// <inheritdoc />
public override KurrentDbContainer Build()
{
return new KurrentDbContainer(DockerResourceConfiguration);
}

/// <inheritdoc />
protected override KurrentDbBuilder Init()
{
return base.Init()
.WithImage(KurrentDbImage)
.WithPortBinding(KurrentDbPort, true)
.WithEnvironment("KURRENTDB_CLUSTER_SIZE", "1")
.WithEnvironment("KURRENTDB_RUN_PROJECTIONS", "All")
.WithEnvironment("KURRENTDB_START_STANDARD_PROJECTIONS", "true")
.WithEnvironment("KURRENTDB_INSECURE", "true")
.WithWaitStrategy(Wait.ForUnixContainer().UntilContainerIsHealthy());
}

/// <inheritdoc />
protected override KurrentDbBuilder Clone(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
{
return Merge(DockerResourceConfiguration, new KurrentDbConfiguration(resourceConfiguration));
}

/// <inheritdoc />
protected override KurrentDbBuilder Clone(IContainerConfiguration resourceConfiguration)
{
return Merge(DockerResourceConfiguration, new KurrentDbConfiguration(resourceConfiguration));
}

/// <inheritdoc />
protected override KurrentDbBuilder Merge(KurrentDbConfiguration oldValue, KurrentDbConfiguration newValue)
{
return new KurrentDbBuilder(new KurrentDbConfiguration(oldValue, newValue));
}
}
53 changes: 53 additions & 0 deletions src/Testcontainers.KurrentDb/KurrentDbConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace Testcontainers.KurrentDb;

/// <inheritdoc cref="ContainerConfiguration" />
[PublicAPI]
public sealed class KurrentDbConfiguration : ContainerConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
/// </summary>
public KurrentDbConfiguration()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
/// </summary>
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
public KurrentDbConfiguration(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
}

/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
/// </summary>
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
public KurrentDbConfiguration(IContainerConfiguration resourceConfiguration)
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
}

/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
/// </summary>
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
public KurrentDbConfiguration(KurrentDbConfiguration resourceConfiguration)
: this(new KurrentDbConfiguration(), resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
}

/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbConfiguration" /> class.
/// </summary>
/// <param name="oldValue">The old Docker resource configuration.</param>
/// <param name="newValue">The new Docker resource configuration.</param>
public KurrentDbConfiguration(KurrentDbConfiguration oldValue, KurrentDbConfiguration newValue)
: base(oldValue, newValue)
{
}
}
26 changes: 26 additions & 0 deletions src/Testcontainers.KurrentDb/KurrentDbContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Testcontainers.KurrentDb;

/// <inheritdoc cref="DockerContainer" />
[PublicAPI]
public sealed class KurrentDbContainer : DockerContainer
{
/// <summary>
/// Initializes a new instance of the <see cref="KurrentDbContainer" /> class.
/// </summary>
/// <param name="configuration">The container configuration.</param>
public KurrentDbContainer(KurrentDbConfiguration configuration)
: base(configuration)
{
}

/// <summary>
/// Gets the KurrentDb connection string.
/// </summary>
/// <returns>The KurrentDb connection string.</returns>
public string GetConnectionString()
{
var endpoint = new UriBuilder("kurrentdb", Hostname, GetMappedPublicPort(KurrentDbBuilder.KurrentDbPort));
endpoint.Query = "tls=false";
return endpoint.ToString();
}
}
12 changes: 12 additions & 0 deletions src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Testcontainers/Testcontainers.csproj"/>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions src/Testcontainers.KurrentDb/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global using System;
global using Docker.DotNet.Models;
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using JetBrains.Annotations;
1 change: 1 addition & 0 deletions tests/Testcontainers.KurrentDb.Tests/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root = true
1 change: 1 addition & 0 deletions tests/Testcontainers.KurrentDb.Tests/.runs-on
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ubuntu-24.04
45 changes: 45 additions & 0 deletions tests/Testcontainers.KurrentDb.Tests/KurrentDbContainerTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace Testcontainers.KurrentDb;

public sealed class KurrentDbContainerTest : IAsyncLifetime
{
private readonly KurrentDbContainer _kurrentDbContainer = new KurrentDbBuilder().Build();

public async ValueTask InitializeAsync()
{
await _kurrentDbContainer.StartAsync()
.ConfigureAwait(false);
}

public ValueTask DisposeAsync()
{
return _kurrentDbContainer.DisposeAsync();
}

[Fact]
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
public async Task ReadStreamReturnsEvent()
{
// Given
const string eventType = "some-event";

const string streamName = "some-stream";

var settings = KurrentDBClientSettings.Create(_kurrentDbContainer.GetConnectionString());

using var client = new KurrentDBClient(settings);

var eventData = new EventData(Uuid.NewUuid(), eventType, Array.Empty<byte>());

// When
_ = await client.AppendToStreamAsync(streamName, StreamState.NoStream, new[] { eventData }, cancellationToken: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

var resolvedEvents = client.ReadStreamAsync(Direction.Forwards, streamName, StreamPosition.Start, cancellationToken: TestContext.Current.CancellationToken);

var resolvedEvent = await resolvedEvents.FirstAsync(cancellationToken: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Assert.Equal(eventType, resolvedEvent.Event.EventType);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="KurrentDB.Client"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj"/>
<ProjectReference Include="../Testcontainers.Commons/Testcontainers.Commons.csproj"/>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions tests/Testcontainers.KurrentDb.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global using System;
global using System.Linq;
global using System.Threading.Tasks;
global using DotNet.Testcontainers.Commons;
global using KurrentDB.Client;
global using Xunit;