Skip to content

Commit 3e8e1db

Browse files
objectHofmeisterAn
andauthored
feat: Add Floci module (#1690)
Co-authored-by: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
1 parent 16cabf1 commit 3e8e1db

18 files changed

Lines changed: 432 additions & 42 deletions

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
<!-- Third-party client dependencies to connect and interact with the containers: -->
3434
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.1"/>
3535
<PackageVersion Include="ArangoDBNetStandard" Version="2.0.1"/>
36-
<PackageVersion Include="AWSSDK.CloudWatchLogs" Version="3.7.104.14"/>
37-
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="3.7.101.42"/>
38-
<PackageVersion Include="AWSSDK.S3" Version="3.7.103.3"/>
39-
<PackageVersion Include="AWSSDK.SimpleNotificationService" Version="3.7.101.7"/>
40-
<PackageVersion Include="AWSSDK.SQS" Version="3.7.100.71"/>
36+
<PackageVersion Include="AWSSDK.CloudWatchLogs" Version="4.0.24"/>
37+
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="4.0.18.1"/>
38+
<PackageVersion Include="AWSSDK.S3" Version="4.0.23"/>
39+
<PackageVersion Include="AWSSDK.SimpleNotificationService" Version="4.0.2.30"/>
40+
<PackageVersion Include="AWSSDK.SQS" Version="4.0.2.28"/>
4141
<PackageVersion Include="Azure.Data.Tables" Version="12.8.0"/>
4242
<PackageVersion Include="Azure.Identity" Version="1.13.2"/>
4343
<PackageVersion Include="Azure.Messaging.EventHubs" Version="5.11.3"/>

Testcontainers.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.FirebirdSql"
5959
EndProject
6060
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Firestore", "src\Testcontainers.Firestore\Testcontainers.Firestore.csproj", "{B3CC460D-0DFD-48A8-9502-54E9828B7B05}"
6161
EndProject
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Floci", "src\Testcontainers.Floci\Testcontainers.Floci.csproj", "{E502A392-8DF3-465D-8ACA-3191162BDF81}"
63+
EndProject
6264
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.GCloud", "src\Testcontainers.GCloud\Testcontainers.GCloud.csproj", "{D7CE8744-E58B-4277-BBB7-6840A4FF2049}"
6365
EndProject
6466
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Grafana", "src\Testcontainers.Grafana\Testcontainers.Grafana.csproj", "{A2E5D4B5-7F2C-4E8D-9B3A-6C2D8F9E1A3B}"
@@ -189,6 +191,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.FirebirdSql.
189191
EndProject
190192
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Firestore.Tests", "tests\Testcontainers.Firestore.Tests\Testcontainers.Firestore.Tests.csproj", "{2F0D7CD6-7EA9-46FC-B8F2-25D55699525F}"
191193
EndProject
194+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Floci.Tests", "tests\Testcontainers.Floci.Tests\Testcontainers.Floci.Tests.csproj", "{A99A3CD3-3EF2-4EF3-919F-814C9EE2B821}"
195+
EndProject
192196
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Grafana.Tests", "tests\Testcontainers.Grafana.Tests\Testcontainers.Grafana.Tests.csproj", "{C3F5E8D2-9A1B-4F7E-8D6C-5B9A2E4F7C8D}"
193197
EndProject
194198
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.InfluxDb.Tests", "tests\Testcontainers.InfluxDb.Tests\Testcontainers.InfluxDb.Tests.csproj", "{B45B0EF2-5852-4ED3-904A-8FC62A3253D7}"
@@ -371,6 +375,10 @@ Global
371375
{B3CC460D-0DFD-48A8-9502-54E9828B7B05}.Debug|Any CPU.Build.0 = Debug|Any CPU
372376
{B3CC460D-0DFD-48A8-9502-54E9828B7B05}.Release|Any CPU.ActiveCfg = Release|Any CPU
373377
{B3CC460D-0DFD-48A8-9502-54E9828B7B05}.Release|Any CPU.Build.0 = Release|Any CPU
378+
{E502A392-8DF3-465D-8ACA-3191162BDF81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
379+
{E502A392-8DF3-465D-8ACA-3191162BDF81}.Debug|Any CPU.Build.0 = Debug|Any CPU
380+
{E502A392-8DF3-465D-8ACA-3191162BDF81}.Release|Any CPU.ActiveCfg = Release|Any CPU
381+
{E502A392-8DF3-465D-8ACA-3191162BDF81}.Release|Any CPU.Build.0 = Release|Any CPU
374382
{D7CE8744-E58B-4277-BBB7-6840A4FF2049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
375383
{D7CE8744-E58B-4277-BBB7-6840A4FF2049}.Debug|Any CPU.Build.0 = Debug|Any CPU
376384
{D7CE8744-E58B-4277-BBB7-6840A4FF2049}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -631,6 +639,10 @@ Global
631639
{2F0D7CD6-7EA9-46FC-B8F2-25D55699525F}.Debug|Any CPU.Build.0 = Debug|Any CPU
632640
{2F0D7CD6-7EA9-46FC-B8F2-25D55699525F}.Release|Any CPU.ActiveCfg = Release|Any CPU
633641
{2F0D7CD6-7EA9-46FC-B8F2-25D55699525F}.Release|Any CPU.Build.0 = Release|Any CPU
642+
{A99A3CD3-3EF2-4EF3-919F-814C9EE2B821}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
643+
{A99A3CD3-3EF2-4EF3-919F-814C9EE2B821}.Debug|Any CPU.Build.0 = Debug|Any CPU
644+
{A99A3CD3-3EF2-4EF3-919F-814C9EE2B821}.Release|Any CPU.ActiveCfg = Release|Any CPU
645+
{A99A3CD3-3EF2-4EF3-919F-814C9EE2B821}.Release|Any CPU.Build.0 = Release|Any CPU
634646
{C3F5E8D2-9A1B-4F7E-8D6C-5B9A2E4F7C8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
635647
{C3F5E8D2-9A1B-4F7E-8D6C-5B9A2E4F7C8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
636648
{C3F5E8D2-9A1B-4F7E-8D6C-5B9A2E4F7C8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -856,6 +868,7 @@ Global
856868
{FF86B509-2F9E-4269-ABC2-912B3339DE29} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
857869
{31BAF2C4-0608-4C0F-845A-14FE7C0A1670} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
858870
{B3CC460D-0DFD-48A8-9502-54E9828B7B05} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
871+
{E502A392-8DF3-465D-8ACA-3191162BDF81} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
859872
{D7CE8744-E58B-4277-BBB7-6840A4FF2049} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
860873
{A2E5D4B5-7F2C-4E8D-9B3A-6C2D8F9E1A3B} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
861874
{8F483B83-7BD4-4BD5-9F03-DFC26E1CE678} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
@@ -921,6 +934,7 @@ Global
921934
{9F27AA1B-C25D-400C-BCB0-6B0BF1A1DCEA} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
922935
{E39095AC-9B34-4178-A486-04C902B6FD33} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
923936
{2F0D7CD6-7EA9-46FC-B8F2-25D55699525F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
937+
{A99A3CD3-3EF2-4EF3-919F-814C9EE2B821} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
924938
{C3F5E8D2-9A1B-4F7E-8D6C-5B9A2E4F7C8D} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
925939
{B45B0EF2-5852-4ED3-904A-8FC62A3253D7} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
926940
{BEFC4109-4511-4FBD-AC4F-3D3B388B8CAD} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root = true
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
namespace Testcontainers.Floci;
2+
3+
/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
4+
[PublicAPI]
5+
public sealed class FlociBuilder : ContainerBuilder<FlociBuilder, FlociContainer, FlociConfiguration>
6+
{
7+
[Obsolete("This constant is obsolete and will be removed in the future. Use the constructor with the image parameter instead: https://github.com/testcontainers/testcontainers-dotnet/discussions/1470#discussioncomment-15185721.")]
8+
public const string FlociImage = "floci/floci:1.5.13";
9+
10+
public const ushort FlociPort = 4566;
11+
12+
public const string AccessKey = "test";
13+
14+
public const string SecretKey = "test";
15+
16+
public const string Region = "us-east-1";
17+
18+
/// <summary>
19+
/// Initializes a new instance of the <see cref="FlociBuilder" /> class.
20+
/// </summary>
21+
[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.")]
22+
public FlociBuilder()
23+
: this(FlociImage)
24+
{
25+
}
26+
27+
/// <summary>
28+
/// Initializes a new instance of the <see cref="FlociBuilder" /> class.
29+
/// </summary>
30+
/// <param name="image">
31+
/// The full Docker image name, including the image repository and tag
32+
/// (e.g., <c>floci/floci:1.5.13</c>).
33+
/// </param>
34+
/// <remarks>
35+
/// Docker image tags available at <see href="https://hub.docker.com/r/floci/floci/tags" />.
36+
/// </remarks>
37+
public FlociBuilder(string image)
38+
: this(new DockerImage(image))
39+
{
40+
}
41+
42+
/// <summary>
43+
/// Initializes a new instance of the <see cref="FlociBuilder" /> class.
44+
/// </summary>
45+
/// <param name="image">
46+
/// An <see cref="IImage" /> instance that specifies the Docker image to be used
47+
/// for the container builder configuration.
48+
/// </param>
49+
/// <remarks>
50+
/// Docker image tags available at <see href="https://hub.docker.com/r/floci/floci/tags" />.
51+
/// </remarks>
52+
public FlociBuilder(IImage image)
53+
: this(new FlociConfiguration())
54+
{
55+
DockerResourceConfiguration = Init().WithImage(image).DockerResourceConfiguration;
56+
}
57+
58+
/// <summary>
59+
/// Initializes a new instance of the <see cref="FlociBuilder" /> class.
60+
/// </summary>
61+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
62+
private FlociBuilder(FlociConfiguration resourceConfiguration)
63+
: base(resourceConfiguration)
64+
{
65+
DockerResourceConfiguration = resourceConfiguration;
66+
}
67+
68+
/// <inheritdoc />
69+
protected override FlociConfiguration DockerResourceConfiguration { get; }
70+
71+
/// <inheritdoc />
72+
public override FlociContainer Build()
73+
{
74+
Validate();
75+
return new FlociContainer(DockerResourceConfiguration);
76+
}
77+
78+
/// <inheritdoc />
79+
protected override FlociBuilder Init()
80+
{
81+
return base.Init()
82+
.WithPortBinding(FlociPort, true)
83+
.WithConnectionStringProvider(new FlociConnectionStringProvider())
84+
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
85+
request.ForPath("/_floci/health").ForPort(FlociPort)));
86+
}
87+
88+
/// <inheritdoc />
89+
protected override FlociBuilder Clone(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
90+
{
91+
return Merge(DockerResourceConfiguration, new FlociConfiguration(resourceConfiguration));
92+
}
93+
94+
/// <inheritdoc />
95+
protected override FlociBuilder Clone(IContainerConfiguration resourceConfiguration)
96+
{
97+
return Merge(DockerResourceConfiguration, new FlociConfiguration(resourceConfiguration));
98+
}
99+
100+
/// <inheritdoc />
101+
protected override FlociBuilder Merge(FlociConfiguration oldValue, FlociConfiguration newValue)
102+
{
103+
return new FlociBuilder(new FlociConfiguration(oldValue, newValue));
104+
}
105+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
namespace Testcontainers.Floci;
2+
3+
/// <inheritdoc cref="ContainerConfiguration" />
4+
[PublicAPI]
5+
public sealed class FlociConfiguration : ContainerConfiguration
6+
{
7+
/// <summary>
8+
/// Initializes a new instance of the <see cref="FlociConfiguration" /> class.
9+
/// </summary>
10+
public FlociConfiguration()
11+
{
12+
}
13+
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="FlociConfiguration" /> class.
16+
/// </summary>
17+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
18+
public FlociConfiguration(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
19+
: base(resourceConfiguration)
20+
{
21+
}
22+
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="FlociConfiguration" /> class.
25+
/// </summary>
26+
/// <param name="resourceConfiguration">The container configuration.</param>
27+
public FlociConfiguration(IContainerConfiguration resourceConfiguration)
28+
: base(resourceConfiguration)
29+
{
30+
}
31+
32+
/// <summary>
33+
/// Initializes a new instance of the <see cref="FlociConfiguration" /> class.
34+
/// </summary>
35+
/// <param name="oldValue">The old Floci configuration.</param>
36+
/// <param name="newValue">The new Floci configuration.</param>
37+
public FlociConfiguration(FlociConfiguration oldValue, FlociConfiguration newValue)
38+
: base(oldValue, newValue)
39+
{
40+
}
41+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Testcontainers.Floci;
2+
3+
/// <summary>
4+
/// Provides the Floci connection string.
5+
/// </summary>
6+
internal sealed class FlociConnectionStringProvider : ContainerConnectionStringProvider<FlociContainer, FlociConfiguration>
7+
{
8+
/// <inheritdoc />
9+
protected override string GetHostConnectionString()
10+
{
11+
return Container.GetConnectionString();
12+
}
13+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace Testcontainers.Floci;
2+
3+
/// <inheritdoc cref="DockerContainer" />
4+
[PublicAPI]
5+
public sealed class FlociContainer : DockerContainer
6+
{
7+
/// <summary>
8+
/// Initializes a new instance of the <see cref="FlociContainer" /> class.
9+
/// </summary>
10+
/// <param name="configuration">The container configuration.</param>
11+
public FlociContainer(FlociConfiguration configuration)
12+
: base(configuration)
13+
{
14+
}
15+
16+
/// <summary>
17+
/// Gets the Floci connection string.
18+
/// </summary>
19+
/// <returns>The Floci connection string.</returns>
20+
public string GetConnectionString()
21+
{
22+
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(FlociBuilder.FlociPort)).ToString();
23+
}
24+
}
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>

src/Testcontainers.Floci/Usings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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 DotNet.Testcontainers.Images;
7+
global using JetBrains.Annotations;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root = true

0 commit comments

Comments
 (0)