-
-
Notifications
You must be signed in to change notification settings - Fork 345
feat: Add Seq module #1276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
HofmeisterAn
merged 5 commits into
testcontainers:develop
from
montanehamilton:feature/add-seq-module
Feb 27, 2026
Merged
feat: Add Seq module #1276
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8cad0fb
Add Seq Module
76e1ccb
Merge remote-tracking branch 'origin/develop' into fork/montanehamilt…
HofmeisterAn 5e215f6
chore(Seq): Update to recent repo standards
HofmeisterAn 8296633
fix(EventHubs): Configure builder correct
HofmeisterAn ad4a4fd
chore: Apply code suggestions
HofmeisterAn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| root = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
|
|
||
| /// <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)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
32 changes: 32 additions & 0 deletions
32
tests/Testcontainers.EventHubs.Tests/DeclineLicenseAgreementTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| root = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ubuntu-24.04 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.