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
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
<PackageVersion Include="RabbitMQ.Client" Version="6.4.0"/>
<PackageVersion Include="RavenDB.Client" Version="5.4.100"/>
<PackageVersion Include="Selenium.WebDriver" Version="4.8.1"/>
<PackageVersion Include="Seq.Api" Version="2025.2.2"/>
<PackageVersion Include="Seq.Extensions.Logging" Version="9.0.0"/>
<PackageVersion Include="StackExchange.Redis" Version="2.6.90"/>
<PackageVersion Include="Temporalio" Version="1.11.0"/>
<PackageVersion Include="ToxiproxyNetCore" Version="1.0.40"/>
Expand Down
14 changes: 14 additions & 0 deletions Testcontainers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Redis", "src
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Redpanda", "src\Testcontainers.Redpanda\Testcontainers.Redpanda.csproj", "{45D6F69C-4D87-4130-AA90-0DB2F7460DAE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Seq", "src\Testcontainers.Seq\Testcontainers.Seq.csproj", "{EB246B55-788B-4B58-8739-994A66F91C8A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ServiceBus", "src\Testcontainers.ServiceBus\Testcontainers.ServiceBus.csproj", "{2E39E532-B81E-4B48-A004-FAE18EDF9E79}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Sftp", "src\Testcontainers.Sftp\Testcontainers.Sftp.csproj", "{7D5C6816-0DD2-4E13-A585-033B5D3C80D5}"
Expand Down Expand Up @@ -264,6 +266,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Redpanda.Tes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ResourceReaper.Tests", "tests\Testcontainers.ResourceReaper.Tests\Testcontainers.ResourceReaper.Tests.csproj", "{9E8E6AA5-65D1-498F-BEAB-BA34723A0050}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Seq.Tests", "tests\Testcontainers.Seq.Tests\Testcontainers.Seq.Tests.csproj", "{4EFC0DFB-9F04-4070-848A-856D2F11C1BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ServiceBus.Tests", "tests\Testcontainers.ServiceBus.Tests\Testcontainers.ServiceBus.Tests.csproj", "{232DD918-46ED-4BA8-B383-1A9146D83064}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Sftp.Tests", "tests\Testcontainers.Sftp.Tests\Testcontainers.Sftp.Tests.csproj", "{B73C3CC0-9F16-4B34-92BE-6EC0853912C5}"
Expand Down Expand Up @@ -498,6 +502,10 @@ Global
{45D6F69C-4D87-4130-AA90-0DB2F7460DAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45D6F69C-4D87-4130-AA90-0DB2F7460DAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45D6F69C-4D87-4130-AA90-0DB2F7460DAE}.Release|Any CPU.Build.0 = Release|Any CPU
{EB246B55-788B-4B58-8739-994A66F91C8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB246B55-788B-4B58-8739-994A66F91C8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB246B55-788B-4B58-8739-994A66F91C8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB246B55-788B-4B58-8739-994A66F91C8A}.Release|Any CPU.Build.0 = Release|Any CPU
{2E39E532-B81E-4B48-A004-FAE18EDF9E79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E39E532-B81E-4B48-A004-FAE18EDF9E79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E39E532-B81E-4B48-A004-FAE18EDF9E79}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -778,6 +786,10 @@ Global
{9E8E6AA5-65D1-498F-BEAB-BA34723A0050}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E8E6AA5-65D1-498F-BEAB-BA34723A0050}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E8E6AA5-65D1-498F-BEAB-BA34723A0050}.Release|Any CPU.Build.0 = Release|Any CPU
{4EFC0DFB-9F04-4070-848A-856D2F11C1BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EFC0DFB-9F04-4070-848A-856D2F11C1BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EFC0DFB-9F04-4070-848A-856D2F11C1BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EFC0DFB-9F04-4070-848A-856D2F11C1BC}.Release|Any CPU.Build.0 = Release|Any CPU
{232DD918-46ED-4BA8-B383-1A9146D83064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{232DD918-46ED-4BA8-B383-1A9146D83064}.Debug|Any CPU.Build.0 = Debug|Any CPU
{232DD918-46ED-4BA8-B383-1A9146D83064}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -876,6 +888,7 @@ Global
{F6394475-D6F1-46E2-81BF-4BA78A40B878} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{BFDA179A-40EB-4CEB-B8E9-0DF32C65E2C5} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{45D6F69C-4D87-4130-AA90-0DB2F7460DAE} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{EB246B55-788B-4B58-8739-994A66F91C8A} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{2E39E532-B81E-4B48-A004-FAE18EDF9E79} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{7D5C6816-0DD2-4E13-A585-033B5D3C80D5} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{24431BF1-7BEB-4C53-BAE8-B9D9F622A240} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
Expand Down Expand Up @@ -946,6 +959,7 @@ Global
{31EE94A0-E721-4073-B6F1-DD912D004DEF} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{867BD04E-4670-4FBA-98D5-9F83220E6DFB} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{9E8E6AA5-65D1-498F-BEAB-BA34723A0050} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{4EFC0DFB-9F04-4070-848A-856D2F11C1BC} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{232DD918-46ED-4BA8-B383-1A9146D83064} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{B73C3CC0-9F16-4B34-92BE-6EC0853912C5} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{28B5DEDF-C19B-4A7E-B276-FC4C83DBB7EF} = {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 @@ -62,6 +62,7 @@
<Project Path="src/Testcontainers.RavenDb/Testcontainers.RavenDb.csproj"/>
<Project Path="src/Testcontainers.Redis/Testcontainers.Redis.csproj"/>
<Project Path="src/Testcontainers.Redpanda/Testcontainers.Redpanda.csproj"/>
<Project Path="src/Testcontainers.Seq/Testcontainers.Seq.csproj"/>
<Project Path="src/Testcontainers.ServiceBus/Testcontainers.ServiceBus.csproj"/>
<Project Path="src/Testcontainers.Sftp/Testcontainers.Sftp.csproj"/>
<Project Path="src/Testcontainers.Temporalio/Testcontainers.Temporalio.csproj"/>
Expand Down Expand Up @@ -134,6 +135,7 @@
<Project Path="tests/Testcontainers.Redis.Tests/Testcontainers.Redis.Tests.csproj"/>
<Project Path="tests/Testcontainers.Redpanda.Tests/Testcontainers.Redpanda.Tests.csproj"/>
<Project Path="tests/Testcontainers.ResourceReaper.Tests/Testcontainers.ResourceReaper.Tests.csproj"/>
<Project Path="tests/Testcontainers.Seq.Tests/Testcontainers.Seq.Tests.csproj"/>
<Project Path="tests/Testcontainers.ServiceBus.Tests/Testcontainers.ServiceBus.Tests.csproj"/>
<Project Path="tests/Testcontainers.Sftp.Tests/Testcontainers.Sftp.Tests.csproj"/>
<Project Path="tests/Testcontainers.Temporalio.Tests/Testcontainers.Temporalio.Tests.csproj"/>
Expand Down
1 change: 1 addition & 0 deletions src/Testcontainers.Seq/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root = true
125 changes: 125 additions & 0 deletions src/Testcontainers.Seq/SeqBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
namespace Testcontainers.Seq;

/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
[PublicAPI]
public sealed class SeqBuilder : ContainerBuilder<SeqBuilder, SeqContainer, SeqConfiguration>
{
public const string SeqImage = "datalust/seq:2025.2";

public const ushort SeqPort = 80;

/// <summary>
/// Initializes a new instance of the <see cref="SeqBuilder" /> class.
/// </summary>
[Obsolete("This parameterless constructor is obsolete and will be removed. Use the constructor with the image parameter instead: https://github.com/testcontainers/testcontainers-dotnet/discussions/1470#discussioncomment-15185721.")]
[ExcludeFromCodeCoverage]
public SeqBuilder()
: this(SeqImage)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="SeqBuilder" /> class.
/// </summary>
/// <param name="image">
/// The full Docker image name, including the image repository and tag
/// (e.g., <c>datalust/seq:2025.2</c>).
/// </param>
/// <remarks>
/// Docker image tags available at <see href="https://hub.docker.com/r/datalust/seq" />.
/// </remarks>
public SeqBuilder(string image)
: this(new DockerImage(image))
{
}

/// <summary>
/// Initializes a new instance of the <see cref="SeqBuilder" /> class.
/// </summary>
/// <param name="image">
/// An <see cref="IImage" /> instance that specifies the Docker image to be used
/// for the container builder configuration.
/// </param>
/// <remarks>
/// Docker image tags available at <see href="https://hub.docker.com/r/datalust/seq" />.
/// </remarks>
public SeqBuilder(IImage image)
: this(new SeqConfiguration())
{
DockerResourceConfiguration = Init().WithImage(image).DockerResourceConfiguration;
}

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

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

/// <inheritdoc />
protected override string AcceptLicenseAgreementEnvVar { get; } = "ACCEPT_EULA";

/// <inheritdoc />
protected override string AcceptLicenseAgreement { get; } = "Y";

/// <inheritdoc />
protected override string DeclineLicenseAgreement { get; } = "N";

/// <summary>
/// Accepts the license agreement.
/// </summary>
/// <remarks>
/// When <paramref name="acceptLicenseAgreement" /> is set to <c>true</c>, the Seq <see href="https://datalust.co/doc/eula-current.pdf">license</see> is accepted.
/// </remarks>
/// <param name="acceptLicenseAgreement">A boolean value indicating whether the Seq license agreement is accepted.</param>
/// <returns>A configured instance of <see cref="SeqBuilder" />.</returns>
public override SeqBuilder WithAcceptLicenseAgreement(bool acceptLicenseAgreement)
{
var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement;
return WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

/// <inheritdoc />
public override SeqContainer Build()
{
Validate();
ValidateLicenseAgreement();

return new SeqContainer(DockerResourceConfiguration);
}

/// <inheritdoc />
protected override SeqBuilder Init()
{
return base.Init()
.WithPortBinding(SeqPort, true)
.WithEnvironment("SEQ_FIRSTRUN_NOAUTHENTICATION", "true")
.WithConnectionStringProvider(new SeqConnectionStringProvider())
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
request.ForPort(SeqPort).ForPath("/health")));
}

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

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

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

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

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

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

/// <summary>
/// Provides the Seq connection string.
/// </summary>
internal sealed class SeqConnectionStringProvider : ContainerConnectionStringProvider<SeqContainer, SeqConfiguration>
{
/// <inheritdoc />
protected override string GetHostConnectionString()
{
return Container.GetEndpoint();
}
}
24 changes: 24 additions & 0 deletions src/Testcontainers.Seq/SeqContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace Testcontainers.Seq;

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

/// <summary>
/// Gets the Seq endpoint.
/// </summary>
/// <returns>The Seq endpoint.</returns>
public string GetEndpoint()
{
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(SeqBuilder.SeqPort)).ToString();
}
}
12 changes: 12 additions & 0 deletions src/Testcontainers.Seq/Testcontainers.Seq.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>
8 changes: 8 additions & 0 deletions src/Testcontainers.Seq/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global using System;
global using System.Diagnostics.CodeAnalysis;
global using Docker.DotNet.Models;
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using DotNet.Testcontainers.Images;
global using JetBrains.Annotations;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Testcontainers.EventHubs;

public sealed partial class DeclineLicenseAgreementTest
{
private const string EventHubsName = "eh-1";

private const string EventHubsConsumerGroupName = "cg-1";

[GeneratedRegex("The image '.+' requires you to accept a license agreement\\.")]
private static partial Regex LicenseAgreementNotAccepted();

[Fact]
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
public void WithoutAcceptingLicenseAgreementThrowsArgumentException()
{
var exception = Assert.Throws<ArgumentException>(() => new EventHubsBuilder(TestSession.GetImageFromDockerfile()).WithConfigurationBuilder(GetServiceConfiguration()).Build());
Assert.Matches(LicenseAgreementNotAccepted(), exception.Message);
}

[Fact]
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
public void WithLicenseAgreementDeclinedThrowsArgumentException()
{
var exception = Assert.Throws<ArgumentException>(() => new EventHubsBuilder(TestSession.GetImageFromDockerfile()).WithAcceptLicenseAgreement(false).WithConfigurationBuilder(GetServiceConfiguration()).Build());
Assert.Matches(LicenseAgreementNotAccepted(), exception.Message);
}

private static EventHubsServiceConfiguration GetServiceConfiguration()
{
return EventHubsServiceConfiguration.Create().WithEntity(EventHubsName, 2, EventHubConsumerClient.DefaultConsumerGroupName, EventHubsConsumerGroupName);
}
}
1 change: 1 addition & 0 deletions tests/Testcontainers.EventHubs.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
global using System;
global using System.Text;
global using System.Text.RegularExpressions;
global using System.Threading.Tasks;
global using Azure.Messaging.EventHubs;
global using Azure.Messaging.EventHubs.Consumer;
Expand Down
1 change: 1 addition & 0 deletions tests/Testcontainers.Seq.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.Seq.Tests/.runs-on
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ubuntu-24.04
Loading
Loading