diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 000000000..017fac759
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "csharpier": {
+ "version": "1.1.1",
+ "commands": [
+ "csharpier"
+ ],
+ "rollForward": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/.csharpierignore b/.csharpierignore
new file mode 100644
index 000000000..fd8b50f69
--- /dev/null
+++ b/.csharpierignore
@@ -0,0 +1 @@
+cake.config
diff --git a/.github/workflows/csharpier.yml b/.github/workflows/csharpier.yml
new file mode 100644
index 000000000..5e35ddb26
--- /dev/null
+++ b/.github/workflows/csharpier.yml
@@ -0,0 +1,14 @@
+name: Formatting check
+
+on:
+ workflow_dispatch:
+ pull_request:
+
+jobs:
+ formatting-check:
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ steps:
+ - name: CSharpier Linter
+ uses: guibranco/github-csharpier-linter-action@v1.0.5
diff --git a/.gitignore b/.gitignore
index b50736e50..a597823c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -402,4 +402,6 @@ FodyWeavers.xsd
# JetBrains Rider
.idea/
-*.sln.iml
\ No newline at end of file
+*.sln.iml
+
+test-results/
diff --git a/Directory.Build.props b/Directory.Build.props
index bd9487ff1..0703330f3 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -36,10 +36,25 @@
-
-
+
+
-
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
index e6f7d7ac9..cf03c847a 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,90 +1,90 @@
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.ps1 b/build.ps1
index a7077190a..49560a7fc 100644
--- a/build.ps1
+++ b/build.ps1
@@ -1,2 +1,2 @@
dotnet run --project build/Build.csproj -- $args
-exit $LASTEXITCODE;
\ No newline at end of file
+exit $LASTEXITCODE;
diff --git a/build.sh b/build.sh
index b311fae84..be742860a 100755
--- a/build.sh
+++ b/build.sh
@@ -1 +1,5 @@
-dotnet run --project ./build/Build.csproj -- "$@"
\ No newline at end of file
+#!/bin/sh
+
+set -e
+
+dotnet run --project ./build/Build.csproj -- "$@"
diff --git a/build/Build.csproj b/build/Build.csproj
index d980d599c..0e266c94a 100644
--- a/build/Build.csproj
+++ b/build/Build.csproj
@@ -1,13 +1,13 @@
-
- net9.0
- Exe
- false
- $(MSBuildProjectDirectory)/..
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net9.0
+ Exe
+ false
+ $(MSBuildProjectDirectory)/..
+
+
+
+
+
+
+
diff --git a/build/Credentials.cs b/build/Credentials.cs
index 817050b62..873144f10 100644
--- a/build/Credentials.cs
+++ b/build/Credentials.cs
@@ -13,8 +13,7 @@ private BuildCredentials(string username, string password)
public static BuildCredentials GetCodeSigningCertificateCredentials(ICakeContext context)
{
- return new BuildCredentials
- (
+ return new BuildCredentials(
null,
context.EnvironmentVariable("CODE_SIGNING_CERTIFICATE_PASSWORD")
);
@@ -38,8 +37,7 @@ private SonarQubeCredentials(string url, string key, string token, string organi
public static SonarQubeCredentials GetSonarQubeCredentials(ICakeContext context)
{
- return new SonarQubeCredentials
- (
+ return new SonarQubeCredentials(
context.EnvironmentVariable("SONARCLOUD_URL"),
context.EnvironmentVariable("SONARCLOUD_KEY"),
context.EnvironmentVariable("SONARCLOUD_TOKEN"),
@@ -61,10 +59,9 @@ private NuGetCredentials(string source, string apiKey)
public static NuGetCredentials GetNuGetCredentials(ICakeContext context)
{
- return new NuGetCredentials
- (
+ return new NuGetCredentials(
context.EnvironmentVariable("FEED_SOURCE"),
context.EnvironmentVariable("FEED_API_KEY")
);
}
-}
\ No newline at end of file
+}
diff --git a/build/Parameters.cs b/build/Parameters.cs
index ecb4a8930..e37893172 100644
--- a/build/Parameters.cs
+++ b/build/Parameters.cs
@@ -2,9 +2,7 @@ namespace Testcontainers.Build;
internal sealed class BuildParameters
{
- private BuildParameters()
- {
- }
+ private BuildParameters() { }
public string Solution { get; private set; }
public string Target { get; private set; }
@@ -39,7 +37,10 @@ public static BuildParameters Instance(ICakeContext context)
{
Solution = context.MakeAbsolute(new DirectoryPath(solutionFilePath)).FullPath,
Target = context.Argument("target", "Default"),
- Configuration = context.Argument("configuration", buildInformation.IsReleaseBuild ? "Release" : "Debug"),
+ Configuration = context.Argument(
+ "configuration",
+ buildInformation.IsReleaseBuild ? "Release" : "Debug"
+ ),
Sha = buildInformation.Sha,
Branch = buildInformation.Branch,
SourceBranch = buildInformation.SourceBranch,
@@ -53,11 +54,12 @@ public static BuildParameters Instance(ICakeContext context)
IsPullRequest = buildInformation.IsPullRequest,
ShouldPublish = !buildInformation.IsLocalBuild && buildInformation.ShouldPublish,
Verbosity = DotNetVerbosity.Minimal,
- CodeSigningCertificateCredentials = BuildCredentials.GetCodeSigningCertificateCredentials(context),
+ CodeSigningCertificateCredentials =
+ BuildCredentials.GetCodeSigningCertificateCredentials(context),
SonarQubeCredentials = SonarQubeCredentials.GetSonarQubeCredentials(context),
NuGetCredentials = NuGetCredentials.GetNuGetCredentials(context),
Projects = BuildProjects.Instance(context, solutionFilePath),
Paths = BuildPaths.Instance(context, buildInformation.Version),
};
}
-}
\ No newline at end of file
+}
diff --git a/build/Paths.cs b/build/Paths.cs
index e9f320049..771f9f8b4 100644
--- a/build/Paths.cs
+++ b/build/Paths.cs
@@ -2,9 +2,7 @@ namespace Testcontainers.Build;
internal sealed class BuildPaths
{
- private BuildPaths()
- {
- }
+ private BuildPaths() { }
public BuildFiles Files { get; private set; }
public BuildDirectories Directories { get; private set; }
@@ -55,7 +53,8 @@ public BuildDirectories(
DirectoryPath testResultsDir,
DirectoryPath testCoverageDir,
DirectoryPath nugetDir,
- DirectoryPath artifactsDir)
+ DirectoryPath artifactsDir
+ )
{
TestResultsDirectoryPath = testResultsDir;
TestCoverageDirectoryPath = testCoverageDir;
@@ -70,4 +69,4 @@ public BuildDirectories(
new DirectoryPath(".sonarqube"),
};
}
-}
\ No newline at end of file
+}
diff --git a/build/Program.cs b/build/Program.cs
index a3e410daf..673f68628 100644
--- a/build/Program.cs
+++ b/build/Program.cs
@@ -10,4 +10,4 @@ public static int Main(string[] args)
.UseLifetime()
.Run(args);
}
-}
\ No newline at end of file
+}
diff --git a/build/Projects.cs b/build/Projects.cs
index 7dbd8f0e4..5192c9bfc 100644
--- a/build/Projects.cs
+++ b/build/Projects.cs
@@ -2,9 +2,7 @@ namespace Testcontainers.Build;
internal sealed class BuildProjects
{
- private BuildProjects()
- {
- }
+ private BuildProjects() { }
public ICollection All { get; private set; }
public ICollection NoneTests { get; private set; }
@@ -23,4 +21,4 @@ public static BuildProjects Instance(ICakeContext context, string solutionFilePa
Testcontainers = allProjects.Single(project => "Testcontainers".Equals(project.Name)),
};
}
-}
\ No newline at end of file
+}
diff --git a/build/Tasks.cs b/build/Tasks.cs
index 30e53b693..72252fb5b 100644
--- a/build/Tasks.cs
+++ b/build/Tasks.cs
@@ -6,18 +6,21 @@ public sealed class BuildContext(ICakeContext context) : FrostingContext(context
public void DotNetTest(SolutionProject project)
{
- this.DotNetTest(project.Path.FullPath, new DotNetTestSettings
- {
- Configuration = Parameters.Configuration,
- Verbosity = Parameters.Verbosity,
- NoRestore = true,
- NoBuild = true,
- Collectors = ["XPlat Code Coverage;Format=opencover"],
- Filter = Parameters.TestFilter,
- ResultsDirectory = Parameters.Paths.Directories.TestResultsDirectoryPath,
- ArgumentCustomization = args => args
- .AppendSwitchQuoted("--blame-hang-timeout", "5m"),
- });
+ this.DotNetTest(
+ project.Path.FullPath,
+ new DotNetTestSettings
+ {
+ Configuration = Parameters.Configuration,
+ Verbosity = Parameters.Verbosity,
+ NoRestore = true,
+ NoBuild = true,
+ Collectors = ["XPlat Code Coverage;Format=opencover"],
+ Filter = Parameters.TestFilter,
+ ResultsDirectory = Parameters.Paths.Directories.TestResultsDirectoryPath,
+ ArgumentCustomization = args =>
+ args.AppendSwitchQuoted("--blame-hang-timeout", "5m"),
+ }
+ );
}
}
@@ -26,12 +29,15 @@ public sealed class BuildLifetime : FrostingLifetime
public override void Setup(BuildContext context, ISetupContext info)
{
var param = context.Parameters;
- context.Information("Building version {0} of Testcontainers ({1}@{2})", param.Version, param.Branch, param.Sha);
+ context.Information(
+ "Building version {0} of Testcontainers ({1}@{2})",
+ param.Version,
+ param.Branch,
+ param.Sha
+ );
}
- public override void Teardown(BuildContext context, ITeardownContext info)
- {
- }
+ public override void Teardown(BuildContext context, ITeardownContext info) { }
}
[TaskName("Clean")]
@@ -61,10 +67,10 @@ public sealed class RestoreNuGetPackagesTask : FrostingTask
public override void Run(BuildContext context)
{
var param = context.Parameters;
- context.DotNetRestore(param.Solution, new DotNetRestoreSettings
- {
- Verbosity = param.Verbosity,
- });
+ context.DotNetRestore(
+ param.Solution,
+ new DotNetRestoreSettings { Verbosity = param.Verbosity }
+ );
}
}
@@ -92,16 +98,22 @@ public override void Run(BuildContext context)
// save build time.
var solutionOrProjectFilePath = string.IsNullOrEmpty(param.TestProject)
? param.Solution
- : param.Projects.OnlyTests.Single(testProject => testProject.Path.FullPath.EndsWith(param.TestProject + ".Tests.csproj")).Path.FullPath;
+ : param
+ .Projects.OnlyTests.Single(testProject =>
+ testProject.Path.FullPath.EndsWith(param.TestProject + ".Tests.csproj")
+ )
+ .Path.FullPath;
- context.DotNetBuild(solutionOrProjectFilePath, new DotNetBuildSettings
- {
- Configuration = param.Configuration,
- Verbosity = param.Verbosity,
- NoRestore = true,
- ArgumentCustomization = args => args
- .Append("/p:ContinuousIntegrationBuild=true"),
- });
+ context.DotNetBuild(
+ solutionOrProjectFilePath,
+ new DotNetBuildSettings
+ {
+ Configuration = param.Configuration,
+ Verbosity = param.Verbosity,
+ NoRestore = true,
+ ArgumentCustomization = args => args.Append("/p:ContinuousIntegrationBuild=true"),
+ }
+ );
}
}
@@ -111,7 +123,9 @@ public sealed class TestTask : FrostingTask
public override void Run(BuildContext context)
{
var param = context.Parameters;
- var testProject = param.Projects.OnlyTests.Single(testProject => testProject.Path.FullPath.EndsWith(param.TestProject + ".Tests.csproj"));
+ var testProject = param.Projects.OnlyTests.Single(testProject =>
+ testProject.Path.FullPath.EndsWith(param.TestProject + ".Tests.csproj")
+ );
context.DotNetTest(testProject);
}
}
@@ -129,35 +143,62 @@ public override void Run(BuildContext context)
}
}
+[TaskName("Format")]
+public sealed class CheckFormatTask : FrostingTask
+{
+ public override void Run(BuildContext context)
+ {
+ var param = context.Parameters;
+ context.DotNetTool("./", "csharpier", "format .");
+ }
+}
+
+[TaskName("Check-Format")]
+public sealed class FormatTask : FrostingTask
+{
+ public override void Run(BuildContext context)
+ {
+ var param = context.Parameters;
+ context.DotNetTool("./", "csharpier", "check .");
+ }
+}
+
[TaskName("Sonar-Begin")]
public sealed class SonarBeginTask : FrostingTask
{
public override void Run(BuildContext context)
{
var param = context.Parameters;
- context.SonarBegin(new SonarBeginSettings
- {
- Url = param.SonarQubeCredentials.Url,
- Key = param.SonarQubeCredentials.Key,
- Token = param.SonarQubeCredentials.Token,
- Organization = param.SonarQubeCredentials.Organization,
- // A pull request analysis cannot have the branch analysis parameter 'sonar.branch.name'.
- Branch = param.IsPullRequest ? null : param.Branch,
- UseCoreClr = true,
- Silent = true,
- Version = param.Version[..5],
- PullRequestProvider = "GitHub",
- PullRequestGithubEndpoint = "https://api.github.com/",
- PullRequestGithubRepository = "testcontainers/testcontainers-dotnet",
- PullRequestKey = param.IsPullRequest && int.TryParse(param.PullRequestId, out var id) ? id : null,
- PullRequestBranch = param.SourceBranch,
- PullRequestBase = param.TargetBranch,
- OpenCoverReportsPath = $"{context.MakeAbsolute(param.Paths.Directories.TestResultsDirectoryPath)}/**/*.opencover.xml",
- VsTestReportsPath = $"{context.MakeAbsolute(param.Paths.Directories.TestResultsDirectoryPath)}/**/*.trx",
- ArgumentCustomization = args => args
- .Append("/d:sonar.scanner.scanAll=\"false\"")
- .Append("/d:sonar.scanner.skipJreProvisioning=\"true\""),
- });
+ context.SonarBegin(
+ new SonarBeginSettings
+ {
+ Url = param.SonarQubeCredentials.Url,
+ Key = param.SonarQubeCredentials.Key,
+ Token = param.SonarQubeCredentials.Token,
+ Organization = param.SonarQubeCredentials.Organization,
+ // A pull request analysis cannot have the branch analysis parameter 'sonar.branch.name'.
+ Branch = param.IsPullRequest ? null : param.Branch,
+ UseCoreClr = true,
+ Silent = true,
+ Version = param.Version[..5],
+ PullRequestProvider = "GitHub",
+ PullRequestGithubEndpoint = "https://api.github.com/",
+ PullRequestGithubRepository = "testcontainers/testcontainers-dotnet",
+ PullRequestKey =
+ param.IsPullRequest && int.TryParse(param.PullRequestId, out var id)
+ ? id
+ : null,
+ PullRequestBranch = param.SourceBranch,
+ PullRequestBase = param.TargetBranch,
+ OpenCoverReportsPath =
+ $"{context.MakeAbsolute(param.Paths.Directories.TestResultsDirectoryPath)}/**/*.opencover.xml",
+ VsTestReportsPath =
+ $"{context.MakeAbsolute(param.Paths.Directories.TestResultsDirectoryPath)}/**/*.trx",
+ ArgumentCustomization = args =>
+ args.Append("/d:sonar.scanner.scanAll=\"false\"")
+ .Append("/d:sonar.scanner.skipJreProvisioning=\"true\""),
+ }
+ );
}
}
@@ -167,11 +208,9 @@ public sealed class SonarEndTask : FrostingTask
public override void Run(BuildContext context)
{
var param = context.Parameters;
- context.SonarEnd(new SonarEndSettings
- {
- Token = param.SonarQubeCredentials.Token,
- UseCoreClr = true,
- });
+ context.SonarEnd(
+ new SonarEndSettings { Token = param.SonarQubeCredentials.Token, UseCoreClr = true }
+ );
}
}
@@ -183,16 +222,18 @@ public sealed class CreateNuGetPackagesTask : FrostingTask
public override void Run(BuildContext context)
{
var param = context.Parameters;
- context.DotNetPack(param.Solution, new DotNetPackSettings
- {
- Configuration = param.Configuration,
- Verbosity = param.Verbosity,
- NoRestore = true,
- NoBuild = true,
- OutputDirectory = param.Paths.Directories.NuGetDirectoryPath,
- ArgumentCustomization = args => args
- .Append($"/p:Version={param.Version}"),
- });
+ context.DotNetPack(
+ param.Solution,
+ new DotNetPackSettings
+ {
+ Configuration = param.Configuration,
+ Verbosity = param.Verbosity,
+ NoRestore = true,
+ NoBuild = true,
+ OutputDirectory = param.Paths.Directories.NuGetDirectoryPath,
+ ArgumentCustomization = args => args.Append($"/p:Version={param.Version}"),
+ }
+ );
}
}
@@ -200,21 +241,33 @@ public override void Run(BuildContext context)
public sealed class SignNuGetPackagesTask : FrostingTask
{
// We do not have access to a valid code signing certificate anymore.
- public override bool ShouldRun(BuildContext context) => /* context.Parameters.ShouldPublish */ false;
+ public override bool ShouldRun(BuildContext context) => /* context.Parameters.ShouldPublish */
+ false;
public override void Run(BuildContext context)
{
var param = context.Parameters;
- context.StartProcess("dotnet", new ProcessSettings
- {
- Arguments = new ProcessArgumentBuilder()
- .Append("nuget")
- .Append("sign")
- .AppendSwitchQuoted("--certificate-path", param.Paths.Files.CodeSigningCertificateFilePath.FullPath)
- .AppendSwitchQuoted("--certificate-password", param.CodeSigningCertificateCredentials.Password)
- .AppendSwitchQuoted("--timestamper", "http://ts.quovadisglobal.com/eu")
- .Append($"{context.MakeAbsolute(param.Paths.Directories.NuGetDirectoryPath)}/**/*.nupkg"),
- });
+ context.StartProcess(
+ "dotnet",
+ new ProcessSettings
+ {
+ Arguments = new ProcessArgumentBuilder()
+ .Append("nuget")
+ .Append("sign")
+ .AppendSwitchQuoted(
+ "--certificate-path",
+ param.Paths.Files.CodeSigningCertificateFilePath.FullPath
+ )
+ .AppendSwitchQuoted(
+ "--certificate-password",
+ param.CodeSigningCertificateCredentials.Password
+ )
+ .AppendSwitchQuoted("--timestamper", "http://ts.quovadisglobal.com/eu")
+ .Append(
+ $"{context.MakeAbsolute(param.Paths.Directories.NuGetDirectoryPath)}/**/*.nupkg"
+ ),
+ }
+ );
}
}
@@ -226,14 +279,19 @@ public sealed class PublishNuGetPackagesTask : FrostingTask
public override void Run(BuildContext context)
{
var param = context.Parameters;
- foreach (var package in context.GetFiles($"{param.Paths.Directories.NuGetDirectoryPath}/*.nupkg"))
+ foreach (
+ var package in context.GetFiles($"{param.Paths.Directories.NuGetDirectoryPath}/*.nupkg")
+ )
{
- context.DotNetNuGetPush(package.FullPath, new DotNetNuGetPushSettings
- {
- Source = param.NuGetCredentials.Source,
- ApiKey = param.NuGetCredentials.ApiKey,
- SkipDuplicate = true,
- });
+ context.DotNetNuGetPush(
+ package.FullPath,
+ new DotNetNuGetPushSettings
+ {
+ Source = param.NuGetCredentials.Source,
+ ApiKey = param.NuGetCredentials.ApiKey,
+ SkipDuplicate = true,
+ }
+ );
}
}
}
@@ -241,6 +299,7 @@ public override void Run(BuildContext context)
[TaskName("Default")]
[IsDependentOn(typeof(CleanTask))]
[IsDependentOn(typeof(RestoreNuGetPackagesTask))]
+[IsDependentOn(typeof(FormatTask))]
[IsDependentOn(typeof(BuildTask))]
[IsDependentOn(typeof(TestsTask))]
public sealed class DefaultTask : FrostingTask;
@@ -249,6 +308,7 @@ public sealed class DefaultTask : FrostingTask;
[IsDependentOn(typeof(CleanTask))]
[IsDependentOn(typeof(RestoreNuGetPackagesTask))]
[IsDependentOn(typeof(SonarBeginTask))]
+[IsDependentOn(typeof(FormatTask))]
[IsDependentOn(typeof(BuildTask))]
[IsDependentOn(typeof(TestsTask))]
[IsDependentOn(typeof(SonarEndTask))]
@@ -258,4 +318,4 @@ public sealed class SonarTask : FrostingTask;
[IsDependentOn(typeof(CreateNuGetPackagesTask))]
[IsDependentOn(typeof(SignNuGetPackagesTask))]
[IsDependentOn(typeof(PublishNuGetPackagesTask))]
-public sealed class PublishTask : FrostingTask;
\ No newline at end of file
+public sealed class PublishTask : FrostingTask;
diff --git a/build/Usings.cs b/build/Usings.cs
index a2cde15ca..c787c8fb1 100644
--- a/build/Usings.cs
+++ b/build/Usings.cs
@@ -17,4 +17,4 @@
global using Cake.Core.IO;
global using Cake.Frosting;
global using Cake.Git;
-global using Cake.Sonar;
\ No newline at end of file
+global using Cake.Sonar;
diff --git a/build/Version.cs b/build/Version.cs
index 753bc3799..1eac86538 100644
--- a/build/Version.cs
+++ b/build/Version.cs
@@ -2,9 +2,7 @@ namespace Testcontainers.Build;
internal sealed class BuildInformation
{
- private BuildInformation()
- {
- }
+ private BuildInformation() { }
public string Sha { get; private set; }
public string Branch { get; private set; }
@@ -27,7 +25,10 @@ public static BuildInformation Instance(ICakeContext context, string propertiesF
var publishNuGetPackage = context.EnvironmentVariable("PUBLISH_NUGET_PACKAGE");
- var version = context.XmlPeek(propertiesFilePath, "/Project/PropertyGroup[1]/Version/text()");
+ var version = context.XmlPeek(
+ propertiesFilePath,
+ "/Project/PropertyGroup[1]/Version/text()"
+ );
var git = context.GitBranchCurrent(".");
@@ -51,11 +52,17 @@ public static BuildInformation Instance(ICakeContext context, string propertiesF
{
branch = environment.Workflow.RefName;
isPullRequest = environment.PullRequest.IsPullRequest;
- isFork = "fork".Equals(environment.Workflow.EventName, StringComparison.OrdinalIgnoreCase);
+ isFork = "fork".Equals(
+ environment.Workflow.EventName,
+ StringComparison.OrdinalIgnoreCase
+ );
buildId = environment.Workflow.RunId;
// Set build system environment variables and parameters.
- buildSystem.GitHubActions.Commands.SetEnvironmentVariable("semVer", version.Substring(0, 5));
+ buildSystem.GitHubActions.Commands.SetEnvironmentVariable(
+ "semVer",
+ version.Substring(0, 5)
+ );
}
if (isPullRequest)
@@ -67,11 +74,18 @@ public static BuildInformation Instance(ICakeContext context, string propertiesF
var isReleaseBuild = GetIsReleaseBuild(branch);
- var shouldPublish = GetShouldPublish(branch) && ("1".Equals(publishNuGetPackage, StringComparison.Ordinal) || (bool.TryParse(publishNuGetPackage, out var result) && result));
+ var shouldPublish =
+ GetShouldPublish(branch)
+ && (
+ "1".Equals(publishNuGetPackage, StringComparison.Ordinal)
+ || (bool.TryParse(publishNuGetPackage, out var result) && result)
+ );
if (isFork && isPullRequest && shouldPublish)
{
- throw new ArgumentException("Use 'feature/' or 'bugfix/' prefix for pull request branches.");
+ throw new ArgumentException(
+ "Use 'feature/' or 'bugfix/' prefix for pull request branches."
+ );
}
if (!isReleaseBuild)
@@ -110,4 +124,4 @@ private static bool GetShouldPublish(string branch)
var branches = new[] { "main", "develop" };
return branches.Any(b => StringComparer.OrdinalIgnoreCase.Equals(b, branch));
}
-}
\ No newline at end of file
+}
diff --git a/examples/Flyway/Directory.Build.props b/examples/Flyway/Directory.Build.props
index 1bf52aaea..088a103d1 100644
--- a/examples/Flyway/Directory.Build.props
+++ b/examples/Flyway/Directory.Build.props
@@ -1,25 +1,25 @@
-
- 0.1.0
- $(AssemblyName)
- $(Version)
- $(Version)
- $(Version)
- en-US
- Andre Hofmeister
-
-
-
-
-
-
-
- git
- https://github.com/testcontainers/testcontainers-dotnet-sample
-
-
- 10.0
- enable
-
-
\ No newline at end of file
+
+ 0.1.0
+ $(AssemblyName)
+ $(Version)
+ $(Version)
+ $(Version)
+ en-US
+ Andre Hofmeister
+
+
+
+
+
+
+
+ git
+ https://github.com/testcontainers/testcontainers-dotnet-sample
+
+
+ 10.0
+ enable
+
+
diff --git a/examples/Flyway/Directory.Packages.props b/examples/Flyway/Directory.Packages.props
index 07fab9a1f..befe7cb2f 100644
--- a/examples/Flyway/Directory.Packages.props
+++ b/examples/Flyway/Directory.Packages.props
@@ -1,15 +1,15 @@
-
- true
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Flyway/tests/Flyway.Tests/DbFixture.cs b/examples/Flyway/tests/Flyway.Tests/DbFixture.cs
index 7359c0350..40f2a5e9c 100644
--- a/examples/Flyway/tests/Flyway.Tests/DbFixture.cs
+++ b/examples/Flyway/tests/Flyway.Tests/DbFixture.cs
@@ -40,11 +40,14 @@ public DbFixture()
.WithCommand("migrate")
.WithNetwork(_network)
.DependsOn(_postgreSqlContainer)
- .WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new MigrationCompleted()))
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().AddCustomWaitStrategy(new MigrationCompleted())
+ )
.Build();
}
- public DbConnection DbConnection => new NpgsqlConnection(((PostgreSqlContainer)_postgreSqlContainer).GetConnectionString());
+ public DbConnection DbConnection =>
+ new NpgsqlConnection(((PostgreSqlContainer)_postgreSqlContainer).GetConnectionString());
public Task InitializeAsync()
{
@@ -71,4 +74,4 @@ public Task UntilAsync(IContainer container)
return Task.FromResult(TestcontainersStates.Exited.Equals(container.State));
}
}
-}
\ No newline at end of file
+}
diff --git a/examples/Flyway/tests/Flyway.Tests/Flyway.Tests.csproj b/examples/Flyway/tests/Flyway.Tests/Flyway.Tests.csproj
index 479e035aa..15d3b1213 100644
--- a/examples/Flyway/tests/Flyway.Tests/Flyway.Tests.csproj
+++ b/examples/Flyway/tests/Flyway.Tests/Flyway.Tests.csproj
@@ -1,16 +1,20 @@
-
- net8.0
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Flyway/tests/Flyway.Tests/FlywayTest.cs b/examples/Flyway/tests/Flyway.Tests/FlywayTest.cs
index 5aa7804bb..3de679f7e 100644
--- a/examples/Flyway/tests/Flyway.Tests/FlywayTest.cs
+++ b/examples/Flyway/tests/Flyway.Tests/FlywayTest.cs
@@ -31,4 +31,4 @@ public void UsersTableContainsJohnDoe()
Assert.Equal("john@example.com", dataReader.GetString(1));
Assert.Equal(30, dataReader.GetInt32(2));
}
-}
\ No newline at end of file
+}
diff --git a/examples/Flyway/tests/Flyway.Tests/Usings.cs b/examples/Flyway/tests/Flyway.Tests/Usings.cs
index 557c05167..5400dae86 100644
--- a/examples/Flyway/tests/Flyway.Tests/Usings.cs
+++ b/examples/Flyway/tests/Flyway.Tests/Usings.cs
@@ -8,4 +8,4 @@
global using JetBrains.Annotations;
global using Npgsql;
global using Testcontainers.PostgreSql;
-global using Xunit;
\ No newline at end of file
+global using Xunit;
diff --git a/examples/Respawn/Directory.Build.props b/examples/Respawn/Directory.Build.props
index 1bf52aaea..088a103d1 100644
--- a/examples/Respawn/Directory.Build.props
+++ b/examples/Respawn/Directory.Build.props
@@ -1,25 +1,25 @@
-
- 0.1.0
- $(AssemblyName)
- $(Version)
- $(Version)
- $(Version)
- en-US
- Andre Hofmeister
-
-
-
-
-
-
-
- git
- https://github.com/testcontainers/testcontainers-dotnet-sample
-
-
- 10.0
- enable
-
-
\ No newline at end of file
+
+ 0.1.0
+ $(AssemblyName)
+ $(Version)
+ $(Version)
+ $(Version)
+ en-US
+ Andre Hofmeister
+
+
+
+
+
+
+
+ git
+ https://github.com/testcontainers/testcontainers-dotnet-sample
+
+
+ 10.0
+ enable
+
+
diff --git a/examples/Respawn/Directory.Packages.props b/examples/Respawn/Directory.Packages.props
index df90779b6..511adf9f8 100644
--- a/examples/Respawn/Directory.Packages.props
+++ b/examples/Respawn/Directory.Packages.props
@@ -1,16 +1,16 @@
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Respawn/tests/Respawn.Tests/DbFixture.cs b/examples/Respawn/tests/Respawn.Tests/DbFixture.cs
index f381a6129..96acfadb1 100644
--- a/examples/Respawn/tests/Respawn.Tests/DbFixture.cs
+++ b/examples/Respawn/tests/Respawn.Tests/DbFixture.cs
@@ -16,7 +16,8 @@ public DbFixture()
.Build();
}
- public DbConnection DbConnection => new NpgsqlConnection(((PostgreSqlContainer)_postgreSqlContainer).GetConnectionString());
+ public DbConnection DbConnection =>
+ new NpgsqlConnection(((PostgreSqlContainer)_postgreSqlContainer).GetConnectionString());
public Task InitializeAsync()
{
@@ -27,4 +28,4 @@ public Task DisposeAsync()
{
return _postgreSqlContainer.DisposeAsync().AsTask();
}
-}
\ No newline at end of file
+}
diff --git a/examples/Respawn/tests/Respawn.Tests/Respawn.Tests.csproj b/examples/Respawn/tests/Respawn.Tests/Respawn.Tests.csproj
index ca9da0248..9205cb799 100644
--- a/examples/Respawn/tests/Respawn.Tests/Respawn.Tests.csproj
+++ b/examples/Respawn/tests/Respawn.Tests/Respawn.Tests.csproj
@@ -1,17 +1,21 @@
-
- net8.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Respawn/tests/Respawn.Tests/RespawnTest.cs b/examples/Respawn/tests/Respawn.Tests/RespawnTest.cs
index ca3a417a1..7ad6ad994 100644
--- a/examples/Respawn/tests/Respawn.Tests/RespawnTest.cs
+++ b/examples/Respawn/tests/Respawn.Tests/RespawnTest.cs
@@ -28,8 +28,8 @@ public async Task UsersTableContainsOneUser(string username, string email, int a
var respawner = await Respawner.CreateAsync(_dbConnection, respawnerOptions);
await respawner.ResetAsync(_dbConnection);
- // This test runs twice and inserts a record into the `users` table for each run.
- // The test counts the number of users and expects it to always be 1. If the database
+ // This test runs twice and inserts a record into the `users` table for each run.
+ // The test counts the number of users and expects it to always be 1. If the database
// state is not clean, the assertion fails.
using var insertCommand = _dbConnection.CreateCommand();
@@ -45,7 +45,8 @@ public async Task UsersTableContainsOneUser(string username, string email, int a
dbParamAge.ParameterName = "@age";
dbParamAge.Value = age;
- insertCommand.CommandText = "INSERT INTO users (username, email, age) VALUES (@username, @email, @age)";
+ insertCommand.CommandText =
+ "INSERT INTO users (username, email, age) VALUES (@username, @email, @age)";
insertCommand.Parameters.Add(dbParamUsername);
insertCommand.Parameters.Add(dbParamEmail);
insertCommand.Parameters.Add(dbParamAge);
@@ -57,4 +58,4 @@ public async Task UsersTableContainsOneUser(string username, string email, int a
Assert.Equal(1, userCount);
}
-}
\ No newline at end of file
+}
diff --git a/examples/Respawn/tests/Respawn.Tests/Usings.cs b/examples/Respawn/tests/Respawn.Tests/Usings.cs
index a6f03e666..193b23871 100644
--- a/examples/Respawn/tests/Respawn.Tests/Usings.cs
+++ b/examples/Respawn/tests/Respawn.Tests/Usings.cs
@@ -6,4 +6,4 @@
global using JetBrains.Annotations;
global using Npgsql;
global using Testcontainers.PostgreSql;
-global using Xunit;
\ No newline at end of file
+global using Xunit;
diff --git a/examples/WeatherForecast/Directory.Packages.props b/examples/WeatherForecast/Directory.Packages.props
index 9521eb455..df4f4cfa6 100644
--- a/examples/WeatherForecast/Directory.Packages.props
+++ b/examples/WeatherForecast/Directory.Packages.props
@@ -4,17 +4,17 @@
true
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
diff --git a/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataContext.cs b/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataContext.cs
index 8a58a4a76..b097420c9 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataContext.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataContext.cs
@@ -3,9 +3,8 @@ namespace WeatherForecast.Contexts;
[PublicAPI]
public sealed class WeatherDataContext : DbContext
{
- public WeatherDataContext(DbContextOptions options) : base(options)
- {
- }
+ public WeatherDataContext(DbContextOptions options)
+ : base(options) { }
public DbSet WeatherData { get; set; } = null!;
@@ -19,10 +18,26 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity().Property(temperature => temperature.UnitSymbol);
modelBuilder.Entity().Property(temperature => temperature.Value);
modelBuilder.Entity().Property(temperature => temperature.Measured);
- modelBuilder.Entity().HasMany(weatherData => weatherData.Temperatures).WithOne().HasForeignKey(temperature => temperature.BelongsTo);
+ modelBuilder
+ .Entity()
+ .HasMany(weatherData => weatherData.Temperatures)
+ .WithOne()
+ .HasForeignKey(temperature => temperature.BelongsTo);
- var weatherDataSeed = Enumerable.Range(0, 30).Select(_ => Guid.NewGuid()).Select((id, day) => new WeatherData(id, DateTimeOffset.Now.AddDays(day))).ToList();
- var temperatureSeed = weatherDataSeed.SelectMany(data => Enumerable.Range(0, 23).Select(hour => Temperature.Celsius(data.Id, Random.Shared.Next(-10, 30), data.Period.AddHours(hour)))).ToList();
+ var weatherDataSeed = Enumerable
+ .Range(0, 30)
+ .Select(_ => Guid.NewGuid())
+ .Select((id, day) => new WeatherData(id, DateTimeOffset.Now.AddDays(day)))
+ .ToList();
+ var temperatureSeed = weatherDataSeed
+ .SelectMany(data =>
+ Enumerable
+ .Range(0, 23)
+ .Select(hour =>
+ Temperature.Celsius(data.Id, Random.Shared.Next(-10, 30), data.Period.AddHours(hour))
+ )
+ )
+ .ToList();
modelBuilder.Entity().HasData(temperatureSeed);
modelBuilder.Entity().HasData(weatherDataSeed);
diff --git a/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataReadOnlyContext.cs b/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataReadOnlyContext.cs
index e9f1846e4..9c89a3814 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataReadOnlyContext.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataReadOnlyContext.cs
@@ -16,9 +16,19 @@ public Task> GetAllAsync()
throw new NotImplementedException();
}
- public Task> GetAllAsync(string latitude, string longitude, DateTime from, DateTime to)
+ public Task> GetAllAsync(
+ string latitude,
+ string longitude,
+ DateTime from,
+ DateTime to
+ )
{
- return Task.FromResult>(_context.WeatherData.Include(property => property.Temperatures).OrderBy(weatherData => weatherData.Period).Take(to.Subtract(from).Days));
+ return Task.FromResult>(
+ _context
+ .WeatherData.Include(property => property.Temperatures)
+ .OrderBy(weatherData => weatherData.Period)
+ .Take(to.Subtract(from).Days)
+ );
}
public Task GetAsync(Guid id)
diff --git a/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherForecast.Contexts.csproj b/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherForecast.Contexts.csproj
index 032e31cec..7cad7fa91 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherForecast.Contexts.csproj
+++ b/examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherForecast.Contexts.csproj
@@ -3,10 +3,14 @@
net8.0
-
-
+
+
-
+
diff --git a/examples/WeatherForecast/src/WeatherForecast.Entities/Temperature.cs b/examples/WeatherForecast/src/WeatherForecast.Entities/Temperature.cs
index 4c37b5bc5..037405cb1 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Entities/Temperature.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Entities/Temperature.cs
@@ -4,7 +4,15 @@ namespace WeatherForecast.Entities;
public sealed class Temperature : HasId
{
[JsonConstructor]
- public Temperature(Guid id, Guid belongsTo, string unitName, string unitSymbol, double value, DateTimeOffset measured) : base(id)
+ public Temperature(
+ Guid id,
+ Guid belongsTo,
+ string unitName,
+ string unitSymbol,
+ double value,
+ DateTimeOffset measured
+ )
+ : base(id)
{
BelongsTo = belongsTo;
UnitName = unitName;
diff --git a/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherData.cs b/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherData.cs
index ca13c0511..411dc42a3 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherData.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherData.cs
@@ -3,17 +3,25 @@ namespace WeatherForecast.Entities;
[PublicAPI]
public sealed class WeatherData : HasId
{
- public WeatherData(Guid id, DateTimeOffset period) : this(id, period, new List())
+ public WeatherData(Guid id, DateTimeOffset period)
+ : this(id, period, new List())
{
// Entity Framework constructor.
}
[JsonConstructor]
- public WeatherData(Guid id, DateTimeOffset period, IList temperatures) : base(id)
+ public WeatherData(Guid id, DateTimeOffset period, IList temperatures)
+ : base(id)
{
Period = period;
- Minimum = temperatures.OrderBy(temperature => temperature.Value).DefaultIfEmpty(Temperature.AbsoluteZero).First();
- Maximum = temperatures.OrderBy(temperature => temperature.Value).DefaultIfEmpty(Temperature.AbsoluteZero).Last();
+ Minimum = temperatures
+ .OrderBy(temperature => temperature.Value)
+ .DefaultIfEmpty(Temperature.AbsoluteZero)
+ .First();
+ Maximum = temperatures
+ .OrderBy(temperature => temperature.Value)
+ .DefaultIfEmpty(Temperature.AbsoluteZero)
+ .Last();
Temperatures = temperatures;
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherForecast.Entities.csproj b/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherForecast.Entities.csproj
index e9a4c1a1d..c6bfb2042 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherForecast.Entities.csproj
+++ b/examples/WeatherForecast/src/WeatherForecast.Entities/WeatherForecast.Entities.csproj
@@ -3,6 +3,10 @@
net8.0
-
+
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/Error.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/Error.cs
index fe38e7670..7a6e65601 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/Error.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/Error.cs
@@ -3,6 +3,5 @@ namespace WeatherForecast.Interactors;
[PublicAPI]
public sealed class Error
{
- public string LocalizedDescription { get; }
- = string.Empty;
+ public string LocalizedDescription { get; } = string.Empty;
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure.cs
index 43c4bdcba..91b7bcc84 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure.cs
@@ -4,7 +4,5 @@ namespace WeatherForecast.Interactors;
public sealed class Failure : ResultInfo
{
public Failure()
- : base(StatusCode.Failure, new Error())
- {
- }
+ : base(StatusCode.Failure, new Error()) { }
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure`1.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure`1.cs
index 7626a60ad..7c4ff4a23 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure`1.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/Failure`1.cs
@@ -4,7 +4,5 @@ namespace WeatherForecast.Interactors;
public sealed class Failure : ResultInfo
{
public Failure(TValue value)
- : base(StatusCode.Failure, new Error(), value)
- {
- }
+ : base(StatusCode.Failure, new Error(), value) { }
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/ISearchCityOrZipCode.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/ISearchCityOrZipCode.cs
index d0e0a7654..df9108ac1 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/ISearchCityOrZipCode.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/ISearchCityOrZipCode.cs
@@ -1,6 +1,6 @@
namespace WeatherForecast.Interactors.SearchCityOrZipCode;
[PublicAPI]
-public interface ISearchCityOrZipCode : ICommand, INotifyInteractorResult>>
-{
-}
+public interface ISearchCityOrZipCode
+ : ICommand,
+ INotifyInteractorResult>> { }
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/SearchCityOrZipCode.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/SearchCityOrZipCode.cs
index a0ca602e6..31f16285a 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/SearchCityOrZipCode.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/SearchCityOrZipCode.cs
@@ -7,7 +7,10 @@ public sealed class SearchCityOrZipCode : ISearchCityOrZipCode
private readonly IWeatherDataWriteOnlyRepository _writeOnlyRepository;
- public SearchCityOrZipCode(IWeatherDataReadOnlyRepository readOnlyRepository, IWeatherDataWriteOnlyRepository writeOnlyRepository)
+ public SearchCityOrZipCode(
+ IWeatherDataReadOnlyRepository readOnlyRepository,
+ IWeatherDataWriteOnlyRepository writeOnlyRepository
+ )
{
_readOnlyRepository = readOnlyRepository;
_writeOnlyRepository = writeOnlyRepository;
@@ -21,7 +24,8 @@ public async Task ExecuteAsync(string cityOrZipCode)
try
{
- var weatherData = await _readOnlyRepository.GetAllAsync(string.Empty, string.Empty, DateTime.Today, DateTime.Today.AddDays(7))
+ var weatherData = await _readOnlyRepository
+ .GetAllAsync(string.Empty, string.Empty, DateTime.Today, DateTime.Today.AddDays(7))
.ConfigureAwait(false);
result = new Success>(weatherData);
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/StatusCode.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/StatusCode.cs
index b7913eddb..81078d8b8 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/StatusCode.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/StatusCode.cs
@@ -5,5 +5,5 @@ public enum StatusCode
{
Success,
- Failure
+ Failure,
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/Success.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/Success.cs
index f31df667e..e877ffc6a 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/Success.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/Success.cs
@@ -4,7 +4,5 @@ namespace WeatherForecast.Interactors;
public sealed class Success : ResultInfo
{
public Success()
- : base(StatusCode.Success, new Error())
- {
- }
+ : base(StatusCode.Success, new Error()) { }
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/Success`1.cs b/examples/WeatherForecast/src/WeatherForecast.Interactors/Success`1.cs
index dee5f3e13..2fb80313e 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/Success`1.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/Success`1.cs
@@ -4,7 +4,5 @@ namespace WeatherForecast.Interactors;
public sealed class Success : ResultInfo
{
public Success(TValue value)
- : base(StatusCode.Success, new Error(), value)
- {
- }
+ : base(StatusCode.Success, new Error(), value) { }
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Interactors/WeatherForecast.Interactors.csproj b/examples/WeatherForecast/src/WeatherForecast.Interactors/WeatherForecast.Interactors.csproj
index 49925d9b5..a25a7fcfc 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Interactors/WeatherForecast.Interactors.csproj
+++ b/examples/WeatherForecast/src/WeatherForecast.Interactors/WeatherForecast.Interactors.csproj
@@ -3,10 +3,14 @@
net8.0
-
+
-
-
+
+
diff --git a/examples/WeatherForecast/src/WeatherForecast.Repositories/IWeatherDataReadOnlyRepository.cs b/examples/WeatherForecast/src/WeatherForecast.Repositories/IWeatherDataReadOnlyRepository.cs
index 4cda8f47a..635ba39cd 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Repositories/IWeatherDataReadOnlyRepository.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Repositories/IWeatherDataReadOnlyRepository.cs
@@ -5,7 +5,12 @@ public interface IWeatherDataReadOnlyRepository
{
Task> GetAllAsync();
- Task> GetAllAsync(string latitude, string longitude, DateTime from, DateTime to);
+ Task> GetAllAsync(
+ string latitude,
+ string longitude,
+ DateTime from,
+ DateTime to
+ );
Task GetAsync(Guid id);
}
diff --git a/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherDataReadOnlyRepository.cs b/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherDataReadOnlyRepository.cs
index 2319bf2ed..221dd8a62 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherDataReadOnlyRepository.cs
+++ b/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherDataReadOnlyRepository.cs
@@ -8,9 +8,35 @@ public Task> GetAllAsync()
throw new NotImplementedException();
}
- public Task> GetAllAsync(string latitude, string longitude, DateTime from, DateTime to)
+ public Task> GetAllAsync(
+ string latitude,
+ string longitude,
+ DateTime from,
+ DateTime to
+ )
{
- return Task.FromResult(Enumerable.Range(0, to.Subtract(from).Days).Select(_ => Guid.NewGuid()).Select((id, day) => new WeatherData(id, DateTime.Today.AddDays(day), Enumerable.Range(0, 23).Select(hour => Temperature.Celsius(id, StaticRandom.Next(-10, 30), DateTime.Today.AddDays(day).AddHours(hour))).ToList())));
+ return Task.FromResult(
+ Enumerable
+ .Range(0, to.Subtract(from).Days)
+ .Select(_ => Guid.NewGuid())
+ .Select(
+ (id, day) =>
+ new WeatherData(
+ id,
+ DateTime.Today.AddDays(day),
+ Enumerable
+ .Range(0, 23)
+ .Select(hour =>
+ Temperature.Celsius(
+ id,
+ StaticRandom.Next(-10, 30),
+ DateTime.Today.AddDays(day).AddHours(hour)
+ )
+ )
+ .ToList()
+ )
+ )
+ );
}
public Task GetAsync(Guid id)
diff --git a/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherForecast.Repositories.csproj b/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherForecast.Repositories.csproj
index 2ece4da82..3b0c46c49 100644
--- a/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherForecast.Repositories.csproj
+++ b/examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherForecast.Repositories.csproj
@@ -3,9 +3,13 @@
net8.0
-
+
-
+
diff --git a/examples/WeatherForecast/src/WeatherForecast/Controllers/WeatherForecastController.cs b/examples/WeatherForecast/src/WeatherForecast/Controllers/WeatherForecastController.cs
index 7d31e6543..a7cffe37d 100644
--- a/examples/WeatherForecast/src/WeatherForecast/Controllers/WeatherForecastController.cs
+++ b/examples/WeatherForecast/src/WeatherForecast/Controllers/WeatherForecastController.cs
@@ -26,16 +26,17 @@ public void Dispose()
[HttpGet]
public async Task>> GetWeatherForecast()
{
- await _searchCityOrZipCode.ExecuteAsync(string.Empty)
- .ConfigureAwait(false);
+ await _searchCityOrZipCode.ExecuteAsync(string.Empty).ConfigureAwait(false);
- await _wait.WaitAsync()
- .ConfigureAwait(false);
+ await _wait.WaitAsync().ConfigureAwait(false);
return Ok(_weatherData);
}
- private void SearchCityOrZipCodeResultPublished(object? sender, ResultInfo> result)
+ private void SearchCityOrZipCodeResultPublished(
+ object? sender,
+ ResultInfo> result
+ )
{
if (result.IsSuccessful)
{
diff --git a/examples/WeatherForecast/src/WeatherForecast/Program.cs b/examples/WeatherForecast/src/WeatherForecast/Program.cs
index 2f09b2989..a227ff5e3 100644
--- a/examples/WeatherForecast/src/WeatherForecast/Program.cs
+++ b/examples/WeatherForecast/src/WeatherForecast/Program.cs
@@ -11,16 +11,20 @@
// The application configuration does not include a database connection string, use Testcontainers for .NET to create, start and seed the dependent database.
builder.Services.AddSingleton();
builder.Services.AddHostedService(services => services.GetRequiredService());
- builder.Services.AddDbContext((services, options) =>
- {
- var databaseContainer = services.GetRequiredService();
- options.UseNpgsql(databaseContainer.GetConnectionString());
- });
+ builder.Services.AddDbContext(
+ (services, options) =>
+ {
+ var databaseContainer = services.GetRequiredService();
+ options.UseNpgsql(databaseContainer.GetConnectionString());
+ }
+ );
}
else
{
// The application configuration includes a database connection string, use it to establish a connection and seed the database.
- builder.Services.AddDbContext((_, options) => options.UseNpgsql(postgreSqlConnectionString));
+ builder.Services.AddDbContext(
+ (_, options) => options.UseNpgsql(postgreSqlConnectionString)
+ );
}
builder.Services.AddScoped();
@@ -41,7 +45,5 @@
namespace WeatherForecast
{
- public sealed class Program
- {
- }
+ public sealed class Program { }
}
diff --git a/examples/WeatherForecast/src/WeatherForecast/WeatherForecast.csproj b/examples/WeatherForecast/src/WeatherForecast/WeatherForecast.csproj
index 01cbc5b4d..6cff44049 100644
--- a/examples/WeatherForecast/src/WeatherForecast/WeatherForecast.csproj
+++ b/examples/WeatherForecast/src/WeatherForecast/WeatherForecast.csproj
@@ -3,18 +3,18 @@
net8.0
-
-
-
+
+
+
-
-
-
+
+
+
-
+
diff --git a/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecast.InProcess.Tests.csproj b/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecast.InProcess.Tests.csproj
index 167892fe1..aa08774fd 100644
--- a/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecast.InProcess.Tests.csproj
+++ b/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecast.InProcess.Tests.csproj
@@ -3,13 +3,17 @@
net8.0
-
-
-
-
-
+
+
+
+
+
-
+
diff --git a/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs b/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs
index d41a4c80c..8b996ce80 100644
--- a/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs
+++ b/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs
@@ -40,13 +40,12 @@ public async Task Get_WeatherForecast_ReturnsSevenDays()
using var httpClient = CreateClient();
// When
- var response = await httpClient.GetAsync(path)
- .ConfigureAwait(true);
+ var response = await httpClient.GetAsync(path).ConfigureAwait(true);
- var weatherForecastStream = await response.Content.ReadAsStreamAsync()
- .ConfigureAwait(true);
+ var weatherForecastStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(true);
- var weatherForecast = await JsonSerializer.DeserializeAsync>(weatherForecastStream)
+ var weatherForecast = await JsonSerializer
+ .DeserializeAsync>(weatherForecastStream)
.ConfigureAwait(true);
// Then
@@ -63,10 +62,12 @@ public async Task Get_WeatherForecast_ReturnsThreeDays()
using var serviceScope = Services.CreateScope();
- var weatherDataReadOnlyRepository = serviceScope.ServiceProvider.GetRequiredService();
+ var weatherDataReadOnlyRepository =
+ serviceScope.ServiceProvider.GetRequiredService();
// When
- var weatherForecast = await weatherDataReadOnlyRepository.GetAllAsync(string.Empty, string.Empty, DateTime.Today, DateTime.Today.AddDays(threeDays))
+ var weatherForecast = await weatherDataReadOnlyRepository
+ .GetAllAsync(string.Empty, string.Empty, DateTime.Today, DateTime.Today.AddDays(threeDays))
.ConfigureAwait(true);
// Then
diff --git a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecast.Tests.csproj b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecast.Tests.csproj
index 1c824cbb5..8713db8b4 100644
--- a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecast.Tests.csproj
+++ b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecast.Tests.csproj
@@ -3,14 +3,18 @@
net8.0
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs
index 613693737..fa09e2833 100644
--- a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs
+++ b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs
@@ -3,7 +3,10 @@ namespace WeatherForecast.Tests;
[UsedImplicitly]
public sealed class WeatherForecastContainer : HttpClient, IAsyncLifetime
{
- private static readonly X509Certificate Certificate = new X509Certificate2(WeatherForecastImage.CertificateFilePath, WeatherForecastImage.CertificatePassword);
+ private static readonly X509Certificate Certificate = new X509Certificate2(
+ WeatherForecastImage.CertificateFilePath,
+ WeatherForecastImage.CertificatePassword
+ );
private static readonly WeatherForecastImage Image = new WeatherForecastImage();
@@ -14,18 +17,21 @@ public sealed class WeatherForecastContainer : HttpClient, IAsyncLifetime
private readonly IContainer _weatherForecastContainer;
public WeatherForecastContainer()
- : base(new HttpClientHandler
- {
- // Trust the development certificate.
- ServerCertificateCustomValidationCallback = (_, certificate, _, _) => Certificate.Equals(certificate)
- })
+ : base(
+ new HttpClientHandler
+ {
+ // Trust the development certificate.
+ ServerCertificateCustomValidationCallback = (_, certificate, _, _) =>
+ Certificate.Equals(certificate),
+ }
+ )
{
const string weatherForecastStorage = "weatherForecastStorage";
- const string postgreSqlConnectionString = $"Host={weatherForecastStorage};Username={PostgreSqlBuilder.DefaultUsername};Password={PostgreSqlBuilder.DefaultPassword};Database={PostgreSqlBuilder.DefaultDatabase}";
+ const string postgreSqlConnectionString =
+ $"Host={weatherForecastStorage};Username={PostgreSqlBuilder.DefaultUsername};Password={PostgreSqlBuilder.DefaultPassword};Database={PostgreSqlBuilder.DefaultDatabase}";
- _weatherForecastNetwork = new NetworkBuilder()
- .Build();
+ _weatherForecastNetwork = new NetworkBuilder().Build();
_postgreSqlContainer = new PostgreSqlBuilder()
.WithNetwork(_weatherForecastNetwork)
@@ -37,49 +43,53 @@ public WeatherForecastContainer()
.WithNetwork(_weatherForecastNetwork)
.WithPortBinding(WeatherForecastImage.HttpsPort, true)
.WithEnvironment("ASPNETCORE_URLS", "https://+")
- .WithEnvironment("ASPNETCORE_Kestrel__Certificates__Default__Path", WeatherForecastImage.CertificateFilePath)
- .WithEnvironment("ASPNETCORE_Kestrel__Certificates__Default__Password", WeatherForecastImage.CertificatePassword)
+ .WithEnvironment(
+ "ASPNETCORE_Kestrel__Certificates__Default__Path",
+ WeatherForecastImage.CertificateFilePath
+ )
+ .WithEnvironment(
+ "ASPNETCORE_Kestrel__Certificates__Default__Password",
+ WeatherForecastImage.CertificatePassword
+ )
.WithEnvironment("ConnectionStrings__PostgreSQL", postgreSqlConnectionString)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(WeatherForecastImage.HttpsPort))
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilPortIsAvailable(WeatherForecastImage.HttpsPort)
+ )
.Build();
}
public async Task InitializeAsync()
{
- await Image.InitializeAsync()
- .ConfigureAwait(false);
+ await Image.InitializeAsync().ConfigureAwait(false);
- await _weatherForecastNetwork.CreateAsync()
- .ConfigureAwait(false);
+ await _weatherForecastNetwork.CreateAsync().ConfigureAwait(false);
- await _postgreSqlContainer.StartAsync()
- .ConfigureAwait(false);
+ await _postgreSqlContainer.StartAsync().ConfigureAwait(false);
- await _weatherForecastContainer.StartAsync()
- .ConfigureAwait(false);
+ await _weatherForecastContainer.StartAsync().ConfigureAwait(false);
}
public async Task DisposeAsync()
{
// It is not necessary to clean up resources immediately (still good practice). The Resource Reaper will take care of orphaned resources.
- await Image.DisposeAsync()
- .ConfigureAwait(false);
+ await Image.DisposeAsync().ConfigureAwait(false);
- await _weatherForecastContainer.DisposeAsync()
- .ConfigureAwait(false);
+ await _weatherForecastContainer.DisposeAsync().ConfigureAwait(false);
- await _postgreSqlContainer.DisposeAsync()
- .ConfigureAwait(false);
+ await _postgreSqlContainer.DisposeAsync().ConfigureAwait(false);
- await _weatherForecastNetwork.DeleteAsync()
- .ConfigureAwait(false);
+ await _weatherForecastNetwork.DeleteAsync().ConfigureAwait(false);
}
public void SetBaseAddress()
{
try
{
- var uriBuilder = new UriBuilder("https", _weatherForecastContainer.Hostname, _weatherForecastContainer.GetMappedPublicPort(WeatherForecastImage.HttpsPort));
+ var uriBuilder = new UriBuilder(
+ "https",
+ _weatherForecastContainer.Hostname,
+ _weatherForecastContainer.GetMappedPublicPort(WeatherForecastImage.HttpsPort)
+ );
BaseAddress = uriBuilder.Uri;
}
catch
diff --git a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs
index b2db3c98d..029bbab1f 100644
--- a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs
+++ b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs
@@ -11,7 +11,10 @@ public sealed class WeatherForecastImage : IImage, IAsyncLifetime
private readonly SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(1, 1);
- private readonly IImage _image = new DockerImage("localhost/testcontainers/weather-forecast", tag: DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString());
+ private readonly IImage _image = new DockerImage(
+ "localhost/testcontainers/weather-forecast",
+ tag: DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString()
+ );
public string Repository => _image.Repository;
@@ -25,8 +28,7 @@ public sealed class WeatherForecastImage : IImage, IAsyncLifetime
public async Task InitializeAsync()
{
- await _semaphoreSlim.WaitAsync()
- .ConfigureAwait(false);
+ await _semaphoreSlim.WaitAsync().ConfigureAwait(false);
try
{
@@ -34,7 +36,10 @@ await _semaphoreSlim.WaitAsync()
.WithName(this)
.WithDockerfileDirectory(CommonDirectoryPath.GetSolutionDirectory(), string.Empty)
.WithDockerfile("Dockerfile")
- .WithBuildArgument("RESOURCE_REAPER_SESSION_ID", ResourceReaper.DefaultSessionId.ToString("D")) // https://github.com/testcontainers/testcontainers-dotnet/issues/602.
+ .WithBuildArgument(
+ "RESOURCE_REAPER_SESSION_ID",
+ ResourceReaper.DefaultSessionId.ToString("D")
+ ) // https://github.com/testcontainers/testcontainers-dotnet/issues/602.
.WithDeleteIfExists(false)
.Build()
.CreateAsync()
diff --git a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastTest.cs b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastTest.cs
index 0910bcce1..82e704183 100644
--- a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastTest.cs
+++ b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastTest.cs
@@ -24,13 +24,12 @@ public async Task Get_WeatherForecast_ReturnsSevenDays()
const string path = "api/WeatherForecast";
// When
- var response = await _weatherForecastContainer.GetAsync(path)
- .ConfigureAwait(true);
+ var response = await _weatherForecastContainer.GetAsync(path).ConfigureAwait(true);
- var weatherForecastStream = await response.Content.ReadAsStreamAsync()
- .ConfigureAwait(true);
+ var weatherForecastStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(true);
- var weatherForecast = await JsonSerializer.DeserializeAsync>(weatherForecastStream)
+ var weatherForecast = await JsonSerializer
+ .DeserializeAsync>(weatherForecastStream)
.ConfigureAwait(true);
// Then
@@ -62,24 +61,46 @@ public Web(WeatherForecastContainer weatherForecastContainer)
public void Get_WeatherForecast_ReturnsSevenDays()
{
// Given
- string ScreenshotFileName() => $"{nameof(Get_WeatherForecast_ReturnsSevenDays)}_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}.png";
+ string ScreenshotFileName() =>
+ $"{nameof(Get_WeatherForecast_ReturnsSevenDays)}_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}.png";
using var chrome = new ChromeDriver(ChromeOptions);
// When
chrome.Navigate().GoToUrl(_weatherForecastContainer.BaseAddress);
- chrome.GetScreenshot().SaveAsFile(Path.Combine(CommonDirectoryPath.GetSolutionDirectory().DirectoryPath, ScreenshotFileName()));
+ chrome
+ .GetScreenshot()
+ .SaveAsFile(
+ Path.Combine(
+ CommonDirectoryPath.GetSolutionDirectory().DirectoryPath,
+ ScreenshotFileName()
+ )
+ );
chrome.FindElement(By.TagName("fluent-button")).Click();
var wait = new WebDriverWait(chrome, TimeSpan.FromSeconds(10));
wait.Until(webDriver => 1.Equals(webDriver.FindElements(By.TagName("span")).Count));
- chrome.GetScreenshot().SaveAsFile(Path.Combine(CommonDirectoryPath.GetSolutionDirectory().DirectoryPath, ScreenshotFileName()));
+ chrome
+ .GetScreenshot()
+ .SaveAsFile(
+ Path.Combine(
+ CommonDirectoryPath.GetSolutionDirectory().DirectoryPath,
+ ScreenshotFileName()
+ )
+ );
// Then
- Assert.Equal(7, int.Parse(chrome.FindElement(By.TagName("span")).Text, NumberStyles.Integer, CultureInfo.InvariantCulture));
+ Assert.Equal(
+ 7,
+ int.Parse(
+ chrome.FindElement(By.TagName("span")).Text,
+ NumberStyles.Integer,
+ CultureInfo.InvariantCulture
+ )
+ );
}
}
}
diff --git a/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameBuilder.cs b/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameBuilder.cs
index e0f4db0ee..1e8d2dbeb 100644
--- a/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameBuilder.cs
+++ b/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.ModuleName;
///
[PublicAPI]
-public sealed class ModuleNameBuilder : ContainerBuilder
+public sealed class ModuleNameBuilder
+ : ContainerBuilder
{
///
/// Initializes a new instance of the class.
@@ -67,20 +68,31 @@ public override ModuleNameContainer Build()
// }
///
- protected override ModuleNameBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ModuleNameBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new ModuleNameConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ModuleNameConfiguration(resourceConfiguration)
+ );
}
///
protected override ModuleNameBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new ModuleNameConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ModuleNameConfiguration(resourceConfiguration)
+ );
}
///
- protected override ModuleNameBuilder Merge(ModuleNameConfiguration oldValue, ModuleNameConfiguration newValue)
+ protected override ModuleNameBuilder Merge(
+ ModuleNameConfiguration oldValue,
+ ModuleNameConfiguration newValue
+ )
{
return new ModuleNameBuilder(new ModuleNameConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameConfiguration.cs b/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameConfiguration.cs
index 92afea8dc..4c818ec12 100644
--- a/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameConfiguration.cs
+++ b/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameConfiguration.cs
@@ -18,7 +18,9 @@ public ModuleNameConfiguration(object config = null)
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ModuleNameConfiguration(IResourceConfiguration resourceConfiguration)
+ public ModuleNameConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -49,7 +51,10 @@ public ModuleNameConfiguration(ModuleNameConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public ModuleNameConfiguration(ModuleNameConfiguration oldValue, ModuleNameConfiguration newValue)
+ public ModuleNameConfiguration(
+ ModuleNameConfiguration oldValue,
+ ModuleNameConfiguration newValue
+ )
: base(oldValue, newValue)
{
// // Create an updated immutable copy of the module configuration.
@@ -60,4 +65,4 @@ public ModuleNameConfiguration(ModuleNameConfiguration oldValue, ModuleNameConfi
// /// Gets the ModuleName config.
// ///
// public object Config { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameContainer.cs b/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameContainer.cs
index 4b2137d2a..30dcfabbe 100644
--- a/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameContainer.cs
+++ b/src/Templates/CSharp/Testcontainers.ModuleName/ModuleNameContainer.cs
@@ -9,7 +9,5 @@ public sealed class ModuleNameContainer : DockerContainer
///
/// The container configuration.
public ModuleNameContainer(ModuleNameConfiguration configuration)
- : base(configuration)
- {
- }
-}
\ No newline at end of file
+ : base(configuration) { }
+}
diff --git a/src/Templates/CSharp/Testcontainers.ModuleName/Testcontainers.ModuleName.csproj b/src/Templates/CSharp/Testcontainers.ModuleName/Testcontainers.ModuleName.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Templates/CSharp/Testcontainers.ModuleName/Testcontainers.ModuleName.csproj
+++ b/src/Templates/CSharp/Testcontainers.ModuleName/Testcontainers.ModuleName.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Templates/CSharp/Testcontainers.ModuleName/Usings.cs b/src/Templates/CSharp/Testcontainers.ModuleName/Usings.cs
index f889bad0a..3ef152398 100644
--- a/src/Templates/CSharp/Testcontainers.ModuleName/Usings.cs
+++ b/src/Templates/CSharp/Testcontainers.ModuleName/Usings.cs
@@ -7,4 +7,4 @@
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using JetBrains.Annotations;
-global using Microsoft.Extensions.Logging;
\ No newline at end of file
+global using Microsoft.Extensions.Logging;
diff --git a/src/Testcontainers.ActiveMq/ActiveMqConfiguration.cs b/src/Testcontainers.ActiveMq/ActiveMqConfiguration.cs
index 82d7ae292..3fcbd329c 100644
--- a/src/Testcontainers.ActiveMq/ActiveMqConfiguration.cs
+++ b/src/Testcontainers.ActiveMq/ActiveMqConfiguration.cs
@@ -9,9 +9,7 @@ public sealed class ActiveMqConfiguration : ContainerConfiguration
///
/// The ActiveMq username.
/// The ActiveMq password.
- public ActiveMqConfiguration(
- string username = null,
- string password = null)
+ public ActiveMqConfiguration(string username = null, string password = null)
{
Username = username;
Password = password;
@@ -21,7 +19,9 @@ public ActiveMqConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ActiveMqConfiguration(IResourceConfiguration resourceConfiguration)
+ public ActiveMqConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -68,4 +68,4 @@ public ActiveMqConfiguration(ActiveMqConfiguration oldValue, ActiveMqConfigurati
/// Gets the ActiveMq password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ActiveMq/ArtemisBuilder.cs b/src/Testcontainers.ActiveMq/ArtemisBuilder.cs
index afaa7e82f..2483b13c6 100644
--- a/src/Testcontainers.ActiveMq/ArtemisBuilder.cs
+++ b/src/Testcontainers.ActiveMq/ArtemisBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.ActiveMq;
///
[PublicAPI]
-public sealed class ArtemisBuilder : ContainerBuilder
+public sealed class ArtemisBuilder
+ : ContainerBuilder
{
public const string ArtemisImage = "apache/activemq-artemis:2.31.2";
@@ -82,17 +83,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override ArtemisBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ArtemisBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new ActiveMqConfiguration(resourceConfiguration));
}
@@ -104,8 +115,11 @@ protected override ArtemisBuilder Clone(IContainerConfiguration resourceConfigur
}
///
- protected override ArtemisBuilder Merge(ActiveMqConfiguration oldValue, ActiveMqConfiguration newValue)
+ protected override ArtemisBuilder Merge(
+ ActiveMqConfiguration oldValue,
+ ActiveMqConfiguration newValue
+ )
{
return new ArtemisBuilder(new ActiveMqConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ActiveMq/ArtemisContainer.cs b/src/Testcontainers.ActiveMq/ArtemisContainer.cs
index 29e96ac8b..ed1831375 100644
--- a/src/Testcontainers.ActiveMq/ArtemisContainer.cs
+++ b/src/Testcontainers.ActiveMq/ArtemisContainer.cs
@@ -22,9 +22,13 @@ public ArtemisContainer(ActiveMqConfiguration configuration)
/// The ActiveMq broker address.
public string GetBrokerAddress()
{
- var endpoint = new UriBuilder("tcp", Hostname, GetMappedPublicPort(ArtemisBuilder.ArtemisMainPort));
+ var endpoint = new UriBuilder(
+ "tcp",
+ Hostname,
+ GetMappedPublicPort(ArtemisBuilder.ArtemisMainPort)
+ );
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ActiveMq/Testcontainers.ActiveMq.csproj b/src/Testcontainers.ActiveMq/Testcontainers.ActiveMq.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.ActiveMq/Testcontainers.ActiveMq.csproj
+++ b/src/Testcontainers.ActiveMq/Testcontainers.ActiveMq.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.ActiveMq/Usings.cs b/src/Testcontainers.ActiveMq/Usings.cs
index 8e5c20fd5..f89f0c94d 100644
--- a/src/Testcontainers.ActiveMq/Usings.cs
+++ b/src/Testcontainers.ActiveMq/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.ArangoDb/ArangoDbBuilder.cs b/src/Testcontainers.ArangoDb/ArangoDbBuilder.cs
index 4ca7b499a..c4a3a008d 100644
--- a/src/Testcontainers.ArangoDb/ArangoDbBuilder.cs
+++ b/src/Testcontainers.ArangoDb/ArangoDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.ArangoDb;
///
[PublicAPI]
-public sealed class ArangoDbBuilder : ContainerBuilder
+public sealed class ArangoDbBuilder
+ : ContainerBuilder
{
public const string ArangoDbImage = "arangodb:3.11.5";
@@ -67,13 +68,19 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override ArangoDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ArangoDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new ArangoDbConfiguration(resourceConfiguration));
}
@@ -85,8 +92,11 @@ protected override ArangoDbBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override ArangoDbBuilder Merge(ArangoDbConfiguration oldValue, ArangoDbConfiguration newValue)
+ protected override ArangoDbBuilder Merge(
+ ArangoDbConfiguration oldValue,
+ ArangoDbConfiguration newValue
+ )
{
return new ArangoDbBuilder(new ArangoDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ArangoDb/ArangoDbConfiguration.cs b/src/Testcontainers.ArangoDb/ArangoDbConfiguration.cs
index aa71236e9..545809b9d 100644
--- a/src/Testcontainers.ArangoDb/ArangoDbConfiguration.cs
+++ b/src/Testcontainers.ArangoDb/ArangoDbConfiguration.cs
@@ -8,8 +8,7 @@ public sealed class ArangoDbConfiguration : ContainerConfiguration
/// Initializes a new instance of the class.
///
/// The ArangoDb password.
- public ArangoDbConfiguration(
- string password = null)
+ public ArangoDbConfiguration(string password = null)
{
Password = password;
}
@@ -18,7 +17,9 @@ public ArangoDbConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ArangoDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public ArangoDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -59,4 +60,4 @@ public ArangoDbConfiguration(ArangoDbConfiguration oldValue, ArangoDbConfigurati
/// Gets the ArangoDb password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ArangoDb/ArangoDbContainer.cs b/src/Testcontainers.ArangoDb/ArangoDbContainer.cs
index ae7986855..d7acb926c 100644
--- a/src/Testcontainers.ArangoDb/ArangoDbContainer.cs
+++ b/src/Testcontainers.ArangoDb/ArangoDbContainer.cs
@@ -9,9 +9,7 @@ public sealed class ArangoDbContainer : DockerContainer
///
/// The container configuration.
public ArangoDbContainer(ArangoDbConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the transport address.
@@ -19,6 +17,10 @@ public ArangoDbContainer(ArangoDbConfiguration configuration)
/// The transport address.
public string GetTransportAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(ArangoDbBuilder.ArangoDbPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(ArangoDbBuilder.ArangoDbPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ArangoDb/Testcontainers.ArangoDb.csproj b/src/Testcontainers.ArangoDb/Testcontainers.ArangoDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.ArangoDb/Testcontainers.ArangoDb.csproj
+++ b/src/Testcontainers.ArangoDb/Testcontainers.ArangoDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.ArangoDb/Usings.cs b/src/Testcontainers.ArangoDb/Usings.cs
index 8e5c20fd5..f89f0c94d 100644
--- a/src/Testcontainers.ArangoDb/Usings.cs
+++ b/src/Testcontainers.ArangoDb/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Azurite/AzuriteBuilder.cs b/src/Testcontainers.Azurite/AzuriteBuilder.cs
index d499791dd..1c79ea58a 100644
--- a/src/Testcontainers.Azurite/AzuriteBuilder.cs
+++ b/src/Testcontainers.Azurite/AzuriteBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Azurite;
///
[PublicAPI]
-public sealed class AzuriteBuilder : ContainerBuilder
+public sealed class AzuriteBuilder
+ : ContainerBuilder
{
public const string AzuriteImage = "mcr.microsoft.com/azure-storage/azurite:3.28.0";
@@ -14,7 +15,8 @@ public sealed class AzuriteBuilder : ContainerBuilder EnabledServices = new HashSet();
@@ -59,7 +61,11 @@ public AzuriteBuilder WithInMemoryPersistence(float? megabytes = null)
{
if (megabytes.HasValue)
{
- return WithCommand("--inMemoryPersistence", "--extentMemoryLimit", megabytes.ToString());
+ return WithCommand(
+ "--inMemoryPersistence",
+ "--extentMemoryLimit",
+ megabytes.ToString()
+ );
}
else
{
@@ -76,20 +82,29 @@ public override AzuriteContainer Build()
if (EnabledServices.Contains(AzuriteService.Blob))
{
- waitStrategy = waitStrategy.UntilMessageIsLogged("Blob service is successfully listening");
+ waitStrategy = waitStrategy.UntilMessageIsLogged(
+ "Blob service is successfully listening"
+ );
}
if (EnabledServices.Contains(AzuriteService.Queue))
{
- waitStrategy = waitStrategy.UntilMessageIsLogged("Queue service is successfully listening");
+ waitStrategy = waitStrategy.UntilMessageIsLogged(
+ "Queue service is successfully listening"
+ );
}
if (EnabledServices.Contains(AzuriteService.Table))
{
- waitStrategy = waitStrategy.UntilMessageIsLogged("Table service is successfully listening");
+ waitStrategy = waitStrategy.UntilMessageIsLogged(
+ "Table service is successfully listening"
+ );
}
- var azuriteBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(waitStrategy);
+ var azuriteBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(waitStrategy);
return new AzuriteContainer(azuriteBuilder.DockerResourceConfiguration);
}
@@ -102,11 +117,20 @@ protected override AzuriteBuilder Init()
.WithPortBinding(QueuePort, true)
.WithPortBinding(TablePort, true)
.WithEntrypoint("azurite")
- .WithCommand("--blobHost", "0.0.0.0", "--queueHost", "0.0.0.0", "--tableHost", "0.0.0.0");
+ .WithCommand(
+ "--blobHost",
+ "0.0.0.0",
+ "--queueHost",
+ "0.0.0.0",
+ "--tableHost",
+ "0.0.0.0"
+ );
}
///
- protected override AzuriteBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override AzuriteBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new AzuriteConfiguration(resourceConfiguration));
}
@@ -118,8 +142,11 @@ protected override AzuriteBuilder Clone(IContainerConfiguration resourceConfigur
}
///
- protected override AzuriteBuilder Merge(AzuriteConfiguration oldValue, AzuriteConfiguration newValue)
+ protected override AzuriteBuilder Merge(
+ AzuriteConfiguration oldValue,
+ AzuriteConfiguration newValue
+ )
{
return new AzuriteBuilder(new AzuriteConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Azurite/AzuriteConfiguration.cs b/src/Testcontainers.Azurite/AzuriteConfiguration.cs
index 168adde2c..91cfec956 100644
--- a/src/Testcontainers.Azurite/AzuriteConfiguration.cs
+++ b/src/Testcontainers.Azurite/AzuriteConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class AzuriteConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public AzuriteConfiguration()
- {
- }
+ public AzuriteConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public AzuriteConfiguration(IResourceConfiguration resourceConfiguration)
+ public AzuriteConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public AzuriteConfiguration(AzuriteConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public AzuriteConfiguration(AzuriteConfiguration oldValue, AzuriteConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Azurite/AzuriteContainer.cs b/src/Testcontainers.Azurite/AzuriteContainer.cs
index b7b1023b7..eadfa5f4c 100644
--- a/src/Testcontainers.Azurite/AzuriteContainer.cs
+++ b/src/Testcontainers.Azurite/AzuriteContainer.cs
@@ -9,9 +9,7 @@ public sealed class AzuriteContainer : DockerContainer
///
/// The container configuration.
public AzuriteContainer(AzuriteConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Azurite connection string.
@@ -26,7 +24,10 @@ public string GetConnectionString()
properties.Add("BlobEndpoint", GetBlobEndpoint());
properties.Add("QueueEndpoint", GetQueueEndpoint());
properties.Add("TableEndpoint", GetTableEndpoint());
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -35,7 +36,12 @@ public string GetConnectionString()
/// The Azurite blob endpoint
public string GetBlobEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.BlobPort), AzuriteBuilder.AccountName).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(AzuriteBuilder.BlobPort),
+ AzuriteBuilder.AccountName
+ ).ToString();
}
///
@@ -44,7 +50,12 @@ public string GetBlobEndpoint()
/// The Azurite queue endpoint
public string GetQueueEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.QueuePort), AzuriteBuilder.AccountName).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(AzuriteBuilder.QueuePort),
+ AzuriteBuilder.AccountName
+ ).ToString();
}
///
@@ -53,6 +64,11 @@ public string GetQueueEndpoint()
/// The Azurite table endpoint
public string GetTableEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.TablePort), AzuriteBuilder.AccountName).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(AzuriteBuilder.TablePort),
+ AzuriteBuilder.AccountName
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Azurite/AzuriteService.cs b/src/Testcontainers.Azurite/AzuriteService.cs
index 79867eac8..3796204c9 100644
--- a/src/Testcontainers.Azurite/AzuriteService.cs
+++ b/src/Testcontainers.Azurite/AzuriteService.cs
@@ -28,4 +28,4 @@ private AzuriteService(string identifier)
{
_ = identifier;
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Azurite/Testcontainers.Azurite.csproj b/src/Testcontainers.Azurite/Testcontainers.Azurite.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Azurite/Testcontainers.Azurite.csproj
+++ b/src/Testcontainers.Azurite/Testcontainers.Azurite.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Azurite/Usings.cs b/src/Testcontainers.Azurite/Usings.cs
index 2607026ed..15431f43b 100644
--- a/src/Testcontainers.Azurite/Usings.cs
+++ b/src/Testcontainers.Azurite/Usings.cs
@@ -5,4 +5,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.BigQuery/BigQueryBuilder.cs b/src/Testcontainers.BigQuery/BigQueryBuilder.cs
index 985dcf639..099865237 100644
--- a/src/Testcontainers.BigQuery/BigQueryBuilder.cs
+++ b/src/Testcontainers.BigQuery/BigQueryBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.BigQuery;
///
[PublicAPI]
-public sealed class BigQueryBuilder : ContainerBuilder
+public sealed class BigQueryBuilder
+ : ContainerBuilder
{
public const string BigQueryImage = "ghcr.io/goccy/bigquery-emulator:0.4";
@@ -33,7 +34,7 @@ private BigQueryBuilder(BigQueryConfiguration resourceConfiguration)
protected override BigQueryConfiguration DockerResourceConfiguration { get; }
///
- ///
+ ///
///
///
///
@@ -60,7 +61,9 @@ protected override BigQueryBuilder Init()
}
///
- protected override BigQueryBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override BigQueryBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new BigQueryConfiguration(resourceConfiguration));
}
@@ -72,8 +75,11 @@ protected override BigQueryBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override BigQueryBuilder Merge(BigQueryConfiguration oldValue, BigQueryConfiguration newValue)
+ protected override BigQueryBuilder Merge(
+ BigQueryConfiguration oldValue,
+ BigQueryConfiguration newValue
+ )
{
return new BigQueryBuilder(new BigQueryConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.BigQuery/BigQueryConfiguration.cs b/src/Testcontainers.BigQuery/BigQueryConfiguration.cs
index 0e705d945..f18ac0c4f 100644
--- a/src/Testcontainers.BigQuery/BigQueryConfiguration.cs
+++ b/src/Testcontainers.BigQuery/BigQueryConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class BigQueryConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public BigQueryConfiguration()
- {
- }
+ public BigQueryConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public BigQueryConfiguration(IResourceConfiguration resourceConfiguration)
+ public BigQueryConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public BigQueryConfiguration(BigQueryConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public BigQueryConfiguration(BigQueryConfiguration oldValue, BigQueryConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.BigQuery/BigQueryContainer.cs b/src/Testcontainers.BigQuery/BigQueryContainer.cs
index 9c2a70e51..22cec42f7 100644
--- a/src/Testcontainers.BigQuery/BigQueryContainer.cs
+++ b/src/Testcontainers.BigQuery/BigQueryContainer.cs
@@ -9,9 +9,7 @@ public sealed class BigQueryContainer : DockerContainer
///
/// The container configuration.
public BigQueryContainer(BigQueryConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the BigQuery emulator endpoint.
@@ -19,6 +17,10 @@ public BigQueryContainer(BigQueryConfiguration configuration)
/// The BigQuery emulator endpoint.
public string GetEmulatorEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(BigQueryBuilder.BigQueryPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(BigQueryBuilder.BigQueryPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.BigQuery/Testcontainers.BigQuery.csproj b/src/Testcontainers.BigQuery/Testcontainers.BigQuery.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.BigQuery/Testcontainers.BigQuery.csproj
+++ b/src/Testcontainers.BigQuery/Testcontainers.BigQuery.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.BigQuery/Usings.cs b/src/Testcontainers.BigQuery/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.BigQuery/Usings.cs
+++ b/src/Testcontainers.BigQuery/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Bigtable/BigtableBuilder.cs b/src/Testcontainers.Bigtable/BigtableBuilder.cs
index 867487f68..36b4e6376 100644
--- a/src/Testcontainers.Bigtable/BigtableBuilder.cs
+++ b/src/Testcontainers.Bigtable/BigtableBuilder.cs
@@ -2,9 +2,11 @@ namespace Testcontainers.Bigtable;
///
[PublicAPI]
-public sealed class BigtableBuilder : ContainerBuilder
+public sealed class BigtableBuilder
+ : ContainerBuilder
{
- public const string GoogleCloudCliImage = "gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators";
+ public const string GoogleCloudCliImage =
+ "gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators";
public const ushort BigtablePort = 9000;
@@ -44,12 +46,21 @@ protected override BigtableBuilder Init()
.WithImage(GoogleCloudCliImage)
.WithPortBinding(BigtablePort, true)
.WithEntrypoint("gcloud")
- .WithCommand("beta", "emulators", "bigtable", "start", "--host-port", "0.0.0.0:" + BigtablePort)
+ .WithCommand(
+ "beta",
+ "emulators",
+ "bigtable",
+ "start",
+ "--host-port",
+ "0.0.0.0:" + BigtablePort
+ )
.WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("(?s).*running.*$"));
}
///
- protected override BigtableBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override BigtableBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new BigtableConfiguration(resourceConfiguration));
}
@@ -61,8 +72,11 @@ protected override BigtableBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override BigtableBuilder Merge(BigtableConfiguration oldValue, BigtableConfiguration newValue)
+ protected override BigtableBuilder Merge(
+ BigtableConfiguration oldValue,
+ BigtableConfiguration newValue
+ )
{
return new BigtableBuilder(new BigtableConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Bigtable/BigtableConfiguration.cs b/src/Testcontainers.Bigtable/BigtableConfiguration.cs
index bf936ef60..d9d79e889 100644
--- a/src/Testcontainers.Bigtable/BigtableConfiguration.cs
+++ b/src/Testcontainers.Bigtable/BigtableConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class BigtableConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public BigtableConfiguration()
- {
- }
+ public BigtableConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public BigtableConfiguration(IResourceConfiguration resourceConfiguration)
+ public BigtableConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public BigtableConfiguration(BigtableConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public BigtableConfiguration(BigtableConfiguration oldValue, BigtableConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Bigtable/BigtableContainer.cs b/src/Testcontainers.Bigtable/BigtableContainer.cs
index f9f402aa4..2feb469ce 100644
--- a/src/Testcontainers.Bigtable/BigtableContainer.cs
+++ b/src/Testcontainers.Bigtable/BigtableContainer.cs
@@ -9,9 +9,7 @@ public sealed class BigtableContainer : DockerContainer
///
/// The container configuration.
public BigtableContainer(IContainerConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Bigtable emulator endpoint.
@@ -19,6 +17,10 @@ public BigtableContainer(IContainerConfiguration configuration)
/// The Bigtable emulator endpoint.
public string GetEmulatorEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(BigtableBuilder.BigtablePort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(BigtableBuilder.BigtablePort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Bigtable/Testcontainers.Bigtable.csproj b/src/Testcontainers.Bigtable/Testcontainers.Bigtable.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Bigtable/Testcontainers.Bigtable.csproj
+++ b/src/Testcontainers.Bigtable/Testcontainers.Bigtable.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Bigtable/Usings.cs b/src/Testcontainers.Bigtable/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.Bigtable/Usings.cs
+++ b/src/Testcontainers.Bigtable/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Cassandra/CassandraBuilder.cs b/src/Testcontainers.Cassandra/CassandraBuilder.cs
index 9a8590736..b7b1c1259 100644
--- a/src/Testcontainers.Cassandra/CassandraBuilder.cs
+++ b/src/Testcontainers.Cassandra/CassandraBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Cassandra;
///
[PublicAPI]
-public sealed class CassandraBuilder : ContainerBuilder
+public sealed class CassandraBuilder
+ : ContainerBuilder
{
public const string CassandraImage = "cassandra:5.0";
@@ -45,7 +46,10 @@ protected override CassandraBuilder Init()
return base.Init()
.WithImage(CassandraImage)
.WithPortBinding(CqlPort, true)
- .WithEnvironment("JVM_OPTS", "-Dcassandra.skip_wait_for_gossip_to_settle=0 -Dcassandra.initial_token=0")
+ .WithEnvironment(
+ "JVM_OPTS",
+ "-Dcassandra.skip_wait_for_gossip_to_settle=0 -Dcassandra.initial_token=0"
+ )
.WithEnvironment("HEAP_NEWSIZE", "128M")
.WithEnvironment("MAX_HEAP_SIZE", "1024M")
.WithEnvironment("CASSANDRA_SNITCH", "GossipingPropertyFileSnitch")
@@ -55,20 +59,31 @@ protected override CassandraBuilder Init()
}
///
- protected override CassandraBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override CassandraBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new CassandraConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new CassandraConfiguration(resourceConfiguration)
+ );
}
///
protected override CassandraBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new CassandraConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new CassandraConfiguration(resourceConfiguration)
+ );
}
///
- protected override CassandraBuilder Merge(CassandraConfiguration oldValue, CassandraConfiguration newValue)
+ protected override CassandraBuilder Merge(
+ CassandraConfiguration oldValue,
+ CassandraConfiguration newValue
+ )
{
return new CassandraBuilder(new CassandraConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Cassandra/CassandraConfiguration.cs b/src/Testcontainers.Cassandra/CassandraConfiguration.cs
index 2aade26d3..61039d6ce 100644
--- a/src/Testcontainers.Cassandra/CassandraConfiguration.cs
+++ b/src/Testcontainers.Cassandra/CassandraConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class CassandraConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public CassandraConfiguration()
- {
- }
+ public CassandraConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public CassandraConfiguration(IResourceConfiguration resourceConfiguration)
+ public CassandraConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public CassandraConfiguration(CassandraConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public CassandraConfiguration(CassandraConfiguration oldValue, CassandraConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Cassandra/CassandraContainer.cs b/src/Testcontainers.Cassandra/CassandraContainer.cs
index 819148014..00e2712ed 100644
--- a/src/Testcontainers.Cassandra/CassandraContainer.cs
+++ b/src/Testcontainers.Cassandra/CassandraContainer.cs
@@ -6,9 +6,7 @@ public sealed class CassandraContainer : DockerContainer, IDatabaseContainer
{
///
public CassandraContainer(CassandraConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Cassandra connection string.
@@ -22,7 +20,10 @@ public string GetConnectionString()
properties.Add("Contact Points", Hostname);
properties.Add("Port", publicPort);
properties.Add("Cluster Name", $"{Hostname}:{publicPort}");
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -31,14 +32,28 @@ public string GetConnectionString()
/// The content of the CQL script to execute.
/// Cancellation token.
/// Task that completes when the CQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
return await ExecAsync(new[] { "cqlsh", "--file", scriptFilePath }, ct)
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Cassandra/Testcontainers.Cassandra.csproj b/src/Testcontainers.Cassandra/Testcontainers.Cassandra.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Cassandra/Testcontainers.Cassandra.csproj
+++ b/src/Testcontainers.Cassandra/Testcontainers.Cassandra.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Cassandra/Usings.cs b/src/Testcontainers.Cassandra/Usings.cs
index 191eb3bce..5c4354ec7 100644
--- a/src/Testcontainers.Cassandra/Usings.cs
+++ b/src/Testcontainers.Cassandra/Usings.cs
@@ -1,12 +1,12 @@
global using System;
+global using System.Collections.Generic;
global using System.IO;
-global using System.Text;
global using System.Linq;
+global using System.Text;
global using System.Threading;
global using System.Threading.Tasks;
-global using System.Collections.Generic;
global using Docker.DotNet.Models;
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.ClickHouse/ClickHouseBuilder.cs b/src/Testcontainers.ClickHouse/ClickHouseBuilder.cs
index 4c48dba80..abe390134 100644
--- a/src/Testcontainers.ClickHouse/ClickHouseBuilder.cs
+++ b/src/Testcontainers.ClickHouse/ClickHouseBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.ClickHouse;
///
[PublicAPI]
-public sealed class ClickHouseBuilder : ContainerBuilder
+public sealed class ClickHouseBuilder
+ : ContainerBuilder
{
public const string ClickHouseImage = "clickhouse/clickhouse-server:23.6-alpine";
@@ -88,8 +89,12 @@ protected override ClickHouseBuilder Init()
.WithDatabase(DefaultDatabase)
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(HttpPort).ForResponseMessageMatching(IsNodeReadyAsync)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPort(HttpPort).ForResponseMessageMatching(IsNodeReadyAsync)
+ )
+ );
}
///
@@ -97,34 +102,48 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override ClickHouseBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ClickHouseBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new ClickHouseConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ClickHouseConfiguration(resourceConfiguration)
+ );
}
///
protected override ClickHouseBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new ClickHouseConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ClickHouseConfiguration(resourceConfiguration)
+ );
}
///
- protected override ClickHouseBuilder Merge(ClickHouseConfiguration oldValue, ClickHouseConfiguration newValue)
+ protected override ClickHouseBuilder Merge(
+ ClickHouseConfiguration oldValue,
+ ClickHouseConfiguration newValue
+ )
{
return new ClickHouseBuilder(new ClickHouseConfiguration(oldValue, newValue));
}
private static async Task IsNodeReadyAsync(HttpResponseMessage response)
{
- var content = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return "Ok.\n".Equals(content, StringComparison.OrdinalIgnoreCase);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ClickHouse/ClickHouseConfiguration.cs b/src/Testcontainers.ClickHouse/ClickHouseConfiguration.cs
index f65b3c2ad..3d41f8776 100644
--- a/src/Testcontainers.ClickHouse/ClickHouseConfiguration.cs
+++ b/src/Testcontainers.ClickHouse/ClickHouseConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class ClickHouseConfiguration : ContainerConfiguration
public ClickHouseConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public ClickHouseConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ClickHouseConfiguration(IResourceConfiguration resourceConfiguration)
+ public ClickHouseConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -55,7 +58,10 @@ public ClickHouseConfiguration(ClickHouseConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public ClickHouseConfiguration(ClickHouseConfiguration oldValue, ClickHouseConfiguration newValue)
+ public ClickHouseConfiguration(
+ ClickHouseConfiguration oldValue,
+ ClickHouseConfiguration newValue
+ )
: base(oldValue, newValue)
{
Database = BuildConfiguration.Combine(oldValue.Database, newValue.Database);
@@ -77,4 +83,4 @@ public ClickHouseConfiguration(ClickHouseConfiguration oldValue, ClickHouseConfi
/// Gets the ClickHouse password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ClickHouse/ClickHouseContainer.cs b/src/Testcontainers.ClickHouse/ClickHouseContainer.cs
index a52a749f2..70aadde32 100644
--- a/src/Testcontainers.ClickHouse/ClickHouseContainer.cs
+++ b/src/Testcontainers.ClickHouse/ClickHouseContainer.cs
@@ -28,7 +28,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("Username", _configuration.Username);
properties.Add("Password", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -37,14 +40,38 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "clickhouse-client", "--database", _configuration.Database, "--queries-file", scriptFilePath }, ct)
+ return await ExecAsync(
+ new[]
+ {
+ "clickhouse-client",
+ "--database",
+ _configuration.Database,
+ "--queries-file",
+ scriptFilePath,
+ },
+ ct
+ )
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ClickHouse/Testcontainers.ClickHouse.csproj b/src/Testcontainers.ClickHouse/Testcontainers.ClickHouse.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.ClickHouse/Testcontainers.ClickHouse.csproj
+++ b/src/Testcontainers.ClickHouse/Testcontainers.ClickHouse.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.ClickHouse/Usings.cs b/src/Testcontainers.ClickHouse/Usings.cs
index ee2e98dbe..55a66774b 100644
--- a/src/Testcontainers.ClickHouse/Usings.cs
+++ b/src/Testcontainers.ClickHouse/Usings.cs
@@ -11,4 +11,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.CockroachDb/CockroachDbBuilder.cs b/src/Testcontainers.CockroachDb/CockroachDbBuilder.cs
index eea0cda4d..73ed3c2e5 100644
--- a/src/Testcontainers.CockroachDb/CockroachDbBuilder.cs
+++ b/src/Testcontainers.CockroachDb/CockroachDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.CockroachDb;
///
[PublicAPI]
-public sealed class CockroachDbBuilder : ContainerBuilder
+public sealed class CockroachDbBuilder
+ : ContainerBuilder
{
public const string CockroachDbImage = "cockroachdb/cockroach:latest-v23.1";
@@ -90,8 +91,12 @@ protected override CockroachDbBuilder Init()
.WithPassword(DefaultPassword)
.WithCommand("start-single-node")
.WithCommand("--insecure")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(CockroachDbRestPort).ForPath("/health")));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPort(CockroachDbRestPort).ForPath("/health")
+ )
+ );
}
///
@@ -99,25 +104,40 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull();
}
///
- protected override CockroachDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override CockroachDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new CockroachDbConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new CockroachDbConfiguration(resourceConfiguration)
+ );
}
///
protected override CockroachDbBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new CockroachDbConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new CockroachDbConfiguration(resourceConfiguration)
+ );
}
///
- protected override CockroachDbBuilder Merge(CockroachDbConfiguration oldValue, CockroachDbConfiguration newValue)
+ protected override CockroachDbBuilder Merge(
+ CockroachDbConfiguration oldValue,
+ CockroachDbConfiguration newValue
+ )
{
return new CockroachDbBuilder(new CockroachDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CockroachDb/CockroachDbConfiguration.cs b/src/Testcontainers.CockroachDb/CockroachDbConfiguration.cs
index 4ef034b9d..ed8582428 100644
--- a/src/Testcontainers.CockroachDb/CockroachDbConfiguration.cs
+++ b/src/Testcontainers.CockroachDb/CockroachDbConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class CockroachDbConfiguration : ContainerConfiguration
public CockroachDbConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public CockroachDbConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public CockroachDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public CockroachDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -55,7 +58,10 @@ public CockroachDbConfiguration(CockroachDbConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public CockroachDbConfiguration(CockroachDbConfiguration oldValue, CockroachDbConfiguration newValue)
+ public CockroachDbConfiguration(
+ CockroachDbConfiguration oldValue,
+ CockroachDbConfiguration newValue
+ )
: base(oldValue, newValue)
{
Database = BuildConfiguration.Combine(oldValue.Database, newValue.Database);
@@ -77,4 +83,4 @@ public CockroachDbConfiguration(CockroachDbConfiguration oldValue, CockroachDbCo
/// Gets the CockroachDb password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CockroachDb/CockroachDbContainer.cs b/src/Testcontainers.CockroachDb/CockroachDbContainer.cs
index f13c98ea7..668558437 100644
--- a/src/Testcontainers.CockroachDb/CockroachDbContainer.cs
+++ b/src/Testcontainers.CockroachDb/CockroachDbContainer.cs
@@ -28,7 +28,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("Username", _configuration.Username);
properties.Add("Password", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -37,14 +40,31 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "cockroach", "sql", "--insecure", "--file", scriptFilePath }, ct)
+ return await ExecAsync(
+ new[] { "cockroach", "sql", "--insecure", "--file", scriptFilePath },
+ ct
+ )
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CockroachDb/Testcontainers.CockroachDb.csproj b/src/Testcontainers.CockroachDb/Testcontainers.CockroachDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.CockroachDb/Testcontainers.CockroachDb.csproj
+++ b/src/Testcontainers.CockroachDb/Testcontainers.CockroachDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.CockroachDb/Usings.cs b/src/Testcontainers.CockroachDb/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.CockroachDb/Usings.cs
+++ b/src/Testcontainers.CockroachDb/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Consul/ConsulBuilder.cs b/src/Testcontainers.Consul/ConsulBuilder.cs
index 902f10e8e..acc71b4f2 100644
--- a/src/Testcontainers.Consul/ConsulBuilder.cs
+++ b/src/Testcontainers.Consul/ConsulBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Consul;
///
[PublicAPI]
-public sealed class ConsulBuilder : ContainerBuilder
+public sealed class ConsulBuilder
+ : ContainerBuilder
{
public const string ConsulImage = "consul:1.15";
@@ -48,12 +49,18 @@ protected override ConsulBuilder Init()
.WithPortBinding(ConsulGrpcPort, true)
.WithCommand("agent", "-dev", "-client", "0.0.0.0")
.WithCreateParameterModifier(cmd => cmd.HostConfig.CapAdd = new[] { "IPC_LOCK" })
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/v1/status/leader").ForPort(ConsulHttpPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/v1/status/leader").ForPort(ConsulHttpPort)
+ )
+ );
}
///
- protected override ConsulBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ConsulBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new ConsulConfiguration(resourceConfiguration));
}
@@ -65,8 +72,11 @@ protected override ConsulBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override ConsulBuilder Merge(ConsulConfiguration oldValue, ConsulConfiguration newValue)
+ protected override ConsulBuilder Merge(
+ ConsulConfiguration oldValue,
+ ConsulConfiguration newValue
+ )
{
return new ConsulBuilder(new ConsulConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Consul/ConsulConfiguration.cs b/src/Testcontainers.Consul/ConsulConfiguration.cs
index d67d88d22..b3c916ec6 100644
--- a/src/Testcontainers.Consul/ConsulConfiguration.cs
+++ b/src/Testcontainers.Consul/ConsulConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class ConsulConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public ConsulConfiguration()
- {
- }
+ public ConsulConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ConsulConfiguration(IResourceConfiguration resourceConfiguration)
+ public ConsulConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public ConsulConfiguration(ConsulConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public ConsulConfiguration(ConsulConfiguration oldValue, ConsulConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Consul/ConsulContainer.cs b/src/Testcontainers.Consul/ConsulContainer.cs
index 9d431865b..533af3f2f 100644
--- a/src/Testcontainers.Consul/ConsulContainer.cs
+++ b/src/Testcontainers.Consul/ConsulContainer.cs
@@ -9,9 +9,7 @@ public sealed class ConsulContainer : DockerContainer
///
/// The container configuration.
public ConsulContainer(ConsulConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Consul base address.
@@ -19,6 +17,10 @@ public ConsulContainer(ConsulConfiguration configuration)
/// The Consul base address.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(ConsulBuilder.ConsulHttpPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(ConsulBuilder.ConsulHttpPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Consul/Testcontainers.Consul.csproj b/src/Testcontainers.Consul/Testcontainers.Consul.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Consul/Testcontainers.Consul.csproj
+++ b/src/Testcontainers.Consul/Testcontainers.Consul.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Consul/Usings.cs b/src/Testcontainers.Consul/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.Consul/Usings.cs
+++ b/src/Testcontainers.Consul/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.CosmosDb/CosmosDbBuilder.cs b/src/Testcontainers.CosmosDb/CosmosDbBuilder.cs
index bde981f22..ef2fcbe2b 100644
--- a/src/Testcontainers.CosmosDb/CosmosDbBuilder.cs
+++ b/src/Testcontainers.CosmosDb/CosmosDbBuilder.cs
@@ -2,13 +2,16 @@ namespace Testcontainers.CosmosDb;
///
[PublicAPI]
-public sealed class CosmosDbBuilder : ContainerBuilder
+public sealed class CosmosDbBuilder
+ : ContainerBuilder
{
- public const string CosmosDbImage = "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest";
+ public const string CosmosDbImage =
+ "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest";
public const ushort CosmosDbPort = 8081;
- public const string DefaultAccountKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
+ public const string DefaultAccountKey =
+ "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
///
/// Initializes a new instance of the class.
@@ -49,7 +52,9 @@ protected override CosmosDbBuilder Init()
}
///
- protected override CosmosDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override CosmosDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new CosmosDbConfiguration(resourceConfiguration));
}
@@ -61,7 +66,10 @@ protected override CosmosDbBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override CosmosDbBuilder Merge(CosmosDbConfiguration oldValue, CosmosDbConfiguration newValue)
+ protected override CosmosDbBuilder Merge(
+ CosmosDbConfiguration oldValue,
+ CosmosDbConfiguration newValue
+ )
{
return new CosmosDbBuilder(new CosmosDbConfiguration(oldValue, newValue));
}
@@ -79,7 +87,8 @@ public async Task UntilAsync(IContainer container)
try
{
- using var httpResponse = await httpClient.GetAsync(requestUri)
+ using var httpResponse = await httpClient
+ .GetAsync(requestUri)
.ConfigureAwait(false);
return httpResponse.IsSuccessStatusCode;
@@ -94,4 +103,4 @@ public async Task UntilAsync(IContainer container)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CosmosDb/CosmosDbConfiguration.cs b/src/Testcontainers.CosmosDb/CosmosDbConfiguration.cs
index c623b6aef..cae5d02d6 100644
--- a/src/Testcontainers.CosmosDb/CosmosDbConfiguration.cs
+++ b/src/Testcontainers.CosmosDb/CosmosDbConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class CosmosDbConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public CosmosDbConfiguration()
- {
- }
+ public CosmosDbConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public CosmosDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public CosmosDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public CosmosDbConfiguration(CosmosDbConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public CosmosDbConfiguration(CosmosDbConfiguration oldValue, CosmosDbConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.CosmosDb/CosmosDbContainer.cs b/src/Testcontainers.CosmosDb/CosmosDbContainer.cs
index b7b0a57d7..b6ceb970e 100644
--- a/src/Testcontainers.CosmosDb/CosmosDbContainer.cs
+++ b/src/Testcontainers.CosmosDb/CosmosDbContainer.cs
@@ -9,9 +9,7 @@ public sealed class CosmosDbContainer : DockerContainer
///
/// The container configuration.
public CosmosDbContainer(CosmosDbConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the CosmosDb connection string.
@@ -20,15 +18,26 @@ public CosmosDbContainer(CosmosDbConfiguration configuration)
public string GetConnectionString()
{
var properties = new Dictionary();
- properties.Add("AccountEndpoint", new UriBuilder(Uri.UriSchemeHttps, Hostname, GetMappedPublicPort(CosmosDbBuilder.CosmosDbPort)).ToString());
+ properties.Add(
+ "AccountEndpoint",
+ new UriBuilder(
+ Uri.UriSchemeHttps,
+ Hostname,
+ GetMappedPublicPort(CosmosDbBuilder.CosmosDbPort)
+ ).ToString()
+ );
properties.Add("AccountKey", CosmosDbBuilder.DefaultAccountKey);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
/// Gets a configured HTTP message handler that automatically trusts the CosmosDb Emulator's certificate.
///
- public HttpMessageHandler HttpMessageHandler => new UriRewriter(Hostname, GetMappedPublicPort(CosmosDbBuilder.CosmosDbPort));
+ public HttpMessageHandler HttpMessageHandler =>
+ new UriRewriter(Hostname, GetMappedPublicPort(CosmosDbBuilder.CosmosDbPort));
///
/// Gets a configured HTTP client that automatically trusts the CosmosDb Emulator's certificate.
@@ -50,17 +59,30 @@ private sealed class UriRewriter : DelegatingHandler
/// The target hostname.
/// The target port.
public UriRewriter(string hostname, ushort port)
- : base(new HttpClientHandler { ServerCertificateCustomValidationCallback = (_, _, _, _) => true })
+ : base(
+ new HttpClientHandler
+ {
+ ServerCertificateCustomValidationCallback = (_, _, _, _) => true,
+ }
+ )
{
_hostname = hostname;
_port = port;
}
///
- protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+ protected override Task SendAsync(
+ HttpRequestMessage request,
+ CancellationToken cancellationToken
+ )
{
- request.RequestUri = new UriBuilder(Uri.UriSchemeHttps, _hostname, _port, request.RequestUri.PathAndQuery).Uri;
+ request.RequestUri = new UriBuilder(
+ Uri.UriSchemeHttps,
+ _hostname,
+ _port,
+ request.RequestUri.PathAndQuery
+ ).Uri;
return base.SendAsync(request, cancellationToken);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CosmosDb/Testcontainers.CosmosDb.csproj b/src/Testcontainers.CosmosDb/Testcontainers.CosmosDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.CosmosDb/Testcontainers.CosmosDb.csproj
+++ b/src/Testcontainers.CosmosDb/Testcontainers.CosmosDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.CosmosDb/Usings.cs b/src/Testcontainers.CosmosDb/Usings.cs
index 8642a70f5..698de4d36 100644
--- a/src/Testcontainers.CosmosDb/Usings.cs
+++ b/src/Testcontainers.CosmosDb/Usings.cs
@@ -8,4 +8,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.CouchDb/CouchDbBuilder.cs b/src/Testcontainers.CouchDb/CouchDbBuilder.cs
index bae17e902..98873971f 100644
--- a/src/Testcontainers.CouchDb/CouchDbBuilder.cs
+++ b/src/Testcontainers.CouchDb/CouchDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.CouchDb;
///
[PublicAPI]
-public sealed class CouchDbBuilder : ContainerBuilder
+public sealed class CouchDbBuilder
+ : ContainerBuilder
{
public const string CouchDbImage = "couchdb:3.3";
@@ -71,8 +72,12 @@ protected override CouchDbBuilder Init()
.WithPortBinding(CouchDbPort, true)
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/").ForPort(CouchDbPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/").ForPort(CouchDbPort)
+ )
+ );
}
///
@@ -80,17 +85,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override CouchDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override CouchDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new CouchDbConfiguration(resourceConfiguration));
}
@@ -102,8 +117,11 @@ protected override CouchDbBuilder Clone(IContainerConfiguration resourceConfigur
}
///
- protected override CouchDbBuilder Merge(CouchDbConfiguration oldValue, CouchDbConfiguration newValue)
+ protected override CouchDbBuilder Merge(
+ CouchDbConfiguration oldValue,
+ CouchDbConfiguration newValue
+ )
{
return new CouchDbBuilder(new CouchDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CouchDb/CouchDbConfiguration.cs b/src/Testcontainers.CouchDb/CouchDbConfiguration.cs
index fc76e153e..e0904db10 100644
--- a/src/Testcontainers.CouchDb/CouchDbConfiguration.cs
+++ b/src/Testcontainers.CouchDb/CouchDbConfiguration.cs
@@ -9,9 +9,7 @@ public sealed class CouchDbConfiguration : ContainerConfiguration
///
/// The CouchDb username.
/// The CouchDb password.
- public CouchDbConfiguration(
- string username = null,
- string password = null)
+ public CouchDbConfiguration(string username = null, string password = null)
{
Username = username;
Password = password;
@@ -21,7 +19,9 @@ public CouchDbConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public CouchDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public CouchDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -68,4 +68,4 @@ public CouchDbConfiguration(CouchDbConfiguration oldValue, CouchDbConfiguration
/// Gets the CouchDb password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CouchDb/CouchDbContainer.cs b/src/Testcontainers.CouchDb/CouchDbContainer.cs
index e75b000e8..0ebccc201 100644
--- a/src/Testcontainers.CouchDb/CouchDbContainer.cs
+++ b/src/Testcontainers.CouchDb/CouchDbContainer.cs
@@ -22,9 +22,13 @@ public CouchDbContainer(CouchDbConfiguration configuration)
/// The CouchDb connection string.
public string GetConnectionString()
{
- var endpoint = new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(CouchDbBuilder.CouchDbPort));
+ var endpoint = new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(CouchDbBuilder.CouchDbPort)
+ );
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.CouchDb/Testcontainers.CouchDb.csproj b/src/Testcontainers.CouchDb/Testcontainers.CouchDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.CouchDb/Testcontainers.CouchDb.csproj
+++ b/src/Testcontainers.CouchDb/Testcontainers.CouchDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.CouchDb/Usings.cs b/src/Testcontainers.CouchDb/Usings.cs
index 8e5c20fd5..f89f0c94d 100644
--- a/src/Testcontainers.CouchDb/Usings.cs
+++ b/src/Testcontainers.CouchDb/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Couchbase/CouchbaseBucket.cs b/src/Testcontainers.Couchbase/CouchbaseBucket.cs
index 04d8ab472..efcf0e6aa 100644
--- a/src/Testcontainers.Couchbase/CouchbaseBucket.cs
+++ b/src/Testcontainers.Couchbase/CouchbaseBucket.cs
@@ -9,7 +9,9 @@ public sealed class CouchbaseBucket
///
/// Gets the default bucket.
///
- public static readonly CouchbaseBucket Default = new CouchbaseBucket(Guid.NewGuid().ToString("D"));
+ public static readonly CouchbaseBucket Default = new CouchbaseBucket(
+ Guid.NewGuid().ToString("D")
+ );
///
/// Initializes a new instance of the struct.
@@ -24,7 +26,8 @@ private CouchbaseBucket(
bool flushEnabled = false,
bool primaryIndexEnabled = true,
ushort quotaMiB = 100,
- ushort replicaNumber = 0)
+ ushort replicaNumber = 0
+ )
{
Name = name;
FlushEnabled = flushEnabled;
@@ -57,4 +60,4 @@ private CouchbaseBucket(
/// Gets the replica number.
///
public ushort ReplicaNumber { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Couchbase/CouchbaseBuilder.cs b/src/Testcontainers.Couchbase/CouchbaseBuilder.cs
index 710f14647..29d196169 100644
--- a/src/Testcontainers.Couchbase/CouchbaseBuilder.cs
+++ b/src/Testcontainers.Couchbase/CouchbaseBuilder.cs
@@ -5,7 +5,8 @@ namespace Testcontainers.Couchbase;
/// The Couchbase module runs the following services: Data, Index, Query, Search and creates the bucket during the start.
///
[PublicAPI]
-public sealed class CouchbaseBuilder : ContainerBuilder
+public sealed class CouchbaseBuilder
+ : ContainerBuilder
{
public const string CouchbaseImage = "couchbase:community-7.0.2";
@@ -41,11 +42,23 @@ public sealed class CouchbaseBuilder : ContainerBuilder BasicAuthenticationHeader = new KeyValuePair("Authorization", "Basic " + Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(string.Join(":", DefaultUsername, DefaultPassword))));
+ private static readonly KeyValuePair BasicAuthenticationHeader =
+ new KeyValuePair(
+ "Authorization",
+ "Basic "
+ + Convert.ToBase64String(
+ Encoding
+ .GetEncoding("ISO-8859-1")
+ .GetBytes(string.Join(":", DefaultUsername, DefaultPassword))
+ )
+ );
- private static readonly IWaitUntil WaitUntilNodeIsReady = new HttpWaitStrategy().ForPath("/pools").ForPort(MgmtPort);
+ private static readonly IWaitUntil WaitUntilNodeIsReady = new HttpWaitStrategy()
+ .ForPath("/pools")
+ .ForPort(MgmtPort);
- private static readonly ISet EnabledServices = new HashSet();
+ private static readonly ISet EnabledServices =
+ new HashSet();
static CouchbaseBuilder()
{
@@ -86,42 +99,49 @@ public override CouchbaseContainer Build()
if (EnabledServices.Any())
{
- waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request
- => request
+ waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request =>
+ request
.ForPath("/pools/default")
.ForPort(MgmtPort)
.ForResponseMessageMatching(IsNodeHealthyAsync)
- .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value));
+ .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value)
+ );
}
if (EnabledServices.Contains(CouchbaseService.Query))
{
- waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request
- => request
+ waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request =>
+ request
.ForPath("/admin/ping")
.ForPort(QueryPort)
- .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value));
+ .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value)
+ );
}
if (EnabledServices.Contains(CouchbaseService.Analytics))
{
- waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request
- => request
+ waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request =>
+ request
.ForPath("/admin/ping")
.ForPort(AnalyticsPort)
- .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value));
+ .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value)
+ );
}
if (EnabledServices.Contains(CouchbaseService.Eventing))
{
- waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request
- => request
+ waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request =>
+ request
.ForPath("/api/v1/config")
.ForPort(EventingPort)
- .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value));
+ .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value)
+ );
}
- var couchbaseBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(waitStrategy);
+ var couchbaseBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(waitStrategy);
return new CouchbaseContainer(couchbaseBuilder.DockerResourceConfiguration);
}
@@ -149,19 +169,30 @@ protected override CouchbaseBuilder Init()
}
///
- protected override CouchbaseBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override CouchbaseBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new CouchbaseConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new CouchbaseConfiguration(resourceConfiguration)
+ );
}
///
protected override CouchbaseBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new CouchbaseConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new CouchbaseConfiguration(resourceConfiguration)
+ );
}
///
- protected override CouchbaseBuilder Merge(CouchbaseConfiguration oldValue, CouchbaseConfiguration newValue)
+ protected override CouchbaseBuilder Merge(
+ CouchbaseConfiguration oldValue,
+ CouchbaseConfiguration newValue
+ )
{
return new CouchbaseBuilder(new CouchbaseConfiguration(oldValue, newValue));
}
@@ -183,50 +214,58 @@ private CouchbaseBuilder WithBucket(params CouchbaseBucket[] bucket)
/// Cancellation token.
private async Task ConfigureCouchbaseAsync(IContainer container, CancellationToken ct = default)
{
- await WaitStrategy.WaitUntilAsync(() => WaitUntilNodeIsReady.UntilAsync(container), TimeSpan.FromSeconds(2), TimeSpan.FromMinutes(5), -1, ct)
+ await WaitStrategy
+ .WaitUntilAsync(
+ () => WaitUntilNodeIsReady.UntilAsync(container),
+ TimeSpan.FromSeconds(2),
+ TimeSpan.FromMinutes(5),
+ -1,
+ ct
+ )
.ConfigureAwait(false);
using (var httpClient = new HttpClient(new RetryHandler()))
{
- httpClient.BaseAddress = new UriBuilder(Uri.UriSchemeHttp, container.Hostname, container.GetMappedPublicPort(MgmtPort)).Uri;
+ httpClient.BaseAddress = new UriBuilder(
+ Uri.UriSchemeHttp,
+ container.Hostname,
+ container.GetMappedPublicPort(MgmtPort)
+ ).Uri;
using (var request = new RenameNodeRequest(container))
{
- using (var response = await httpClient.SendAsync(request, ct)
- .ConfigureAwait(false))
+ using (var response = await httpClient.SendAsync(request, ct).ConfigureAwait(false))
{
- await EnsureSuccessStatusCodeAsync(response)
- .ConfigureAwait(false);
+ await EnsureSuccessStatusCodeAsync(response).ConfigureAwait(false);
}
}
using (var request = new SetupNodeServicesRequest(EnabledServices.ToArray()))
{
- using (var response = await httpClient.SendAsync(request, ct)
- .ConfigureAwait(false))
+ using (var response = await httpClient.SendAsync(request, ct).ConfigureAwait(false))
{
- await EnsureSuccessStatusCodeAsync(response)
- .ConfigureAwait(false);
+ await EnsureSuccessStatusCodeAsync(response).ConfigureAwait(false);
}
}
using (var request = new SetupMemoryQuotasRequest(EnabledServices.ToArray()))
{
- using (var response = await httpClient.SendAsync(request, ct)
- .ConfigureAwait(false))
+ using (var response = await httpClient.SendAsync(request, ct).ConfigureAwait(false))
{
- await EnsureSuccessStatusCodeAsync(response)
- .ConfigureAwait(false);
+ await EnsureSuccessStatusCodeAsync(response).ConfigureAwait(false);
}
}
- using (var request = new ConfigureExternalAddressesRequest(container, EnabledServices.ToArray()))
+ using (
+ var request = new ConfigureExternalAddressesRequest(
+ container,
+ EnabledServices.ToArray()
+ )
+ )
{
- using (var response = await httpClient.SendAsync(request, ct)
- .ConfigureAwait(false))
+ using (var response = await httpClient.SendAsync(request, ct).ConfigureAwait(false))
{
- await EnsureSuccessStatusCodeAsync(response)
- .ConfigureAwait(false);
+ await EnsureSuccessStatusCodeAsync(response).ConfigureAwait(false);
}
}
@@ -234,11 +273,11 @@ await EnsureSuccessStatusCodeAsync(response)
{
using (var request = new CreateBucketRequest(bucket))
{
- using (var response = await httpClient.SendAsync(request, ct)
- .ConfigureAwait(false))
+ using (
+ var response = await httpClient.SendAsync(request, ct).ConfigureAwait(false)
+ )
{
- await EnsureSuccessStatusCodeAsync(response)
- .ConfigureAwait(false);
+ await EnsureSuccessStatusCodeAsync(response).ConfigureAwait(false);
}
}
}
@@ -249,27 +288,40 @@ await EnsureSuccessStatusCodeAsync(response)
// We got frequently: System.IO.IOException The response ended prematurely.
using (var request = new SetupCredentialsRequest())
{
- using (var response = await httpClient.SendAsync(request, ct)
- .ConfigureAwait(false))
+ using (var response = await httpClient.SendAsync(request, ct).ConfigureAwait(false))
{
- await EnsureSuccessStatusCodeAsync(response)
- .ConfigureAwait(false);
+ await EnsureSuccessStatusCodeAsync(response).ConfigureAwait(false);
}
}
}
// As long as we do not expose the bucket API, we do not need to iterate over all of them.
- var waitUntilBucketIsCreated = DockerResourceConfiguration.Buckets.Aggregate(Wait.ForUnixContainer(), (waitStrategy, bucket)
- => waitStrategy.UntilHttpRequestIsSucceeded(request
- => request
- .ForPath("/pools/default/buckets/" + bucket.Name)
- .ForPort(MgmtPort)
- .ForResponseMessageMatching(AllServicesEnabledAsync)
- .WithHeader(BasicAuthenticationHeader.Key, BasicAuthenticationHeader.Value)))
+ var waitUntilBucketIsCreated = DockerResourceConfiguration
+ .Buckets.Aggregate(
+ Wait.ForUnixContainer(),
+ (waitStrategy, bucket) =>
+ waitStrategy.UntilHttpRequestIsSucceeded(request =>
+ request
+ .ForPath("/pools/default/buckets/" + bucket.Name)
+ .ForPort(MgmtPort)
+ .ForResponseMessageMatching(AllServicesEnabledAsync)
+ .WithHeader(
+ BasicAuthenticationHeader.Key,
+ BasicAuthenticationHeader.Value
+ )
+ )
+ )
.Build()
.Last();
- await WaitStrategy.WaitUntilAsync(() => waitUntilBucketIsCreated.UntilAsync(container, ct), TimeSpan.FromSeconds(2), TimeSpan.FromMinutes(5), -1, ct)
+ await WaitStrategy
+ .WaitUntilAsync(
+ () => waitUntilBucketIsCreated.UntilAsync(container, ct),
+ TimeSpan.FromSeconds(2),
+ TimeSpan.FromMinutes(5),
+ -1,
+ ct
+ )
.ConfigureAwait(false);
}
@@ -283,14 +335,13 @@ await WaitStrategy.WaitUntilAsync(() => waitUntilBucketIsCreated.UntilAsync(cont
/// A value indicating whether the single-node is healthy or not.
private static async Task IsNodeHealthyAsync(HttpResponseMessage response)
{
- var jsonString = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var jsonString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- var status = JsonDocument.Parse(jsonString)
- .RootElement
- .GetProperty("nodes")
+ var status = JsonDocument
+ .Parse(jsonString)
+ .RootElement.GetProperty("nodes")
.EnumerateArray()
.ElementAt(0)
.GetProperty("status")
@@ -314,14 +365,13 @@ private static async Task IsNodeHealthyAsync(HttpResponseMessage response)
/// A value indicating whether all services are enabled for a bucket or not.
private static async Task AllServicesEnabledAsync(HttpResponseMessage response)
{
- var jsonString = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var jsonString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- var services = JsonDocument.Parse(jsonString)
- .RootElement
- .GetProperty("nodes")
+ var services = JsonDocument
+ .Parse(jsonString)
+ .RootElement.GetProperty("nodes")
.EnumerateArray()
.ElementAt(0)
.GetProperty("services")
@@ -329,7 +379,9 @@ private static async Task AllServicesEnabledAsync(HttpResponseMessage resp
.Select(service => service.GetString())
.Where(service => service != null);
- return EnabledServices.All(enabledService => services.Any(service => service.StartsWith(enabledService.Identifier)));
+ return EnabledServices.All(enabledService =>
+ services.Any(service => service.StartsWith(enabledService.Identifier))
+ );
}
catch
{
@@ -350,8 +402,7 @@ private static async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage respo
}
catch (Exception e)
{
- var content = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new InvalidOperationException(content, e);
}
@@ -394,7 +445,13 @@ public SetupNodeServicesRequest(params CouchbaseService[] enabledServices)
: base(HttpMethod.Post, "/node/controller/setupServices")
{
IDictionary content = new Dictionary();
- content.Add("services", string.Join(",", enabledServices.Select(enabledService => enabledService.Identifier)));
+ content.Add(
+ "services",
+ string.Join(
+ ",",
+ enabledServices.Select(enabledService => enabledService.Identifier)
+ )
+ );
Content = new FormUrlEncodedContent(content);
}
}
@@ -429,7 +486,10 @@ public SetupMemoryQuotasRequest(params CouchbaseService[] enabledServices)
}
else
{
- content.Add(enabledService.Identifier + "MemoryQuota", enabledService.MinimumQuotaMb.ToString());
+ content.Add(
+ enabledService.Identifier + "MemoryQuota",
+ enabledService.MinimumQuotaMb.ToString()
+ );
}
}
@@ -450,7 +510,10 @@ private sealed class ConfigureExternalAddressesRequest : HttpRequestMessage
///
/// The Couchbase container.
/// The enabled Couchbase node services.
- public ConfigureExternalAddressesRequest(IContainer container, params CouchbaseService[] enabledServices)
+ public ConfigureExternalAddressesRequest(
+ IContainer container,
+ params CouchbaseService[] enabledServices
+ )
: base(HttpMethod.Put, "/node/controller/setupAlternateAddresses/external")
{
IDictionary content = new Dictionary();
@@ -487,8 +550,14 @@ public ConfigureExternalAddressesRequest(IContainer container, params CouchbaseS
if (enabledServices.Contains(CouchbaseService.Eventing))
{
- content.Add("eventingAdminPort", container.GetMappedPublicPort(EventingPort).ToString());
- content.Add("eventingSSL", container.GetMappedPublicPort(EventingSslPort).ToString());
+ content.Add(
+ "eventingAdminPort",
+ container.GetMappedPublicPort(EventingPort).ToString()
+ );
+ content.Add(
+ "eventingSSL",
+ container.GetMappedPublicPort(EventingSslPort).ToString()
+ );
}
Content = new FormUrlEncodedContent(content);
@@ -559,19 +628,19 @@ private sealed class RetryHandler : DelegatingHandler
/// Initializes a new instance of the class.
///
public RetryHandler()
- : base(new HttpClientHandler())
- {
- }
+ : base(new HttpClientHandler()) { }
///
- protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+ protected override async Task SendAsync(
+ HttpRequestMessage request,
+ CancellationToken cancellationToken
+ )
{
for (var _ = 0; _ < MaxRetries; _++)
{
try
{
- return await base.SendAsync(request, cancellationToken)
- .ConfigureAwait(false);
+ return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
catch (HttpRequestException)
{
@@ -580,7 +649,9 @@ await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken)
}
}
- throw new HttpRequestException($"Unable to configure Couchbase. The HTTP request '{request.RequestUri}' did not complete successfully.");
+ throw new HttpRequestException(
+ $"Unable to configure Couchbase. The HTTP request '{request.RequestUri}' did not complete successfully."
+ );
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Couchbase/CouchbaseConfiguration.cs b/src/Testcontainers.Couchbase/CouchbaseConfiguration.cs
index 92c69f866..835548a26 100644
--- a/src/Testcontainers.Couchbase/CouchbaseConfiguration.cs
+++ b/src/Testcontainers.Couchbase/CouchbaseConfiguration.cs
@@ -17,7 +17,9 @@ public CouchbaseConfiguration(IEnumerable buckets = null)
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public CouchbaseConfiguration(IResourceConfiguration resourceConfiguration)
+ public CouchbaseConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -58,4 +60,4 @@ public CouchbaseConfiguration(CouchbaseConfiguration oldValue, CouchbaseConfigur
/// Gets a list of Couchbase buckets.
///
public IEnumerable Buckets { get; } = Array.Empty();
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Couchbase/CouchbaseContainer.cs b/src/Testcontainers.Couchbase/CouchbaseContainer.cs
index 64bdbe8b9..926cde50a 100644
--- a/src/Testcontainers.Couchbase/CouchbaseContainer.cs
+++ b/src/Testcontainers.Couchbase/CouchbaseContainer.cs
@@ -14,8 +14,17 @@ public CouchbaseContainer(CouchbaseConfiguration configuration)
: base(configuration)
{
_configuration = configuration;
- Starting += (_, _) => Logger.LogInformation("Couchbase container is starting, performing configuration.");
- Started += (_, _) => Logger.LogInformation("Couchbase container is ready! UI available at {Url}.", new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(CouchbaseBuilder.MgmtPort)));
+ Starting += (_, _) =>
+ Logger.LogInformation("Couchbase container is starting, performing configuration.");
+ Started += (_, _) =>
+ Logger.LogInformation(
+ "Couchbase container is ready! UI available at {Url}.",
+ new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(CouchbaseBuilder.MgmtPort)
+ )
+ );
}
///
@@ -29,6 +38,8 @@ public CouchbaseContainer(CouchbaseConfiguration configuration)
/// The Couchbase connection string.
public string GetConnectionString()
{
- return new UriBuilder("couchbase", Hostname, GetMappedPublicPort(CouchbaseBuilder.KvPort)).Uri.Authority;
+ return new UriBuilder("couchbase", Hostname, GetMappedPublicPort(CouchbaseBuilder.KvPort))
+ .Uri
+ .Authority;
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Couchbase/CouchbaseService.cs b/src/Testcontainers.Couchbase/CouchbaseService.cs
index a90f38789..f984153b0 100644
--- a/src/Testcontainers.Couchbase/CouchbaseService.cs
+++ b/src/Testcontainers.Couchbase/CouchbaseService.cs
@@ -60,4 +60,4 @@ private CouchbaseService(string identifier, ushort minimumQuotaMb)
/// Gets a value indicating whether the service has a minimum quota or not.
///
public bool HasQuota => MinimumQuotaMb > 0;
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Couchbase/Testcontainers.Couchbase.csproj b/src/Testcontainers.Couchbase/Testcontainers.Couchbase.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Couchbase/Testcontainers.Couchbase.csproj
+++ b/src/Testcontainers.Couchbase/Testcontainers.Couchbase.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Couchbase/Usings.cs b/src/Testcontainers.Couchbase/Usings.cs
index c4eeb83d8..94ef04b7c 100644
--- a/src/Testcontainers.Couchbase/Usings.cs
+++ b/src/Testcontainers.Couchbase/Usings.cs
@@ -11,4 +11,4 @@
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using JetBrains.Annotations;
-global using Microsoft.Extensions.Logging;
\ No newline at end of file
+global using Microsoft.Extensions.Logging;
diff --git a/src/Testcontainers.Db2/Db2Builder.cs b/src/Testcontainers.Db2/Db2Builder.cs
index 4731c9005..0ba86c1a0 100644
--- a/src/Testcontainers.Db2/Db2Builder.cs
+++ b/src/Testcontainers.Db2/Db2Builder.cs
@@ -55,7 +55,9 @@ private Db2Builder(Db2Configuration resourceConfiguration)
/// A configured instance of .
public override Db2Builder WithAcceptLicenseAgreement(bool acceptLicenseAgreement)
{
- var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement;
+ var licenseAgreement = acceptLicenseAgreement
+ ? AcceptLicenseAgreement
+ : DeclineLicenseAgreement;
return WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
}
@@ -102,31 +104,42 @@ public override Db2Container Build()
}
///
- protected override Db2Builder Init() => base.Init()
- .WithImage(Db2Image)
- .WithPortBinding(Db2Port, true)
- .WithDatabase(DefaultDatabase)
- .WithUsername(DefaultUsername)
- .WithPassword(DefaultPassword)
- .WithPrivileged(true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Setup has completed."));
+ protected override Db2Builder Init() =>
+ base.Init()
+ .WithImage(Db2Image)
+ .WithPortBinding(Db2Port, true)
+ .WithDatabase(DefaultDatabase)
+ .WithUsername(DefaultUsername)
+ .WithPassword(DefaultPassword)
+ .WithPrivileged(true)
+ .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Setup has completed."));
///
protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override Db2Builder Clone(IResourceConfiguration resourceConfiguration)
+ protected override Db2Builder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new Db2Configuration(resourceConfiguration));
}
@@ -142,4 +155,4 @@ protected override Db2Builder Merge(Db2Configuration oldValue, Db2Configuration
{
return new Db2Builder(new Db2Configuration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Db2/Db2Configuration.cs b/src/Testcontainers.Db2/Db2Configuration.cs
index 97208985b..634eaeb16 100644
--- a/src/Testcontainers.Db2/Db2Configuration.cs
+++ b/src/Testcontainers.Db2/Db2Configuration.cs
@@ -10,10 +10,7 @@ public sealed class Db2Configuration : ContainerConfiguration
/// The Db2 database.
/// The Db2 username.
/// The Db2 password.
- public Db2Configuration(
- string database = null,
- string username = null,
- string password = null)
+ public Db2Configuration(string database = null, string username = null, string password = null)
{
Database = database;
Username = username;
@@ -77,4 +74,4 @@ public Db2Configuration(Db2Configuration oldValue, Db2Configuration newValue)
/// Gets the Db2 password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Db2/Db2Container.cs b/src/Testcontainers.Db2/Db2Container.cs
index 660a388d1..fb871864f 100644
--- a/src/Testcontainers.Db2/Db2Container.cs
+++ b/src/Testcontainers.Db2/Db2Container.cs
@@ -6,7 +6,8 @@ public sealed class Db2Container : DockerContainer, IDatabaseContainer
{
private readonly Db2Configuration _configuration;
- public Db2Container(Db2Configuration configuration) : base(configuration)
+ public Db2Container(Db2Configuration configuration)
+ : base(configuration)
{
_configuration = configuration;
}
@@ -22,7 +23,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("UID", _configuration.Username);
properties.Add("PWD", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -31,18 +35,37 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
const string db2ShellCommandFormat = "su - {1} -c \"db2 connect to {0} && db2 -tvf '{2}'\"";
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- var db2ShellCommand = string.Format(db2ShellCommandFormat, _configuration.Database, _configuration.Username, scriptFilePath);
+ var db2ShellCommand = string.Format(
+ db2ShellCommandFormat,
+ _configuration.Database,
+ _configuration.Username,
+ scriptFilePath
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "/bin/sh", "-c", db2ShellCommand}, ct)
+ return await ExecAsync(new[] { "/bin/sh", "-c", db2ShellCommand }, ct)
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Db2/Testcontainers.Db2.csproj b/src/Testcontainers.Db2/Testcontainers.Db2.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Db2/Testcontainers.Db2.csproj
+++ b/src/Testcontainers.Db2/Testcontainers.Db2.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Db2/Usings.cs b/src/Testcontainers.Db2/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.Db2/Usings.cs
+++ b/src/Testcontainers.Db2/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.DynamoDb/DynamoDbBuilder.cs b/src/Testcontainers.DynamoDb/DynamoDbBuilder.cs
index cfd22579f..7e5c29d9e 100644
--- a/src/Testcontainers.DynamoDb/DynamoDbBuilder.cs
+++ b/src/Testcontainers.DynamoDb/DynamoDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.DynamoDb;
///
[PublicAPI]
-public sealed class DynamoDbBuilder : ContainerBuilder
+public sealed class DynamoDbBuilder
+ : ContainerBuilder
{
public const string DynamoDbImage = "amazon/dynamodb-local:1.21.0";
@@ -43,12 +44,21 @@ protected override DynamoDbBuilder Init()
return base.Init()
.WithImage(DynamoDbImage)
.WithPortBinding(DynamoDbPort, true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/").ForPort(DynamoDbPort).ForStatusCode(HttpStatusCode.BadRequest)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request
+ .ForPath("/")
+ .ForPort(DynamoDbPort)
+ .ForStatusCode(HttpStatusCode.BadRequest)
+ )
+ );
}
///
- protected override DynamoDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override DynamoDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new DynamoDbConfiguration(resourceConfiguration));
}
@@ -60,8 +70,11 @@ protected override DynamoDbBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override DynamoDbBuilder Merge(DynamoDbConfiguration oldValue, DynamoDbConfiguration newValue)
+ protected override DynamoDbBuilder Merge(
+ DynamoDbConfiguration oldValue,
+ DynamoDbConfiguration newValue
+ )
{
return new DynamoDbBuilder(new DynamoDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.DynamoDb/DynamoDbConfiguration.cs b/src/Testcontainers.DynamoDb/DynamoDbConfiguration.cs
index ecd7e0aa9..ca3b35cd7 100644
--- a/src/Testcontainers.DynamoDb/DynamoDbConfiguration.cs
+++ b/src/Testcontainers.DynamoDb/DynamoDbConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class DynamoDbConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public DynamoDbConfiguration()
- {
- }
+ public DynamoDbConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public DynamoDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public DynamoDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public DynamoDbConfiguration(DynamoDbConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public DynamoDbConfiguration(DynamoDbConfiguration oldValue, DynamoDbConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.DynamoDb/DynamoDbContainer.cs b/src/Testcontainers.DynamoDb/DynamoDbContainer.cs
index dfd8c4b83..0d16421e0 100644
--- a/src/Testcontainers.DynamoDb/DynamoDbContainer.cs
+++ b/src/Testcontainers.DynamoDb/DynamoDbContainer.cs
@@ -9,9 +9,7 @@ public sealed class DynamoDbContainer : DockerContainer
///
/// The container configuration.
public DynamoDbContainer(DynamoDbConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the DynamoDb connection string.
@@ -19,6 +17,10 @@ public DynamoDbContainer(DynamoDbConfiguration configuration)
/// The DynamoDb connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(DynamoDbBuilder.DynamoDbPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(DynamoDbBuilder.DynamoDbPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.DynamoDb/Testcontainers.DynamoDb.csproj b/src/Testcontainers.DynamoDb/Testcontainers.DynamoDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.DynamoDb/Testcontainers.DynamoDb.csproj
+++ b/src/Testcontainers.DynamoDb/Testcontainers.DynamoDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.DynamoDb/Usings.cs b/src/Testcontainers.DynamoDb/Usings.cs
index 418bc08bd..b82970902 100644
--- a/src/Testcontainers.DynamoDb/Usings.cs
+++ b/src/Testcontainers.DynamoDb/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Elasticsearch/ElasticsearchBuilder.cs b/src/Testcontainers.Elasticsearch/ElasticsearchBuilder.cs
index 39c78bf50..23d6eff89 100644
--- a/src/Testcontainers.Elasticsearch/ElasticsearchBuilder.cs
+++ b/src/Testcontainers.Elasticsearch/ElasticsearchBuilder.cs
@@ -2,13 +2,17 @@ namespace Testcontainers.Elasticsearch;
///
[PublicAPI]
-public sealed class ElasticsearchBuilder : ContainerBuilder
+public sealed class ElasticsearchBuilder
+ : ContainerBuilder
{
- public const string ElasticsearchVmOptionsDirectoryPath = "/usr/share/elasticsearch/config/jvm.options.d/";
+ public const string ElasticsearchVmOptionsDirectoryPath =
+ "/usr/share/elasticsearch/config/jvm.options.d/";
- public const string ElasticsearchDefaultMemoryVmOptionFileName = "elasticsearch-default-memory-vm.options";
+ public const string ElasticsearchDefaultMemoryVmOptionFileName =
+ "elasticsearch-default-memory-vm.options";
- public const string ElasticsearchDefaultMemoryVmOptionFilePath = ElasticsearchVmOptionsDirectoryPath + ElasticsearchDefaultMemoryVmOptionFileName;
+ public const string ElasticsearchDefaultMemoryVmOptionFilePath =
+ ElasticsearchVmOptionsDirectoryPath + ElasticsearchDefaultMemoryVmOptionFileName;
public const string ElasticsearchImage = "elasticsearch:8.6.1";
@@ -20,7 +24,9 @@ public sealed class ElasticsearchBuilder : ContainerBuilder
/// Initializes a new instance of the class.
@@ -51,7 +57,10 @@ private ElasticsearchBuilder(ElasticsearchConfiguration resourceConfiguration)
/// A configured instance of .
public ElasticsearchBuilder WithPassword(string password)
{
- return Merge(DockerResourceConfiguration, new ElasticsearchConfiguration(password: password))
+ return Merge(
+ DockerResourceConfiguration,
+ new ElasticsearchConfiguration(password: password)
+ )
.WithEnvironment("ELASTIC_PASSWORD", password);
}
@@ -82,25 +91,40 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override ElasticsearchBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ElasticsearchBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new ElasticsearchConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ElasticsearchConfiguration(resourceConfiguration)
+ );
}
///
protected override ElasticsearchBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new ElasticsearchConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ElasticsearchConfiguration(resourceConfiguration)
+ );
}
///
- protected override ElasticsearchBuilder Merge(ElasticsearchConfiguration oldValue, ElasticsearchConfiguration newValue)
+ protected override ElasticsearchBuilder Merge(
+ ElasticsearchConfiguration oldValue,
+ ElasticsearchConfiguration newValue
+ )
{
return new ElasticsearchBuilder(new ElasticsearchConfiguration(oldValue, newValue));
}
@@ -115,21 +139,29 @@ protected override ElasticsearchBuilder Merge(ElasticsearchConfiguration oldValu
/// A configured instance of .
private ElasticsearchBuilder WithUsername(string username)
{
- return Merge(DockerResourceConfiguration, new ElasticsearchConfiguration(username: username));
+ return Merge(
+ DockerResourceConfiguration,
+ new ElasticsearchConfiguration(username: username)
+ );
}
///
private sealed class WaitUntil : IWaitUntil
{
- private static readonly IEnumerable Pattern = new[] { "\"message\":\"started", "\"message\": \"started\"" };
+ private static readonly IEnumerable Pattern = new[]
+ {
+ "\"message\":\"started",
+ "\"message\": \"started\"",
+ };
///
public async Task UntilAsync(IContainer container)
{
- var (stdout, _) = await container.GetLogsAsync(since: container.StoppedTime, timestampsEnabled: false)
+ var (stdout, _) = await container
+ .GetLogsAsync(since: container.StoppedTime, timestampsEnabled: false)
.ConfigureAwait(false);
return Pattern.Any(stdout.Contains);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Elasticsearch/ElasticsearchConfiguration.cs b/src/Testcontainers.Elasticsearch/ElasticsearchConfiguration.cs
index 9330ddebd..ae2a12375 100644
--- a/src/Testcontainers.Elasticsearch/ElasticsearchConfiguration.cs
+++ b/src/Testcontainers.Elasticsearch/ElasticsearchConfiguration.cs
@@ -9,9 +9,7 @@ public sealed class ElasticsearchConfiguration : ContainerConfiguration
///
/// The Elasticsearch username.
/// The Elasticsearch password.
- public ElasticsearchConfiguration(
- string username = null,
- string password = null)
+ public ElasticsearchConfiguration(string username = null, string password = null)
{
Username = username;
Password = password;
@@ -21,7 +19,9 @@ public ElasticsearchConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ElasticsearchConfiguration(IResourceConfiguration resourceConfiguration)
+ public ElasticsearchConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -52,7 +52,10 @@ public ElasticsearchConfiguration(ElasticsearchConfiguration resourceConfigurati
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public ElasticsearchConfiguration(ElasticsearchConfiguration oldValue, ElasticsearchConfiguration newValue)
+ public ElasticsearchConfiguration(
+ ElasticsearchConfiguration oldValue,
+ ElasticsearchConfiguration newValue
+ )
: base(oldValue, newValue)
{
Username = BuildConfiguration.Combine(oldValue.Username, newValue.Username);
@@ -68,4 +71,4 @@ public ElasticsearchConfiguration(ElasticsearchConfiguration oldValue, Elasticse
/// Gets the Elasticsearch password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Elasticsearch/ElasticsearchContainer.cs b/src/Testcontainers.Elasticsearch/ElasticsearchContainer.cs
index d924b1866..538ff2170 100644
--- a/src/Testcontainers.Elasticsearch/ElasticsearchContainer.cs
+++ b/src/Testcontainers.Elasticsearch/ElasticsearchContainer.cs
@@ -28,23 +28,31 @@ public ElasticsearchContainer(ElasticsearchConfiguration configuration)
/// The Elasticsearch connection string.
public string GetConnectionString()
{
- var hasSecurityEnabled = _configuration.Environments
- .TryGetValue("xpack.security.enabled", out var securityEnabled);
+ var hasSecurityEnabled = _configuration.Environments.TryGetValue(
+ "xpack.security.enabled",
+ out var securityEnabled
+ );
- var hasHttpSslEnabled = _configuration.Environments
- .TryGetValue("xpack.security.http.ssl.enabled", out var httpSslEnabled);
+ var hasHttpSslEnabled = _configuration.Environments.TryGetValue(
+ "xpack.security.http.ssl.enabled",
+ out var httpSslEnabled
+ );
var httpsDisabled =
- hasSecurityEnabled &&
- hasHttpSslEnabled &&
- "false".Equals(securityEnabled, StringComparison.OrdinalIgnoreCase) &&
- "false".Equals(httpSslEnabled, StringComparison.OrdinalIgnoreCase);
+ hasSecurityEnabled
+ && hasHttpSslEnabled
+ && "false".Equals(securityEnabled, StringComparison.OrdinalIgnoreCase)
+ && "false".Equals(httpSslEnabled, StringComparison.OrdinalIgnoreCase);
var scheme = httpsDisabled ? Uri.UriSchemeHttp : Uri.UriSchemeHttps;
- var endpoint = new UriBuilder(scheme, Hostname, GetMappedPublicPort(ElasticsearchBuilder.ElasticsearchHttpsPort));
+ var endpoint = new UriBuilder(
+ scheme,
+ Hostname,
+ GetMappedPublicPort(ElasticsearchBuilder.ElasticsearchHttpsPort)
+ );
endpoint.UserName = _configuration.Username;
endpoint.Password = _configuration.Password;
return endpoint.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Elasticsearch/Testcontainers.Elasticsearch.csproj b/src/Testcontainers.Elasticsearch/Testcontainers.Elasticsearch.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Elasticsearch/Testcontainers.Elasticsearch.csproj
+++ b/src/Testcontainers.Elasticsearch/Testcontainers.Elasticsearch.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Elasticsearch/Usings.cs b/src/Testcontainers.Elasticsearch/Usings.cs
index 292302742..79361176a 100644
--- a/src/Testcontainers.Elasticsearch/Usings.cs
+++ b/src/Testcontainers.Elasticsearch/Usings.cs
@@ -8,4 +8,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.EventHubs/EventHubsBuilder.cs b/src/Testcontainers.EventHubs/EventHubsBuilder.cs
index 87b207531..3a05655e1 100644
--- a/src/Testcontainers.EventHubs/EventHubsBuilder.cs
+++ b/src/Testcontainers.EventHubs/EventHubsBuilder.cs
@@ -2,13 +2,15 @@ namespace Testcontainers.EventHubs;
///
[PublicAPI]
-public sealed class EventHubsBuilder : ContainerBuilder
+public sealed class EventHubsBuilder
+ : ContainerBuilder
{
public const string EventHubsNetworkAlias = "eventhubs-container";
public const string AzuriteNetworkAlias = "azurite-container";
- public const string EventHubsImage = "mcr.microsoft.com/azure-messaging/eventhubs-emulator:latest";
+ public const string EventHubsImage =
+ "mcr.microsoft.com/azure-messaging/eventhubs-emulator:latest";
public const ushort EventHubsPort = 5672;
@@ -55,7 +57,9 @@ private EventHubsBuilder(EventHubsConfiguration resourceConfiguration)
/// A configured instance of .
public override EventHubsBuilder WithAcceptLicenseAgreement(bool acceptLicenseAgreement)
{
- var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement;
+ var licenseAgreement = acceptLicenseAgreement
+ ? AcceptLicenseAgreement
+ : DeclineLicenseAgreement;
return WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
}
@@ -74,9 +78,13 @@ public override EventHubsBuilder WithAcceptLicenseAgreement(bool acceptLicenseAg
public EventHubsBuilder WithAzuriteContainer(
INetwork network,
AzuriteContainer container,
- string networkAlias)
+ string networkAlias
+ )
{
- return Merge(DockerResourceConfiguration, new EventHubsConfiguration(azuriteContainer: container))
+ return Merge(
+ DockerResourceConfiguration,
+ new EventHubsConfiguration(azuriteContainer: container)
+ )
.DependsOn(container)
.WithNetwork(network)
.WithNetworkAliases(EventHubsNetworkAlias)
@@ -89,10 +97,15 @@ public EventHubsBuilder WithAzuriteContainer(
///
/// The service configuration.
/// A configured instance of .
- public EventHubsBuilder WithConfigurationBuilder(EventHubsServiceConfiguration serviceConfiguration)
+ public EventHubsBuilder WithConfigurationBuilder(
+ EventHubsServiceConfiguration serviceConfiguration
+ )
{
var resourceContent = Encoding.Default.GetBytes(serviceConfiguration.Build());
- return Merge(DockerResourceConfiguration, new EventHubsConfiguration(serviceConfiguration: serviceConfiguration))
+ return Merge(
+ DockerResourceConfiguration,
+ new EventHubsConfiguration(serviceConfiguration: serviceConfiguration)
+ )
.WithResourceMapping(resourceContent, "Eventhubs_Emulator/ConfigFiles/Config.json");
}
@@ -109,8 +122,7 @@ public override EventHubsContainer Build()
// If the user has not provided an existing Azurite container instance,
// we configure one.
- var network = new NetworkBuilder()
- .Build();
+ var network = new NetworkBuilder().Build();
var container = new AzuriteBuilder()
.WithNetwork(network)
@@ -126,9 +138,19 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.ServiceConfiguration, nameof(DockerResourceConfiguration.ServiceConfiguration))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.ServiceConfiguration,
+ nameof(DockerResourceConfiguration.ServiceConfiguration)
+ )
.NotNull()
- .ThrowIf(argument => !argument.Value.Validate(), _ => throw new ArgumentException("The service configuration of the Azure Event Hubs Emulator is invalid."));
+ .ThrowIf(
+ argument => !argument.Value.Validate(),
+ _ =>
+ throw new ArgumentException(
+ "The service configuration of the Azure Event Hubs Emulator is invalid."
+ )
+ );
}
///
@@ -138,25 +160,40 @@ protected override EventHubsBuilder Init()
.WithImage(EventHubsImage)
.WithPortBinding(EventHubsPort, true)
.WithPortBinding(EventHubsHttpPort, true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(EventHubsHttpPort).ForPath("/health")));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPort(EventHubsHttpPort).ForPath("/health")
+ )
+ );
}
///
- protected override EventHubsBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override EventHubsBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new EventHubsConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new EventHubsConfiguration(resourceConfiguration)
+ );
}
///
protected override EventHubsBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new EventHubsConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new EventHubsConfiguration(resourceConfiguration)
+ );
}
///
- protected override EventHubsBuilder Merge(EventHubsConfiguration oldValue, EventHubsConfiguration newValue)
+ protected override EventHubsBuilder Merge(
+ EventHubsConfiguration oldValue,
+ EventHubsConfiguration newValue
+ )
{
return new EventHubsBuilder(new EventHubsConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.EventHubs/EventHubsConfiguration.cs b/src/Testcontainers.EventHubs/EventHubsConfiguration.cs
index 76c57ecbb..0ecf861dc 100644
--- a/src/Testcontainers.EventHubs/EventHubsConfiguration.cs
+++ b/src/Testcontainers.EventHubs/EventHubsConfiguration.cs
@@ -9,8 +9,10 @@ public sealed class EventHubsConfiguration : ContainerConfiguration
///
/// The Azurite container.
/// The service configuration.
- public EventHubsConfiguration(AzuriteContainer azuriteContainer = null,
- EventHubsServiceConfiguration serviceConfiguration = null)
+ public EventHubsConfiguration(
+ AzuriteContainer azuriteContainer = null,
+ EventHubsServiceConfiguration serviceConfiguration = null
+ )
{
AzuriteContainer = azuriteContainer;
ServiceConfiguration = serviceConfiguration;
@@ -20,7 +22,9 @@ public EventHubsConfiguration(AzuriteContainer azuriteContainer = null,
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public EventHubsConfiguration(IResourceConfiguration resourceConfiguration)
+ public EventHubsConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -54,8 +58,14 @@ public EventHubsConfiguration(EventHubsConfiguration resourceConfiguration)
public EventHubsConfiguration(EventHubsConfiguration oldValue, EventHubsConfiguration newValue)
: base(oldValue, newValue)
{
- AzuriteContainer = BuildConfiguration.Combine(oldValue.AzuriteContainer, newValue.AzuriteContainer);
- ServiceConfiguration = BuildConfiguration.Combine(oldValue.ServiceConfiguration, newValue.ServiceConfiguration);
+ AzuriteContainer = BuildConfiguration.Combine(
+ oldValue.AzuriteContainer,
+ newValue.AzuriteContainer
+ );
+ ServiceConfiguration = BuildConfiguration.Combine(
+ oldValue.ServiceConfiguration,
+ newValue.ServiceConfiguration
+ );
}
///
@@ -67,4 +77,4 @@ public EventHubsConfiguration(EventHubsConfiguration oldValue, EventHubsConfigur
/// Gets the service configuration.
///
public EventHubsServiceConfiguration ServiceConfiguration { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.EventHubs/EventHubsContainer.cs b/src/Testcontainers.EventHubs/EventHubsContainer.cs
index 9b7259d73..9100cde46 100644
--- a/src/Testcontainers.EventHubs/EventHubsContainer.cs
+++ b/src/Testcontainers.EventHubs/EventHubsContainer.cs
@@ -9,9 +9,7 @@ public sealed class EventHubsContainer : DockerContainer
///
/// The container configuration.
public EventHubsContainer(EventHubsConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Event Hubs connection string.
@@ -20,11 +18,21 @@ public EventHubsContainer(EventHubsConfiguration configuration)
public string GetConnectionString()
{
var properties = new Dictionary();
- properties.Add("Endpoint", new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(EventHubsBuilder.EventHubsPort)).ToString());
+ properties.Add(
+ "Endpoint",
+ new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(EventHubsBuilder.EventHubsPort)
+ ).ToString()
+ );
properties.Add("DefaultEndpointsProtocol", Uri.UriSchemeHttp);
properties.Add("SharedAccessKeyName", "RootManageSharedAccessKey");
properties.Add("SharedAccessKey", "SAS_KEY_VALUE");
properties.Add("UseDevelopmentEmulator", "true");
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.EventHubs/EventHubsServiceConfiguration.cs b/src/Testcontainers.EventHubs/EventHubsServiceConfiguration.cs
index 1a499f25d..20a27be66 100644
--- a/src/Testcontainers.EventHubs/EventHubsServiceConfiguration.cs
+++ b/src/Testcontainers.EventHubs/EventHubsServiceConfiguration.cs
@@ -7,7 +7,10 @@ public record RootConfiguration(UserConfig UserConfig)
}
[PublicAPI]
-public record UserConfig(IReadOnlyCollection NamespaceConfig, LoggingConfig LoggingConfig)
+public record UserConfig(
+ IReadOnlyCollection NamespaceConfig,
+ LoggingConfig LoggingConfig
+)
{
public IReadOnlyCollection NamespaceConfig { get; } = NamespaceConfig;
@@ -25,7 +28,11 @@ public record NamespaceConfig(string Type, string Name, IReadOnlyCollection ConsumerGroups)
+public record Entity(
+ string Name,
+ int PartitionCount,
+ IReadOnlyCollection ConsumerGroups
+)
{
public string Name { get; } = Name;
@@ -62,33 +69,64 @@ public static EventHubsServiceConfiguration Create()
return new EventHubsServiceConfiguration(namespaceConfig);
}
- public EventHubsServiceConfiguration WithEntity(string name, int partitionCount, params string[] consumerGroupNames)
+ public EventHubsServiceConfiguration WithEntity(
+ string name,
+ int partitionCount,
+ params string[] consumerGroupNames
+ )
{
// Filter out the consumer group name `$default` because the `$default` group
// is created automatically by the container image.
- var validConsumerGroupNames = consumerGroupNames.Where(consumerGroupName => !"$Default".Equals(consumerGroupName, StringComparison.OrdinalIgnoreCase)).ToList();
- return WithEntity(name, partitionCount, new ReadOnlyCollection(validConsumerGroupNames));
+ var validConsumerGroupNames = consumerGroupNames
+ .Where(consumerGroupName =>
+ !"$Default".Equals(consumerGroupName, StringComparison.OrdinalIgnoreCase)
+ )
+ .ToList();
+ return WithEntity(
+ name,
+ partitionCount,
+ new ReadOnlyCollection(validConsumerGroupNames)
+ );
}
- public EventHubsServiceConfiguration WithEntity(string name, int partitionCount, IEnumerable consumerGroupNames)
+ public EventHubsServiceConfiguration WithEntity(
+ string name,
+ int partitionCount,
+ IEnumerable consumerGroupNames
+ )
{
- var consumerGroups = new ReadOnlyCollection(consumerGroupNames.Select(consumerGroupName => new ConsumerGroup(consumerGroupName)).ToList());
+ var consumerGroups = new ReadOnlyCollection(
+ consumerGroupNames
+ .Select(consumerGroupName => new ConsumerGroup(consumerGroupName))
+ .ToList()
+ );
var entity = new Entity(name, partitionCount, consumerGroups);
- var entities = new ReadOnlyCollection(_namespaceConfig.Entities.Append(entity).ToList());
- return new EventHubsServiceConfiguration(new NamespaceConfig(_namespaceConfig.Type, _namespaceConfig.Name, entities));
+ var entities = new ReadOnlyCollection(
+ _namespaceConfig.Entities.Append(entity).ToList()
+ );
+ return new EventHubsServiceConfiguration(
+ new NamespaceConfig(_namespaceConfig.Type, _namespaceConfig.Name, entities)
+ );
}
public bool Validate()
{
// The emulator provides the usage quotas as described at:
// https://learn.microsoft.com/en-us/azure/event-hubs/overview-emulator#usage-quotas.
- Predicate isValidEntity = entity => entity.PartitionCount > 0 && entity.PartitionCount <= 32 && entity.ConsumerGroups.Count <= 20;
- return _namespaceConfig.Entities.Count > 0 && _namespaceConfig.Entities.Count <= 10 && _namespaceConfig.Entities.All(entity => isValidEntity(entity));
+ Predicate isValidEntity = entity =>
+ entity.PartitionCount > 0
+ && entity.PartitionCount <= 32
+ && entity.ConsumerGroups.Count <= 20;
+ return _namespaceConfig.Entities.Count > 0
+ && _namespaceConfig.Entities.Count <= 10
+ && _namespaceConfig.Entities.All(entity => isValidEntity(entity));
}
public string Build()
{
- var rootConfiguration = new RootConfiguration(new UserConfig([_namespaceConfig], new LoggingConfig("file")));
+ var rootConfiguration = new RootConfiguration(
+ new UserConfig([_namespaceConfig], new LoggingConfig("file"))
+ );
return JsonSerializer.Serialize(rootConfiguration);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.EventHubs/Testcontainers.EventHubs.csproj b/src/Testcontainers.EventHubs/Testcontainers.EventHubs.csproj
index 643fdade3..355bd57b2 100644
--- a/src/Testcontainers.EventHubs/Testcontainers.EventHubs.csproj
+++ b/src/Testcontainers.EventHubs/Testcontainers.EventHubs.csproj
@@ -1,13 +1,17 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.EventHubs/Usings.cs b/src/Testcontainers.EventHubs/Usings.cs
index aac442571..1d2b6d437 100644
--- a/src/Testcontainers.EventHubs/Usings.cs
+++ b/src/Testcontainers.EventHubs/Usings.cs
@@ -11,4 +11,4 @@
global using DotNet.Testcontainers.Containers;
global using DotNet.Testcontainers.Networks;
global using JetBrains.Annotations;
-global using Testcontainers.Azurite;
\ No newline at end of file
+global using Testcontainers.Azurite;
diff --git a/src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs b/src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs
index 6e73a3886..f876a8564 100644
--- a/src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs
+++ b/src/Testcontainers.EventStoreDb/EventStoreDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.EventStoreDb;
///
[PublicAPI]
-public sealed class EventStoreDbBuilder : ContainerBuilder
+public sealed class EventStoreDbBuilder
+ : ContainerBuilder
{
public const string EventStoreDbImage = "eventstore/eventstore:22.10.1-buster-slim";
@@ -50,20 +51,31 @@ protected override EventStoreDbBuilder Init()
}
///
- protected override EventStoreDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override EventStoreDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new EventStoreDbConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new EventStoreDbConfiguration(resourceConfiguration)
+ );
}
///
protected override EventStoreDbBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new EventStoreDbConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new EventStoreDbConfiguration(resourceConfiguration)
+ );
}
///
- protected override EventStoreDbBuilder Merge(EventStoreDbConfiguration oldValue, EventStoreDbConfiguration newValue)
+ protected override EventStoreDbBuilder Merge(
+ EventStoreDbConfiguration oldValue,
+ EventStoreDbConfiguration newValue
+ )
{
return new EventStoreDbBuilder(new EventStoreDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.EventStoreDb/EventStoreDbConfiguration.cs b/src/Testcontainers.EventStoreDb/EventStoreDbConfiguration.cs
index c19cd06ba..3dd2e357c 100644
--- a/src/Testcontainers.EventStoreDb/EventStoreDbConfiguration.cs
+++ b/src/Testcontainers.EventStoreDb/EventStoreDbConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class EventStoreDbConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public EventStoreDbConfiguration()
- {
- }
+ public EventStoreDbConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public EventStoreDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public EventStoreDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -46,8 +46,9 @@ public EventStoreDbConfiguration(EventStoreDbConfiguration resourceConfiguration
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public EventStoreDbConfiguration(EventStoreDbConfiguration oldValue, EventStoreDbConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ public EventStoreDbConfiguration(
+ EventStoreDbConfiguration oldValue,
+ EventStoreDbConfiguration newValue
+ )
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.EventStoreDb/EventStoreDbContainer.cs b/src/Testcontainers.EventStoreDb/EventStoreDbContainer.cs
index 6d0ddc347..1ddaa7b92 100644
--- a/src/Testcontainers.EventStoreDb/EventStoreDbContainer.cs
+++ b/src/Testcontainers.EventStoreDb/EventStoreDbContainer.cs
@@ -9,9 +9,7 @@ public sealed class EventStoreDbContainer : DockerContainer
///
/// The container configuration.
public EventStoreDbContainer(EventStoreDbConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the EventStoreDb connection string.
@@ -19,8 +17,12 @@ public EventStoreDbContainer(EventStoreDbConfiguration configuration)
/// The EventStoreDb connection string.
public string GetConnectionString()
{
- var endpoint = new UriBuilder("esdb", Hostname, GetMappedPublicPort(EventStoreDbBuilder.EventStoreDbPort));
+ var endpoint = new UriBuilder(
+ "esdb",
+ Hostname,
+ GetMappedPublicPort(EventStoreDbBuilder.EventStoreDbPort)
+ );
endpoint.Query = "tls=false";
return endpoint.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.EventStoreDb/Testcontainers.EventStoreDb.csproj b/src/Testcontainers.EventStoreDb/Testcontainers.EventStoreDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.EventStoreDb/Testcontainers.EventStoreDb.csproj
+++ b/src/Testcontainers.EventStoreDb/Testcontainers.EventStoreDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.EventStoreDb/Usings.cs b/src/Testcontainers.EventStoreDb/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.EventStoreDb/Usings.cs
+++ b/src/Testcontainers.EventStoreDb/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.FakeGcsServer/FakeGcsServerBuilder.cs b/src/Testcontainers.FakeGcsServer/FakeGcsServerBuilder.cs
index d253da5fa..1707ec82a 100644
--- a/src/Testcontainers.FakeGcsServer/FakeGcsServerBuilder.cs
+++ b/src/Testcontainers.FakeGcsServer/FakeGcsServerBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.FakeGcsServer;
///
[PublicAPI]
-public sealed class FakeGcsServerBuilder : ContainerBuilder
+public sealed class FakeGcsServerBuilder
+ : ContainerBuilder
{
public const string FakeGcsServerImage = "fsouza/fake-gcs-server:1.47";
@@ -46,40 +47,72 @@ protected override FakeGcsServerBuilder Init()
.WithImage(FakeGcsServerImage)
.WithPortBinding(FakeGcsServerPort, true)
.WithEntrypoint("/bin/sh", "-c")
- .WithCommand("while [ ! -f " + StartupScriptFilePath + " ]; do sleep 0.1; done; " + StartupScriptFilePath)
+ .WithCommand(
+ "while [ ! -f "
+ + StartupScriptFilePath
+ + " ]; do sleep 0.1; done; "
+ + StartupScriptFilePath
+ )
.WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("server started"))
- .WithStartupCallback((container, ct) =>
- {
- const char lf = '\n';
- var startupScript = new StringBuilder();
- startupScript.Append("#!/bin/sh");
- startupScript.Append(lf);
- startupScript.Append("fake-gcs-server ");
- startupScript.Append("-backend memory ");
- startupScript.Append("-scheme http ");
- // If we do not remove the trailing slash, uploading an object will result in an
- // error: HttpStatusCode.NotFound. The HTTP request appears incorrect. The
- // container logs indicate the presence of an extra slash: `PUT //upload/storage/v1`.
- startupScript.Append("-external-url " + new UriBuilder(Uri.UriSchemeHttp, container.Hostname, container.GetMappedPublicPort(FakeGcsServerPort)).ToString().Trim('/'));
- return container.CopyAsync(Encoding.Default.GetBytes(startupScript.ToString()), StartupScriptFilePath, Unix.FileMode755, ct);
- });
+ .WithStartupCallback(
+ (container, ct) =>
+ {
+ const char lf = '\n';
+ var startupScript = new StringBuilder();
+ startupScript.Append("#!/bin/sh");
+ startupScript.Append(lf);
+ startupScript.Append("fake-gcs-server ");
+ startupScript.Append("-backend memory ");
+ startupScript.Append("-scheme http ");
+ // If we do not remove the trailing slash, uploading an object will result in an
+ // error: HttpStatusCode.NotFound. The HTTP request appears incorrect. The
+ // container logs indicate the presence of an extra slash: `PUT //upload/storage/v1`.
+ startupScript.Append(
+ "-external-url "
+ + new UriBuilder(
+ Uri.UriSchemeHttp,
+ container.Hostname,
+ container.GetMappedPublicPort(FakeGcsServerPort)
+ )
+ .ToString()
+ .Trim('/')
+ );
+ return container.CopyAsync(
+ Encoding.Default.GetBytes(startupScript.ToString()),
+ StartupScriptFilePath,
+ Unix.FileMode755,
+ ct
+ );
+ }
+ );
}
///
- protected override FakeGcsServerBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override FakeGcsServerBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new FakeGcsServerConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new FakeGcsServerConfiguration(resourceConfiguration)
+ );
}
///
protected override FakeGcsServerBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new FakeGcsServerConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new FakeGcsServerConfiguration(resourceConfiguration)
+ );
}
///
- protected override FakeGcsServerBuilder Merge(FakeGcsServerConfiguration oldValue, FakeGcsServerConfiguration newValue)
+ protected override FakeGcsServerBuilder Merge(
+ FakeGcsServerConfiguration oldValue,
+ FakeGcsServerConfiguration newValue
+ )
{
return new FakeGcsServerBuilder(new FakeGcsServerConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.FakeGcsServer/FakeGcsServerConfiguration.cs b/src/Testcontainers.FakeGcsServer/FakeGcsServerConfiguration.cs
index b9c4ffe16..718e48ec6 100644
--- a/src/Testcontainers.FakeGcsServer/FakeGcsServerConfiguration.cs
+++ b/src/Testcontainers.FakeGcsServer/FakeGcsServerConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class FakeGcsServerConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public FakeGcsServerConfiguration()
- {
- }
+ public FakeGcsServerConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public FakeGcsServerConfiguration(IResourceConfiguration resourceConfiguration)
+ public FakeGcsServerConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -46,8 +46,9 @@ public FakeGcsServerConfiguration(FakeGcsServerConfiguration resourceConfigurati
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public FakeGcsServerConfiguration(FakeGcsServerConfiguration oldValue, FakeGcsServerConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ public FakeGcsServerConfiguration(
+ FakeGcsServerConfiguration oldValue,
+ FakeGcsServerConfiguration newValue
+ )
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.FakeGcsServer/FakeGcsServerContainer.cs b/src/Testcontainers.FakeGcsServer/FakeGcsServerContainer.cs
index 8eb31f3ca..b3c9e0c79 100644
--- a/src/Testcontainers.FakeGcsServer/FakeGcsServerContainer.cs
+++ b/src/Testcontainers.FakeGcsServer/FakeGcsServerContainer.cs
@@ -9,9 +9,7 @@ public sealed class FakeGcsServerContainer : DockerContainer
///
/// The container configuration.
public FakeGcsServerContainer(FakeGcsServerConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the FakeGcsServer connection string.
@@ -19,6 +17,11 @@ public FakeGcsServerContainer(FakeGcsServerConfiguration configuration)
/// The FakeGcsServer connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(FakeGcsServerBuilder.FakeGcsServerPort), "/storage/v1/").ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(FakeGcsServerBuilder.FakeGcsServerPort),
+ "/storage/v1/"
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.FakeGcsServer/Testcontainers.FakeGcsServer.csproj b/src/Testcontainers.FakeGcsServer/Testcontainers.FakeGcsServer.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.FakeGcsServer/Testcontainers.FakeGcsServer.csproj
+++ b/src/Testcontainers.FakeGcsServer/Testcontainers.FakeGcsServer.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.FakeGcsServer/Usings.cs b/src/Testcontainers.FakeGcsServer/Usings.cs
index 4ee39f0be..1734e5e13 100644
--- a/src/Testcontainers.FakeGcsServer/Usings.cs
+++ b/src/Testcontainers.FakeGcsServer/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.FirebirdSql/FirebirdSqlBuilder.cs b/src/Testcontainers.FirebirdSql/FirebirdSqlBuilder.cs
index fb1f42795..945dd9cb2 100644
--- a/src/Testcontainers.FirebirdSql/FirebirdSqlBuilder.cs
+++ b/src/Testcontainers.FirebirdSql/FirebirdSqlBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.FirebirdSql;
///
[PublicAPI]
-public sealed class FirebirdSqlBuilder : ContainerBuilder
+public sealed class FirebirdSqlBuilder
+ : ContainerBuilder
{
public const string FirebirdSqlImage = "jacobalberty/firebird:v4.0";
@@ -59,7 +60,12 @@ public FirebirdSqlBuilder WithDatabase(string database)
public FirebirdSqlBuilder WithUsername(string username)
{
return Merge(DockerResourceConfiguration, new FirebirdSqlConfiguration(username: username))
- .WithEnvironment("FIREBIRD_USER", "sysdba".Equals(username, StringComparison.OrdinalIgnoreCase) ? string.Empty : username);
+ .WithEnvironment(
+ "FIREBIRD_USER",
+ "sysdba".Equals(username, StringComparison.OrdinalIgnoreCase)
+ ? string.Empty
+ : username
+ );
}
///
@@ -90,7 +96,10 @@ protected override FirebirdSqlBuilder Init()
.WithDatabase(DefaultDatabase)
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithResourceMapping(Encoding.Default.GetBytes(TestQueryString), "/home/firebird_check.sql")
+ .WithResourceMapping(
+ Encoding.Default.GetBytes(TestQueryString),
+ "/home/firebird_check.sql"
+ )
.WithWaitStrategy(Wait.ForUnixContainer().UntilContainerIsHealthy());
}
@@ -99,26 +108,41 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override FirebirdSqlBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override FirebirdSqlBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new FirebirdSqlConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new FirebirdSqlConfiguration(resourceConfiguration)
+ );
}
///
protected override FirebirdSqlBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new FirebirdSqlConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new FirebirdSqlConfiguration(resourceConfiguration)
+ );
}
///
- protected override FirebirdSqlBuilder Merge(FirebirdSqlConfiguration oldValue, FirebirdSqlConfiguration newValue)
+ protected override FirebirdSqlBuilder Merge(
+ FirebirdSqlConfiguration oldValue,
+ FirebirdSqlConfiguration newValue
+ )
{
return new FirebirdSqlBuilder(new FirebirdSqlConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.FirebirdSql/FirebirdSqlConfiguration.cs b/src/Testcontainers.FirebirdSql/FirebirdSqlConfiguration.cs
index c01064efc..ddfad7726 100644
--- a/src/Testcontainers.FirebirdSql/FirebirdSqlConfiguration.cs
+++ b/src/Testcontainers.FirebirdSql/FirebirdSqlConfiguration.cs
@@ -15,7 +15,8 @@ public sealed class FirebirdSqlConfiguration : ContainerConfiguration
public FirebirdSqlConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
_database = database;
Username = username;
@@ -26,7 +27,9 @@ public FirebirdSqlConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public FirebirdSqlConfiguration(IResourceConfiguration resourceConfiguration)
+ public FirebirdSqlConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -57,7 +60,10 @@ public FirebirdSqlConfiguration(FirebirdSqlConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public FirebirdSqlConfiguration(FirebirdSqlConfiguration oldValue, FirebirdSqlConfiguration newValue)
+ public FirebirdSqlConfiguration(
+ FirebirdSqlConfiguration oldValue,
+ FirebirdSqlConfiguration newValue
+ )
: base(oldValue, newValue)
{
_database = BuildConfiguration.Combine(oldValue._database, newValue._database);
@@ -68,7 +74,10 @@ public FirebirdSqlConfiguration(FirebirdSqlConfiguration oldValue, FirebirdSqlCo
///
/// Gets the FirebirdSql database.
///
- public string Database => Image.Tag != null && (Image.Tag.StartsWith("2.5") || Image.Tag.StartsWith("v2.5")) ? string.Join("/", "/firebird/data", _database) : _database;
+ public string Database =>
+ Image.Tag != null && (Image.Tag.StartsWith("2.5") || Image.Tag.StartsWith("v2.5"))
+ ? string.Join("/", "/firebird/data", _database)
+ : _database;
///
/// Gets the FirebirdSql username.
@@ -79,4 +88,4 @@ public FirebirdSqlConfiguration(FirebirdSqlConfiguration oldValue, FirebirdSqlCo
/// Gets the FirebirdSql password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.FirebirdSql/FirebirdSqlContainer.cs b/src/Testcontainers.FirebirdSql/FirebirdSqlContainer.cs
index 0c5538fe0..781804206 100644
--- a/src/Testcontainers.FirebirdSql/FirebirdSqlContainer.cs
+++ b/src/Testcontainers.FirebirdSql/FirebirdSqlContainer.cs
@@ -28,7 +28,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("User", _configuration.Username);
properties.Add("Password", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -37,14 +40,41 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "/usr/local/firebird/bin/isql", "-i", scriptFilePath, "-user", _configuration.Username, "-pass", _configuration.Password, _configuration.Database }, ct)
+ return await ExecAsync(
+ new[]
+ {
+ "/usr/local/firebird/bin/isql",
+ "-i",
+ scriptFilePath,
+ "-user",
+ _configuration.Username,
+ "-pass",
+ _configuration.Password,
+ _configuration.Database,
+ },
+ ct
+ )
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.FirebirdSql/Testcontainers.FirebirdSql.csproj b/src/Testcontainers.FirebirdSql/Testcontainers.FirebirdSql.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.FirebirdSql/Testcontainers.FirebirdSql.csproj
+++ b/src/Testcontainers.FirebirdSql/Testcontainers.FirebirdSql.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.FirebirdSql/Usings.cs b/src/Testcontainers.FirebirdSql/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.FirebirdSql/Usings.cs
+++ b/src/Testcontainers.FirebirdSql/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Firestore/FirestoreBuilder.cs b/src/Testcontainers.Firestore/FirestoreBuilder.cs
index 74ff2e38d..abdcd102f 100644
--- a/src/Testcontainers.Firestore/FirestoreBuilder.cs
+++ b/src/Testcontainers.Firestore/FirestoreBuilder.cs
@@ -2,9 +2,11 @@ namespace Testcontainers.Firestore;
///
[PublicAPI]
-public sealed class FirestoreBuilder : ContainerBuilder
+public sealed class FirestoreBuilder
+ : ContainerBuilder
{
- public const string GoogleCloudCliImage = "gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators";
+ public const string GoogleCloudCliImage =
+ "gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators";
public const ushort FirestorePort = 8080;
@@ -44,25 +46,43 @@ protected override FirestoreBuilder Init()
.WithImage(GoogleCloudCliImage)
.WithPortBinding(FirestorePort, true)
.WithEntrypoint("gcloud")
- .WithCommand("beta", "emulators", "firestore", "start", "--host-port", "0.0.0.0:" + FirestorePort)
+ .WithCommand(
+ "beta",
+ "emulators",
+ "firestore",
+ "start",
+ "--host-port",
+ "0.0.0.0:" + FirestorePort
+ )
.WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("(?s).*running.*$"));
}
///
- protected override FirestoreBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override FirestoreBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new FirestoreConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new FirestoreConfiguration(resourceConfiguration)
+ );
}
///
protected override FirestoreBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new FirestoreConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new FirestoreConfiguration(resourceConfiguration)
+ );
}
///
- protected override FirestoreBuilder Merge(FirestoreConfiguration oldValue, FirestoreConfiguration newValue)
+ protected override FirestoreBuilder Merge(
+ FirestoreConfiguration oldValue,
+ FirestoreConfiguration newValue
+ )
{
return new FirestoreBuilder(new FirestoreConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Firestore/FirestoreConfiguration.cs b/src/Testcontainers.Firestore/FirestoreConfiguration.cs
index 91fbd7836..e91fcc07a 100644
--- a/src/Testcontainers.Firestore/FirestoreConfiguration.cs
+++ b/src/Testcontainers.Firestore/FirestoreConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class FirestoreConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public FirestoreConfiguration()
- {
- }
+ public FirestoreConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public FirestoreConfiguration(IResourceConfiguration resourceConfiguration)
+ public FirestoreConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public FirestoreConfiguration(FirestoreConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public FirestoreConfiguration(FirestoreConfiguration oldValue, FirestoreConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Firestore/FirestoreContainer.cs b/src/Testcontainers.Firestore/FirestoreContainer.cs
index 2c90e42e5..ee0e4e415 100644
--- a/src/Testcontainers.Firestore/FirestoreContainer.cs
+++ b/src/Testcontainers.Firestore/FirestoreContainer.cs
@@ -9,9 +9,7 @@ public sealed class FirestoreContainer : DockerContainer
///
/// The container configuration.
public FirestoreContainer(FirestoreConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Firestore emulator endpoint.
@@ -19,6 +17,10 @@ public FirestoreContainer(FirestoreConfiguration configuration)
/// The Firestore emulator endpoint.
public string GetEmulatorEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(FirestoreBuilder.FirestorePort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(FirestoreBuilder.FirestorePort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Firestore/Testcontainers.Firestore.csproj b/src/Testcontainers.Firestore/Testcontainers.Firestore.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Firestore/Testcontainers.Firestore.csproj
+++ b/src/Testcontainers.Firestore/Testcontainers.Firestore.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Firestore/Usings.cs b/src/Testcontainers.Firestore/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.Firestore/Usings.cs
+++ b/src/Testcontainers.Firestore/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.GCloud/Testcontainers.GCloud.csproj b/src/Testcontainers.GCloud/Testcontainers.GCloud.csproj
index 2c527d992..3c6f0ca97 100644
--- a/src/Testcontainers.GCloud/Testcontainers.GCloud.csproj
+++ b/src/Testcontainers.GCloud/Testcontainers.GCloud.csproj
@@ -1,12 +1,12 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.InfluxDb/InfluxDbBuilder.cs b/src/Testcontainers.InfluxDb/InfluxDbBuilder.cs
index de01dbabd..999c50cee 100644
--- a/src/Testcontainers.InfluxDb/InfluxDbBuilder.cs
+++ b/src/Testcontainers.InfluxDb/InfluxDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.InfluxDb;
///
[PublicAPI]
-public sealed class InfluxDbBuilder : ContainerBuilder
+public sealed class InfluxDbBuilder
+ : ContainerBuilder
{
public const string InfluxDbImage = "influxdb:2.7";
@@ -67,7 +68,10 @@ public InfluxDbBuilder WithPassword(string password)
/// A configured instance of .
public InfluxDbBuilder WithOrganization(string organization)
{
- return Merge(DockerResourceConfiguration, new InfluxDbConfiguration(organization: organization))
+ return Merge(
+ DockerResourceConfiguration,
+ new InfluxDbConfiguration(organization: organization)
+ )
.WithEnvironment("DOCKER_INFLUXDB_INIT_ORG", organization);
}
@@ -122,8 +126,15 @@ protected override InfluxDbBuilder Init()
.WithPassword(DefaultPassword)
.WithOrganization(DefaultOrganization)
.WithBucket(DefaultBucket)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(InfluxDbPort).ForPath("/ping").ForStatusCode(HttpStatusCode.NoContent)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request
+ .ForPort(InfluxDbPort)
+ .ForPath("/ping")
+ .ForStatusCode(HttpStatusCode.NoContent)
+ )
+ );
}
///
@@ -131,25 +142,43 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Organization, nameof(DockerResourceConfiguration.Organization))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Organization,
+ nameof(DockerResourceConfiguration.Organization)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Bucket, nameof(DockerResourceConfiguration.Bucket))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Bucket,
+ nameof(DockerResourceConfiguration.Bucket)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override InfluxDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override InfluxDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new InfluxDbConfiguration(resourceConfiguration));
}
@@ -161,8 +190,11 @@ protected override InfluxDbBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override InfluxDbBuilder Merge(InfluxDbConfiguration oldValue, InfluxDbConfiguration newValue)
+ protected override InfluxDbBuilder Merge(
+ InfluxDbConfiguration oldValue,
+ InfluxDbConfiguration newValue
+ )
{
return new InfluxDbBuilder(new InfluxDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.InfluxDb/InfluxDbConfiguration.cs b/src/Testcontainers.InfluxDb/InfluxDbConfiguration.cs
index 68eb29dc4..8725f0d2f 100644
--- a/src/Testcontainers.InfluxDb/InfluxDbConfiguration.cs
+++ b/src/Testcontainers.InfluxDb/InfluxDbConfiguration.cs
@@ -19,7 +19,8 @@ public InfluxDbConfiguration(
string organization = null,
string bucket = null,
string adminToken = null,
- string retention = null)
+ string retention = null
+ )
{
Username = username;
Password = password;
@@ -33,7 +34,9 @@ public InfluxDbConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public InfluxDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public InfluxDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -104,4 +107,4 @@ public InfluxDbConfiguration(InfluxDbConfiguration oldValue, InfluxDbConfigurati
/// Gets the InfluxDb retention.
///
public string Retention { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.InfluxDb/InfluxDbContainer.cs b/src/Testcontainers.InfluxDb/InfluxDbContainer.cs
index 29f9efe44..4466f1ec6 100644
--- a/src/Testcontainers.InfluxDb/InfluxDbContainer.cs
+++ b/src/Testcontainers.InfluxDb/InfluxDbContainer.cs
@@ -9,9 +9,7 @@ public sealed class InfluxDbContainer : DockerContainer
///
/// The container configuration.
public InfluxDbContainer(InfluxDbConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the InfluxDb address.
@@ -19,6 +17,10 @@ public InfluxDbContainer(InfluxDbConfiguration configuration)
/// The InfluxDb address.
public string GetAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(InfluxDbBuilder.InfluxDbPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(InfluxDbBuilder.InfluxDbPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.InfluxDb/Testcontainers.InfluxDb.csproj b/src/Testcontainers.InfluxDb/Testcontainers.InfluxDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.InfluxDb/Testcontainers.InfluxDb.csproj
+++ b/src/Testcontainers.InfluxDb/Testcontainers.InfluxDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.InfluxDb/Usings.cs b/src/Testcontainers.InfluxDb/Usings.cs
index 40b1c789a..46ae7f45e 100644
--- a/src/Testcontainers.InfluxDb/Usings.cs
+++ b/src/Testcontainers.InfluxDb/Usings.cs
@@ -5,4 +5,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.JanusGraph/JanusGraphBuilder.cs b/src/Testcontainers.JanusGraph/JanusGraphBuilder.cs
index 2b30f7f45..42cfaa84a 100644
--- a/src/Testcontainers.JanusGraph/JanusGraphBuilder.cs
+++ b/src/Testcontainers.JanusGraph/JanusGraphBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.JanusGraph;
///
[PublicAPI]
-public sealed class JanusGraphBuilder : ContainerBuilder
+public sealed class JanusGraphBuilder
+ : ContainerBuilder
{
public const string JanusGraphImage = "janusgraph/janusgraph:1.0.0";
@@ -44,24 +45,37 @@ protected override JanusGraphBuilder Init()
.WithImage(JanusGraphImage)
.WithPortBinding(JanusGraphPort, true)
.WithEnvironment("janusgraph.storage.backend", "inmemory")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Channel started at port"));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("Channel started at port")
+ );
}
///
- protected override JanusGraphBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override JanusGraphBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new JanusGraphConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new JanusGraphConfiguration(resourceConfiguration)
+ );
}
///
protected override JanusGraphBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new JanusGraphConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new JanusGraphConfiguration(resourceConfiguration)
+ );
}
///
- protected override JanusGraphBuilder Merge(JanusGraphConfiguration oldValue, JanusGraphConfiguration newValue)
+ protected override JanusGraphBuilder Merge(
+ JanusGraphConfiguration oldValue,
+ JanusGraphConfiguration newValue
+ )
{
return new JanusGraphBuilder(new JanusGraphConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.JanusGraph/JanusGraphConfiguration.cs b/src/Testcontainers.JanusGraph/JanusGraphConfiguration.cs
index d5cd60f82..98839e741 100644
--- a/src/Testcontainers.JanusGraph/JanusGraphConfiguration.cs
+++ b/src/Testcontainers.JanusGraph/JanusGraphConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class JanusGraphConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public JanusGraphConfiguration()
- {
- }
+ public JanusGraphConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public JanusGraphConfiguration(IResourceConfiguration resourceConfiguration)
+ public JanusGraphConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -46,8 +46,9 @@ public JanusGraphConfiguration(JanusGraphConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public JanusGraphConfiguration(JanusGraphConfiguration oldValue, JanusGraphConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ public JanusGraphConfiguration(
+ JanusGraphConfiguration oldValue,
+ JanusGraphConfiguration newValue
+ )
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.JanusGraph/JanusGraphContainer.cs b/src/Testcontainers.JanusGraph/JanusGraphContainer.cs
index 0896ba0fc..191edad24 100644
--- a/src/Testcontainers.JanusGraph/JanusGraphContainer.cs
+++ b/src/Testcontainers.JanusGraph/JanusGraphContainer.cs
@@ -9,7 +9,5 @@ public sealed class JanusGraphContainer : DockerContainer
///
/// The container configuration.
public JanusGraphContainer(JanusGraphConfiguration configuration)
- : base(configuration)
- {
- }
-}
\ No newline at end of file
+ : base(configuration) { }
+}
diff --git a/src/Testcontainers.JanusGraph/Testcontainers.JanusGraph.csproj b/src/Testcontainers.JanusGraph/Testcontainers.JanusGraph.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.JanusGraph/Testcontainers.JanusGraph.csproj
+++ b/src/Testcontainers.JanusGraph/Testcontainers.JanusGraph.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.JanusGraph/Usings.cs b/src/Testcontainers.JanusGraph/Usings.cs
index a2faed446..2ceda0595 100644
--- a/src/Testcontainers.JanusGraph/Usings.cs
+++ b/src/Testcontainers.JanusGraph/Usings.cs
@@ -2,4 +2,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.K3s/K3sBuilder.cs b/src/Testcontainers.K3s/K3sBuilder.cs
index 6734ebb2c..7799734a1 100644
--- a/src/Testcontainers.K3s/K3sBuilder.cs
+++ b/src/Testcontainers.K3s/K3sBuilder.cs
@@ -51,12 +51,18 @@ protected override K3sBuilder Init()
.WithTmpfsMount("/run")
.WithTmpfsMount("/var/run")
.WithCommand("server", "--disable=traefik")
- .WithCreateParameterModifier(parameterModifier => parameterModifier.HostConfig.CgroupnsMode = "host")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Node controller sync successful"));
+ .WithCreateParameterModifier(parameterModifier =>
+ parameterModifier.HostConfig.CgroupnsMode = "host"
+ )
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("Node controller sync successful")
+ );
}
///
- protected override K3sBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override K3sBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new K3sConfiguration(resourceConfiguration));
}
@@ -72,4 +78,4 @@ protected override K3sBuilder Merge(K3sConfiguration oldValue, K3sConfiguration
{
return new K3sBuilder(new K3sConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.K3s/K3sConfiguration.cs b/src/Testcontainers.K3s/K3sConfiguration.cs
index 4c50d1123..6ae472b5f 100644
--- a/src/Testcontainers.K3s/K3sConfiguration.cs
+++ b/src/Testcontainers.K3s/K3sConfiguration.cs
@@ -7,9 +7,7 @@ public sealed class K3sConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public K3sConfiguration()
- {
- }
+ public K3sConfiguration() { }
///
/// Initializes a new instance of the class.
@@ -47,7 +45,5 @@ public K3sConfiguration(K3sConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public K3sConfiguration(K3sConfiguration oldValue, K3sConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.K3s/K3sContainer.cs b/src/Testcontainers.K3s/K3sContainer.cs
index aac1ea798..c8ab48938 100644
--- a/src/Testcontainers.K3s/K3sContainer.cs
+++ b/src/Testcontainers.K3s/K3sContainer.cs
@@ -9,9 +9,7 @@ public sealed class K3sContainer : DockerContainer
///
/// The container configuration.
public K3sContainer(K3sConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Kubeconfig.
@@ -24,8 +22,18 @@ public async Task GetKubeconfigAsync()
var kubeconfig = Encoding.Default.GetString(kubeconfigBytes);
- var server = new UriBuilder(Uri.UriSchemeHttps, Hostname, GetMappedPublicPort(K3sBuilder.KubeSecurePort)).ToString();
+ var server = new UriBuilder(
+ Uri.UriSchemeHttps,
+ Hostname,
+ GetMappedPublicPort(K3sBuilder.KubeSecurePort)
+ ).ToString();
- return Regex.Replace(kubeconfig, "server:\\s?[:/\\.\\d\\w]+", "server: " + server, RegexOptions.None, TimeSpan.FromSeconds(1));
+ return Regex.Replace(
+ kubeconfig,
+ "server:\\s?[:/\\.\\d\\w]+",
+ "server: " + server,
+ RegexOptions.None,
+ TimeSpan.FromSeconds(1)
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.K3s/Testcontainers.K3s.csproj b/src/Testcontainers.K3s/Testcontainers.K3s.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.K3s/Testcontainers.K3s.csproj
+++ b/src/Testcontainers.K3s/Testcontainers.K3s.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.K3s/Usings.cs b/src/Testcontainers.K3s/Usings.cs
index 633a735fb..bb0267fac 100644
--- a/src/Testcontainers.K3s/Usings.cs
+++ b/src/Testcontainers.K3s/Usings.cs
@@ -6,4 +6,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Kafka/ApacheConfiguration.cs b/src/Testcontainers.Kafka/ApacheConfiguration.cs
index 3e8d68868..ab422653c 100644
--- a/src/Testcontainers.Kafka/ApacheConfiguration.cs
+++ b/src/Testcontainers.Kafka/ApacheConfiguration.cs
@@ -3,30 +3,23 @@ namespace Testcontainers.Kafka;
///
internal sealed class ApacheConfiguration : IKafkaVendorConfiguration
{
- static ApacheConfiguration()
- {
- }
+ static ApacheConfiguration() { }
///
/// Initializes a new instance of the class.
///
- private ApacheConfiguration()
- {
- }
+ private ApacheConfiguration() { }
///
/// Gets the singleton instance of the Apache vendor configuration.
///
- public static IKafkaVendorConfiguration Instance { get; }
- = new ApacheConfiguration();
+ public static IKafkaVendorConfiguration Instance { get; } = new ApacheConfiguration();
///
- public KafkaVendor Vendor
- => KafkaVendor.ApacheSoftwareFoundation;
+ public KafkaVendor Vendor => KafkaVendor.ApacheSoftwareFoundation;
///
- public ConsensusProtocol ConsensusProtocol
- => ConsensusProtocol.KRaft;
+ public ConsensusProtocol ConsensusProtocol => ConsensusProtocol.KRaft;
///
public bool IsImageFromVendor(IImage image)
@@ -37,26 +30,55 @@ public bool IsImageFromVendor(IImage image)
///
public void Validate(KafkaConfiguration resourceConfiguration)
{
- const string message = "Local ZooKeeper is not supported for Apache Kafka images. Configure an external ZooKeeper.";
+ const string message =
+ "Local ZooKeeper is not supported for Apache Kafka images. Configure an external ZooKeeper.";
- var isZooKeeperConsensus = resourceConfiguration.ConsensusProtocol == ConsensusProtocol.ZooKeeper;
+ var isZooKeeperConsensus =
+ resourceConfiguration.ConsensusProtocol == ConsensusProtocol.ZooKeeper;
- var hasLocalZooKeeper = isZooKeeperConsensus && resourceConfiguration.Environments.TryGetValue("KAFKA_ZOOKEEPER_CONNECT", out var connectionString) && connectionString.StartsWith("localhost");
+ var hasLocalZooKeeper =
+ isZooKeeperConsensus
+ && resourceConfiguration.Environments.TryGetValue(
+ "KAFKA_ZOOKEEPER_CONNECT",
+ out var connectionString
+ )
+ && connectionString.StartsWith("localhost");
- _ = Guard.Argument(resourceConfiguration, nameof(IContainerConfiguration.Image))
- .ThrowIf(_ => hasLocalZooKeeper, argument => new ArgumentException(message, argument.Name));
+ _ = Guard
+ .Argument(resourceConfiguration, nameof(IContainerConfiguration.Image))
+ .ThrowIf(
+ _ => hasLocalZooKeeper,
+ argument => new ArgumentException(message, argument.Name)
+ );
}
///
- public string CreateStartupScript(KafkaConfiguration resourceConfiguration, KafkaContainer container)
+ public string CreateStartupScript(
+ KafkaConfiguration resourceConfiguration,
+ KafkaContainer container
+ )
{
- var additionalAdvertisedListeners = string.Join(",", container.AdvertisedListeners ?? Array.Empty());
+ var additionalAdvertisedListeners = string.Join(
+ ",",
+ container.AdvertisedListeners ?? Array.Empty()
+ );
var startupScript = new StringWriter();
startupScript.NewLine = "\n";
startupScript.WriteLine("#!/bin/bash");
- startupScript.WriteLine("export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://" + container.Hostname + ":" + container.GetMappedPublicPort(KafkaBuilder.KafkaPort) + ",BROKER://" + container.IpAddress + ":" + KafkaBuilder.BrokerPort + "," + additionalAdvertisedListeners);
+ startupScript.WriteLine(
+ "export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://"
+ + container.Hostname
+ + ":"
+ + container.GetMappedPublicPort(KafkaBuilder.KafkaPort)
+ + ",BROKER://"
+ + container.IpAddress
+ + ":"
+ + KafkaBuilder.BrokerPort
+ + ","
+ + additionalAdvertisedListeners
+ );
startupScript.WriteLine("exec /etc/kafka/docker/run");
return startupScript.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/ConfluentConfiguration.cs b/src/Testcontainers.Kafka/ConfluentConfiguration.cs
index f2e584710..757adb5f3 100644
--- a/src/Testcontainers.Kafka/ConfluentConfiguration.cs
+++ b/src/Testcontainers.Kafka/ConfluentConfiguration.cs
@@ -3,30 +3,23 @@ namespace Testcontainers.Kafka;
///
internal sealed class ConfluentConfiguration : IKafkaVendorConfiguration
{
- static ConfluentConfiguration()
- {
- }
+ static ConfluentConfiguration() { }
///
/// Initializes a new instance of the class.
///
- private ConfluentConfiguration()
- {
- }
+ private ConfluentConfiguration() { }
///
/// Gets the singleton instance of the Confluent vendor configuration.
///
- public static IKafkaVendorConfiguration Instance { get; }
- = new ConfluentConfiguration();
+ public static IKafkaVendorConfiguration Instance { get; } = new ConfluentConfiguration();
///
- public KafkaVendor Vendor
- => KafkaVendor.Confluent;
+ public KafkaVendor Vendor => KafkaVendor.Confluent;
///
- public ConsensusProtocol ConsensusProtocol
- => ConsensusProtocol.ZooKeeper;
+ public ConsensusProtocol ConsensusProtocol => ConsensusProtocol.ZooKeeper;
///
public bool IsImageFromVendor(IImage image)
@@ -37,23 +30,43 @@ public bool IsImageFromVendor(IImage image)
///
public void Validate(KafkaConfiguration resourceConfiguration)
{
- const string message = "KRaft is not supported for Confluent Platform images with versions earlier than 7.0.0.";
+ const string message =
+ "KRaft is not supported for Confluent Platform images with versions earlier than 7.0.0.";
- Predicate isUnsupportedImage = value => value.ConsensusProtocol == ConsensusProtocol.KRaft
- && IsImageFromVendor(value.Image) && value.Image.MatchVersion(v => v.Major < 7);
+ Predicate isUnsupportedImage = value =>
+ value.ConsensusProtocol == ConsensusProtocol.KRaft
+ && IsImageFromVendor(value.Image)
+ && value.Image.MatchVersion(v => v.Major < 7);
- _ = Guard.Argument(resourceConfiguration, nameof(IContainerConfiguration.Image))
- .ThrowIf(argument => isUnsupportedImage(argument.Value), argument => new ArgumentException(message, argument.Name));
+ _ = Guard
+ .Argument(resourceConfiguration, nameof(IContainerConfiguration.Image))
+ .ThrowIf(
+ argument => isUnsupportedImage(argument.Value),
+ argument => new ArgumentException(message, argument.Name)
+ );
}
///
- public string CreateStartupScript(KafkaConfiguration resourceConfiguration, KafkaContainer container)
+ public string CreateStartupScript(
+ KafkaConfiguration resourceConfiguration,
+ KafkaContainer container
+ )
{
- var additionalAdvertisedListeners = string.Join(",", container.AdvertisedListeners ?? Array.Empty());
+ var additionalAdvertisedListeners = string.Join(
+ ",",
+ container.AdvertisedListeners ?? Array.Empty()
+ );
- var isZooKeeperConsensus = resourceConfiguration.ConsensusProtocol == ConsensusProtocol.ZooKeeper;
+ var isZooKeeperConsensus =
+ resourceConfiguration.ConsensusProtocol == ConsensusProtocol.ZooKeeper;
- var hasLocalZooKeeper = isZooKeeperConsensus && resourceConfiguration.Environments.TryGetValue("KAFKA_ZOOKEEPER_CONNECT", out var connectionString) && connectionString.StartsWith("localhost");
+ var hasLocalZooKeeper =
+ isZooKeeperConsensus
+ && resourceConfiguration.Environments.TryGetValue(
+ "KAFKA_ZOOKEEPER_CONNECT",
+ out var connectionString
+ )
+ && connectionString.StartsWith("localhost");
var startupScript = new StringWriter();
startupScript.NewLine = "\n";
@@ -62,14 +75,31 @@ public string CreateStartupScript(KafkaConfiguration resourceConfiguration, Kafk
if (isZooKeeperConsensus && hasLocalZooKeeper)
{
startupScript.WriteLine("echo '' > /etc/confluent/docker/ensure");
- startupScript.WriteLine("echo 'clientPort=" + KafkaBuilder.ZooKeeperPort + "' > zookeeper.properties");
- startupScript.WriteLine("echo 'dataDir=/var/lib/zookeeper/data' >> zookeeper.properties");
- startupScript.WriteLine("echo 'dataLogDir=/var/lib/zookeeper/log' >> zookeeper.properties");
+ startupScript.WriteLine(
+ "echo 'clientPort=" + KafkaBuilder.ZooKeeperPort + "' > zookeeper.properties"
+ );
+ startupScript.WriteLine(
+ "echo 'dataDir=/var/lib/zookeeper/data' >> zookeeper.properties"
+ );
+ startupScript.WriteLine(
+ "echo 'dataLogDir=/var/lib/zookeeper/log' >> zookeeper.properties"
+ );
startupScript.WriteLine("zookeeper-server-start zookeeper.properties &");
}
- startupScript.WriteLine("export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://" + container.Hostname + ":" + container.GetMappedPublicPort(KafkaBuilder.KafkaPort) + ",BROKER://" + container.IpAddress + ":" + KafkaBuilder.BrokerPort + "," + additionalAdvertisedListeners);
+ startupScript.WriteLine(
+ "export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://"
+ + container.Hostname
+ + ":"
+ + container.GetMappedPublicPort(KafkaBuilder.KafkaPort)
+ + ",BROKER://"
+ + container.IpAddress
+ + ":"
+ + KafkaBuilder.BrokerPort
+ + ","
+ + additionalAdvertisedListeners
+ );
startupScript.WriteLine("exec /etc/confluent/docker/run");
return startupScript.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/IKafkaVendorConfiguration.cs b/src/Testcontainers.Kafka/IKafkaVendorConfiguration.cs
index 533915760..8011914c6 100644
--- a/src/Testcontainers.Kafka/IKafkaVendorConfiguration.cs
+++ b/src/Testcontainers.Kafka/IKafkaVendorConfiguration.cs
@@ -34,5 +34,8 @@ internal interface IKafkaVendorConfiguration
/// The resource configuration.
/// The Kafka container.
/// The startup script as a string.
- public string CreateStartupScript(KafkaConfiguration resourceConfiguration, KafkaContainer container);
-}
\ No newline at end of file
+ public string CreateStartupScript(
+ KafkaConfiguration resourceConfiguration,
+ KafkaContainer container
+ );
+}
diff --git a/src/Testcontainers.Kafka/KafkaBuilder.cs b/src/Testcontainers.Kafka/KafkaBuilder.cs
index 5b3b2fb12..5f079ca71 100644
--- a/src/Testcontainers.Kafka/KafkaBuilder.cs
+++ b/src/Testcontainers.Kafka/KafkaBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Kafka;
///
[PublicAPI]
-public sealed class KafkaBuilder : ContainerBuilder
+public sealed class KafkaBuilder
+ : ContainerBuilder
{
public const string KafkaImage = "confluentinc/cp-kafka:7.5.9";
@@ -22,7 +23,11 @@ public sealed class KafkaBuilder : ContainerBuilder
/// Initializes a new instance of the class.
@@ -88,7 +93,10 @@ private KafkaBuilder(KafkaConfiguration resourceConfiguration)
/// A configured instance of .
public KafkaBuilder WithListener(string kafka)
{
- var index = DockerResourceConfiguration.Listeners == null ? 0 : DockerResourceConfiguration.Listeners.Count();
+ var index =
+ DockerResourceConfiguration.Listeners == null
+ ? 0
+ : DockerResourceConfiguration.Listeners.Count();
var protocol = $"{ProtocolPrefix}-{index}";
var listener = $"{protocol}://{kafka}";
var listenerSecurityProtocolMap = $"{protocol}:PLAINTEXT";
@@ -98,17 +106,25 @@ public KafkaBuilder WithListener(string kafka)
var host = kafka.Split(':')[0];
- var updatedListeners = DockerResourceConfiguration.Environments["KAFKA_LISTENERS"]
+ var updatedListeners = DockerResourceConfiguration
+ .Environments["KAFKA_LISTENERS"]
.Split(',')
.Concat(listeners);
- var updatedListenersSecurityProtocolMap = DockerResourceConfiguration.Environments["KAFKA_LISTENER_SECURITY_PROTOCOL_MAP"]
+ var updatedListenersSecurityProtocolMap = DockerResourceConfiguration
+ .Environments["KAFKA_LISTENER_SECURITY_PROTOCOL_MAP"]
.Split(',')
.Concat(listenersSecurityProtocolMap);
- return Merge(DockerResourceConfiguration, new KafkaConfiguration(listeners: listeners, advertisedListeners: listeners))
+ return Merge(
+ DockerResourceConfiguration,
+ new KafkaConfiguration(listeners: listeners, advertisedListeners: listeners)
+ )
.WithEnvironment("KAFKA_LISTENERS", string.Join(",", updatedListeners))
- .WithEnvironment("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", string.Join(",", updatedListenersSecurityProtocolMap))
+ .WithEnvironment(
+ "KAFKA_LISTENER_SECURITY_PROTOCOL_MAP",
+ string.Join(",", updatedListenersSecurityProtocolMap)
+ )
.WithNetworkAliases(host);
}
@@ -119,7 +135,10 @@ public KafkaBuilder WithListener(string kafka)
/// A configured instance of .
private KafkaBuilder WithConsensusProtocol(ConsensusProtocol consensusProtocol)
{
- return Merge(DockerResourceConfiguration, new KafkaConfiguration(consensusProtocol: consensusProtocol));
+ return Merge(
+ DockerResourceConfiguration,
+ new KafkaConfiguration(consensusProtocol: consensusProtocol)
+ );
}
///
@@ -131,7 +150,10 @@ public KafkaBuilder WithKRaft()
return WithConsensusProtocol(ConsensusProtocol.KRaft)
.WithEnvironment("KAFKA_CONTROLLER_LISTENER_NAMES", "CONTROLLER")
.WithEnvironment("KAFKA_PROCESS_ROLES", "broker,controller")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged(".*Transitioning from RECOVERY to RUNNING.*"));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilMessageIsLogged(".*Transitioning from RECOVERY to RUNNING.*")
+ );
}
///
@@ -143,8 +165,13 @@ public KafkaBuilder WithZooKeeper(string connectionString = null)
{
return WithConsensusProtocol(ConsensusProtocol.ZooKeeper)
.WithPortBinding(ZooKeeperPort, connectionString == null)
- .WithEnvironment("KAFKA_ZOOKEEPER_CONNECT", connectionString ?? $"localhost:{ZooKeeperPort}")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("\\[KafkaServer id=\\d+\\] started"));
+ .WithEnvironment(
+ "KAFKA_ZOOKEEPER_CONNECT",
+ connectionString ?? $"localhost:{ZooKeeperPort}"
+ )
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("\\[KafkaServer id=\\d+\\] started")
+ );
}
///
@@ -181,7 +208,10 @@ public override KafkaContainer Build()
KafkaBuilder kafkaBuilder;
// Instead of this approach, should we consider using a builder for each vendor?
- var vendorConfiguration = VendorConfigurations.Single(v => v.Vendor.Equals(DockerResourceConfiguration.Vendor) || v.IsImageFromVendor(DockerResourceConfiguration.Image));
+ var vendorConfiguration = VendorConfigurations.Single(v =>
+ v.Vendor.Equals(DockerResourceConfiguration.Vendor)
+ || v.IsImageFromVendor(DockerResourceConfiguration.Image)
+ );
// If the user hasn't set a consensus protocol, use the vendor's default configuration.
if (DockerResourceConfiguration.ConsensusProtocol.HasValue)
@@ -198,17 +228,29 @@ public override KafkaContainer Build()
}
else
{
- throw new ArgumentException($"No default configuration available for vendor '{vendorConfiguration.Vendor}'.");
+ throw new ArgumentException(
+ $"No default configuration available for vendor '{vendorConfiguration.Vendor}'."
+ );
}
// Validate that the configuration is compatible with the vendor's image.
vendorConfiguration.Validate(DockerResourceConfiguration);
- var startupKafkaBuilder = kafkaBuilder.WithStartupCallback((container, ct) =>
- {
- var startupScript = vendorConfiguration.CreateStartupScript(kafkaBuilder.DockerResourceConfiguration, container);
- return container.CopyAsync(Encoding.Default.GetBytes(startupScript), StartupScriptFilePath, Unix.FileMode755, ct);
- });
+ var startupKafkaBuilder = kafkaBuilder.WithStartupCallback(
+ (container, ct) =>
+ {
+ var startupScript = vendorConfiguration.CreateStartupScript(
+ kafkaBuilder.DockerResourceConfiguration,
+ container
+ );
+ return container.CopyAsync(
+ Encoding.Default.GetBytes(startupScript),
+ StartupScriptFilePath,
+ Unix.FileMode755,
+ ct
+ );
+ }
+ );
return new KafkaContainer(startupKafkaBuilder.DockerResourceConfiguration);
}
@@ -220,12 +262,21 @@ protected override KafkaBuilder Init()
.WithImage(KafkaImage)
.WithPortBinding(KafkaPort, true)
.WithPortBinding(BrokerPort, true)
- .WithEnvironment("KAFKA_LISTENERS", $"PLAINTEXT://:{KafkaPort},BROKER://:{BrokerPort},CONTROLLER://:{ControllerPort}")
- .WithEnvironment("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "BROKER:PLAINTEXT,CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT")
+ .WithEnvironment(
+ "KAFKA_LISTENERS",
+ $"PLAINTEXT://:{KafkaPort},BROKER://:{BrokerPort},CONTROLLER://:{ControllerPort}"
+ )
+ .WithEnvironment(
+ "KAFKA_LISTENER_SECURITY_PROTOCOL_MAP",
+ "BROKER:PLAINTEXT,CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT"
+ )
.WithEnvironment("KAFKA_INTER_BROKER_LISTENER_NAME", "BROKER")
.WithEnvironment("KAFKA_BROKER_ID", "1")
.WithEnvironment("KAFKA_NODE_ID", NodeId)
- .WithEnvironment("KAFKA_CONTROLLER_QUORUM_VOTERS", $"{NodeId}@localhost:{ControllerPort}")
+ .WithEnvironment(
+ "KAFKA_CONTROLLER_QUORUM_VOTERS",
+ $"{NodeId}@localhost:{ControllerPort}"
+ )
.WithEnvironment("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "1")
.WithEnvironment("KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS", "1")
.WithEnvironment("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "1")
@@ -234,7 +285,9 @@ protected override KafkaBuilder Init()
.WithEnvironment("KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS", "0")
.WithEnvironment("CLUSTER_ID", ClusterId)
.WithEntrypoint("/bin/sh", "-c")
- .WithCommand($"while [ ! -f {StartupScriptFilePath} ]; do sleep 0.1; done; {StartupScriptFilePath}");
+ .WithCommand(
+ $"while [ ! -f {StartupScriptFilePath} ]; do sleep 0.1; done; {StartupScriptFilePath}"
+ );
}
///
@@ -244,14 +297,27 @@ protected override void Validate()
base.Validate();
- Predicate vendorNotFound = value => value == null && !VendorConfigurations.Any(v => v.IsImageFromVendor(DockerResourceConfiguration.Image));
-
- _ = Guard.Argument(DockerResourceConfiguration.Vendor, nameof(DockerResourceConfiguration.Vendor))
- .ThrowIf(argument => vendorNotFound(argument.Value), argument => new ArgumentException(message, argument.Name));
+ Predicate vendorNotFound = value =>
+ value == null
+ && !VendorConfigurations.Any(v =>
+ v.IsImageFromVendor(DockerResourceConfiguration.Image)
+ );
+
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Vendor,
+ nameof(DockerResourceConfiguration.Vendor)
+ )
+ .ThrowIf(
+ argument => vendorNotFound(argument.Value),
+ argument => new ArgumentException(message, argument.Name)
+ );
}
///
- protected override KafkaBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override KafkaBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new KafkaConfiguration(resourceConfiguration));
}
@@ -267,4 +333,4 @@ protected override KafkaBuilder Merge(KafkaConfiguration oldValue, KafkaConfigur
{
return new KafkaBuilder(new KafkaConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/KafkaConfiguration.cs b/src/Testcontainers.Kafka/KafkaConfiguration.cs
index a643b2f1d..8945cdd8b 100644
--- a/src/Testcontainers.Kafka/KafkaConfiguration.cs
+++ b/src/Testcontainers.Kafka/KafkaConfiguration.cs
@@ -15,7 +15,8 @@ public KafkaConfiguration(
KafkaVendor? vendor = null,
ConsensusProtocol? consensusProtocol = null,
IEnumerable listeners = null,
- IEnumerable advertisedListeners = null)
+ IEnumerable advertisedListeners = null
+ )
{
Vendor = vendor;
ConsensusProtocol = consensusProtocol;
@@ -27,7 +28,9 @@ public KafkaConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public KafkaConfiguration(IResourceConfiguration resourceConfiguration)
+ public KafkaConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -62,9 +65,15 @@ public KafkaConfiguration(KafkaConfiguration oldValue, KafkaConfiguration newVal
: base(oldValue, newValue)
{
Vendor = BuildConfiguration.Combine(oldValue.Vendor, newValue.Vendor);
- ConsensusProtocol = BuildConfiguration.Combine(oldValue.ConsensusProtocol, newValue.ConsensusProtocol);
+ ConsensusProtocol = BuildConfiguration.Combine(
+ oldValue.ConsensusProtocol,
+ newValue.ConsensusProtocol
+ );
Listeners = BuildConfiguration.Combine(oldValue.Listeners, newValue.Listeners);
- AdvertisedListeners = BuildConfiguration.Combine(oldValue.AdvertisedListeners, newValue.AdvertisedListeners);
+ AdvertisedListeners = BuildConfiguration.Combine(
+ oldValue.AdvertisedListeners,
+ newValue.AdvertisedListeners
+ );
}
///
@@ -86,4 +95,4 @@ public KafkaConfiguration(KafkaConfiguration oldValue, KafkaConfiguration newVal
/// Gets a list of advertised listeners.
///
public IEnumerable AdvertisedListeners { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/KafkaConsensusProtocol.cs b/src/Testcontainers.Kafka/KafkaConsensusProtocol.cs
index 8ed4ff522..9b5490a8b 100644
--- a/src/Testcontainers.Kafka/KafkaConsensusProtocol.cs
+++ b/src/Testcontainers.Kafka/KafkaConsensusProtocol.cs
@@ -14,4 +14,4 @@ public enum ConsensusProtocol
/// Represents the ZooKeeper-based consensus protocol.
///
ZooKeeper,
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/KafkaContainer.cs b/src/Testcontainers.Kafka/KafkaContainer.cs
index 89a20db5b..c34c4f749 100644
--- a/src/Testcontainers.Kafka/KafkaContainer.cs
+++ b/src/Testcontainers.Kafka/KafkaContainer.cs
@@ -22,7 +22,11 @@ public KafkaContainer(KafkaConfiguration configuration)
/// The broker address.
public string GetBootstrapAddress()
{
- return new UriBuilder("PLAINTEXT", Hostname, GetMappedPublicPort(KafkaBuilder.KafkaPort)).ToString();
+ return new UriBuilder(
+ "PLAINTEXT",
+ Hostname,
+ GetMappedPublicPort(KafkaBuilder.KafkaPort)
+ ).ToString();
}
///
@@ -30,9 +34,6 @@ public string GetBootstrapAddress()
///
public IEnumerable AdvertisedListeners
{
- get
- {
- return _configuration.AdvertisedListeners;
- }
+ get { return _configuration.AdvertisedListeners; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/KafkaVendor.cs b/src/Testcontainers.Kafka/KafkaVendor.cs
index 43bba99ed..b42a51611 100644
--- a/src/Testcontainers.Kafka/KafkaVendor.cs
+++ b/src/Testcontainers.Kafka/KafkaVendor.cs
@@ -16,4 +16,4 @@ public enum KafkaVendor
/// extra features.
///
Confluent,
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kafka/Testcontainers.Kafka.csproj b/src/Testcontainers.Kafka/Testcontainers.Kafka.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Kafka/Testcontainers.Kafka.csproj
+++ b/src/Testcontainers.Kafka/Testcontainers.Kafka.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Kafka/Usings.cs b/src/Testcontainers.Kafka/Usings.cs
index cb20b6cdd..a826d02aa 100644
--- a/src/Testcontainers.Kafka/Usings.cs
+++ b/src/Testcontainers.Kafka/Usings.cs
@@ -9,4 +9,4 @@
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using DotNet.Testcontainers.Images;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Keycloak/KeycloakBuilder.cs b/src/Testcontainers.Keycloak/KeycloakBuilder.cs
index d3d406dc3..d02cac603 100644
--- a/src/Testcontainers.Keycloak/KeycloakBuilder.cs
+++ b/src/Testcontainers.Keycloak/KeycloakBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Keycloak;
///
[PublicAPI]
-public sealed class KeycloakBuilder : ContainerBuilder
+public sealed class KeycloakBuilder
+ : ContainerBuilder
{
public const string KeycloakImage = "quay.io/keycloak/keycloak:21.1";
@@ -70,13 +71,20 @@ public override KeycloakContainer Build()
var image = DockerResourceConfiguration.Image;
// https://www.keycloak.org/docs/latest/release_notes/index.html#management-port-for-metrics-and-health-endpoints.
- var isMajorVersionGreaterOrEqual25 = image.MatchLatestOrNightly() || image.MatchVersion(predicate);
+ var isMajorVersionGreaterOrEqual25 =
+ image.MatchLatestOrNightly() || image.MatchVersion(predicate);
var waitStrategy = Wait.ForUnixContainer()
.UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/health/ready").ForPort(isMajorVersionGreaterOrEqual25 ? KeycloakHealthPort : KeycloakPort));
-
- var keycloakBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(waitStrategy);
+ request
+ .ForPath("/health/ready")
+ .ForPort(isMajorVersionGreaterOrEqual25 ? KeycloakHealthPort : KeycloakPort)
+ );
+
+ var keycloakBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(waitStrategy);
return new KeycloakContainer(keycloakBuilder.DockerResourceConfiguration);
}
@@ -98,17 +106,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override KeycloakBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override KeycloakBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new KeycloakConfiguration(resourceConfiguration));
}
@@ -120,8 +138,11 @@ protected override KeycloakBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override KeycloakBuilder Merge(KeycloakConfiguration oldValue, KeycloakConfiguration newValue)
+ protected override KeycloakBuilder Merge(
+ KeycloakConfiguration oldValue,
+ KeycloakConfiguration newValue
+ )
{
return new KeycloakBuilder(new KeycloakConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Keycloak/KeycloakConfiguration.cs b/src/Testcontainers.Keycloak/KeycloakConfiguration.cs
index b1b2937e8..54d239949 100644
--- a/src/Testcontainers.Keycloak/KeycloakConfiguration.cs
+++ b/src/Testcontainers.Keycloak/KeycloakConfiguration.cs
@@ -19,7 +19,9 @@ public KeycloakConfiguration(string username = null, string password = null)
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public KeycloakConfiguration(IResourceConfiguration resourceConfiguration)
+ public KeycloakConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -66,4 +68,4 @@ public KeycloakConfiguration(KeycloakConfiguration oldValue, KeycloakConfigurati
/// Gets the admin password.
///
public string Password { get; } = null!;
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Keycloak/KeycloakContainer.cs b/src/Testcontainers.Keycloak/KeycloakContainer.cs
index 526aec6a1..4aff00093 100644
--- a/src/Testcontainers.Keycloak/KeycloakContainer.cs
+++ b/src/Testcontainers.Keycloak/KeycloakContainer.cs
@@ -9,9 +9,7 @@ public sealed class KeycloakContainer : DockerContainer
///
/// The container configuration.
public KeycloakContainer(KeycloakConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Keycloak base address.
@@ -19,6 +17,10 @@ public KeycloakContainer(KeycloakConfiguration configuration)
/// The Keycloak base address.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(KeycloakBuilder.KeycloakPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(KeycloakBuilder.KeycloakPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Keycloak/Testcontainers.Keycloak.csproj b/src/Testcontainers.Keycloak/Testcontainers.Keycloak.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Keycloak/Testcontainers.Keycloak.csproj
+++ b/src/Testcontainers.Keycloak/Testcontainers.Keycloak.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Keycloak/Usings.cs b/src/Testcontainers.Keycloak/Usings.cs
index f82c6873d..e8535f53b 100644
--- a/src/Testcontainers.Keycloak/Usings.cs
+++ b/src/Testcontainers.Keycloak/Usings.cs
@@ -5,4 +5,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Kusto/KustoBuilder.cs b/src/Testcontainers.Kusto/KustoBuilder.cs
index a946ecde1..ae612a6f5 100644
--- a/src/Testcontainers.Kusto/KustoBuilder.cs
+++ b/src/Testcontainers.Kusto/KustoBuilder.cs
@@ -6,7 +6,8 @@ namespace Testcontainers.Kusto;
/// https://learn.microsoft.com/azure/data-explorer/kusto-emulator-overview.
///
[PublicAPI]
-public sealed class KustoBuilder : ContainerBuilder
+public sealed class KustoBuilder
+ : ContainerBuilder
{
public const string KustoImage = "mcr.microsoft.com/azuredataexplorer/kustainer-linux:latest";
@@ -48,15 +49,28 @@ protected override KustoBuilder Init()
.WithImage(KustoImage)
.WithPortBinding(KustoPort, true)
.WithEnvironment("ACCEPT_EULA", "Y")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request => request
- .WithMethod(HttpMethod.Post)
- .ForPort(KustoPort)
- .ForPath("/v1/rest/mgmt")
- .WithContent(() => new StringContent("{\"csl\":\".show cluster\"}", Encoding.Default, "application/json"))));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request
+ .WithMethod(HttpMethod.Post)
+ .ForPort(KustoPort)
+ .ForPath("/v1/rest/mgmt")
+ .WithContent(() =>
+ new StringContent(
+ "{\"csl\":\".show cluster\"}",
+ Encoding.Default,
+ "application/json"
+ )
+ )
+ )
+ );
}
///
- protected override KustoBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override KustoBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new KustoConfiguration(resourceConfiguration));
}
@@ -72,4 +86,4 @@ protected override KustoBuilder Merge(KustoConfiguration oldValue, KustoConfigur
{
return new KustoBuilder(new KustoConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kusto/KustoConfiguration.cs b/src/Testcontainers.Kusto/KustoConfiguration.cs
index ef49aab0d..d6bc3f10f 100644
--- a/src/Testcontainers.Kusto/KustoConfiguration.cs
+++ b/src/Testcontainers.Kusto/KustoConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class KustoConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public KustoConfiguration()
- {
- }
+ public KustoConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public KustoConfiguration(IResourceConfiguration resourceConfiguration)
+ public KustoConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public KustoConfiguration(KustoConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public KustoConfiguration(KustoConfiguration oldValue, KustoConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Kusto/KustoContainer.cs b/src/Testcontainers.Kusto/KustoContainer.cs
index 05599e180..b8a93938a 100644
--- a/src/Testcontainers.Kusto/KustoContainer.cs
+++ b/src/Testcontainers.Kusto/KustoContainer.cs
@@ -9,9 +9,7 @@ public sealed class KustoContainer : DockerContainer
///
/// The container configuration.
public KustoContainer(KustoConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Kusto connection string.
@@ -19,6 +17,10 @@ public KustoContainer(KustoConfiguration configuration)
/// The Kusto connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(KustoBuilder.KustoPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(KustoBuilder.KustoPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Kusto/Testcontainers.Kusto.csproj b/src/Testcontainers.Kusto/Testcontainers.Kusto.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Kusto/Testcontainers.Kusto.csproj
+++ b/src/Testcontainers.Kusto/Testcontainers.Kusto.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Kusto/Usings.cs b/src/Testcontainers.Kusto/Usings.cs
index 1ea451a51..6bb9bef19 100644
--- a/src/Testcontainers.Kusto/Usings.cs
+++ b/src/Testcontainers.Kusto/Usings.cs
@@ -5,4 +5,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.LocalStack/LocalStackBuilder.cs b/src/Testcontainers.LocalStack/LocalStackBuilder.cs
index 3bfdca00c..7b68b7ae2 100644
--- a/src/Testcontainers.LocalStack/LocalStackBuilder.cs
+++ b/src/Testcontainers.LocalStack/LocalStackBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.LocalStack;
///
[PublicAPI]
-public sealed class LocalStackBuilder : ContainerBuilder
+public sealed class LocalStackBuilder
+ : ContainerBuilder
{
public const string LocalStackImage = "localstack/localstack:2.0";
@@ -43,25 +44,40 @@ protected override LocalStackBuilder Init()
return base.Init()
.WithImage(LocalStackImage)
.WithPortBinding(LocalStackPort, true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/_localstack/health").ForPort(LocalStackPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/_localstack/health").ForPort(LocalStackPort)
+ )
+ );
}
///
- protected override LocalStackBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override LocalStackBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new LocalStackConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new LocalStackConfiguration(resourceConfiguration)
+ );
}
///
protected override LocalStackBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new LocalStackConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new LocalStackConfiguration(resourceConfiguration)
+ );
}
///
- protected override LocalStackBuilder Merge(LocalStackConfiguration oldValue, LocalStackConfiguration newValue)
+ protected override LocalStackBuilder Merge(
+ LocalStackConfiguration oldValue,
+ LocalStackConfiguration newValue
+ )
{
return new LocalStackBuilder(new LocalStackConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.LocalStack/LocalStackConfiguration.cs b/src/Testcontainers.LocalStack/LocalStackConfiguration.cs
index 2e53b55fc..bcc24f12f 100644
--- a/src/Testcontainers.LocalStack/LocalStackConfiguration.cs
+++ b/src/Testcontainers.LocalStack/LocalStackConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class LocalStackConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public LocalStackConfiguration()
- {
- }
+ public LocalStackConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public LocalStackConfiguration(IResourceConfiguration resourceConfiguration)
+ public LocalStackConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -46,8 +46,9 @@ public LocalStackConfiguration(LocalStackConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public LocalStackConfiguration(LocalStackConfiguration oldValue, LocalStackConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ public LocalStackConfiguration(
+ LocalStackConfiguration oldValue,
+ LocalStackConfiguration newValue
+ )
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.LocalStack/LocalStackContainer.cs b/src/Testcontainers.LocalStack/LocalStackContainer.cs
index a65f776ea..39246c437 100644
--- a/src/Testcontainers.LocalStack/LocalStackContainer.cs
+++ b/src/Testcontainers.LocalStack/LocalStackContainer.cs
@@ -9,9 +9,7 @@ public sealed class LocalStackContainer : DockerContainer
///
/// The container configuration.
public LocalStackContainer(LocalStackConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the LocalStack connection string.
@@ -19,6 +17,10 @@ public LocalStackContainer(LocalStackConfiguration configuration)
/// The LocalStack connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(LocalStackBuilder.LocalStackPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(LocalStackBuilder.LocalStackPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.LocalStack/Testcontainers.LocalStack.csproj b/src/Testcontainers.LocalStack/Testcontainers.LocalStack.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.LocalStack/Testcontainers.LocalStack.csproj
+++ b/src/Testcontainers.LocalStack/Testcontainers.LocalStack.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.LocalStack/Usings.cs b/src/Testcontainers.LocalStack/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.LocalStack/Usings.cs
+++ b/src/Testcontainers.LocalStack/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.LowkeyVault/LowkeyVaultBuilder.cs b/src/Testcontainers.LowkeyVault/LowkeyVaultBuilder.cs
index 2294a9a86..beac99bce 100644
--- a/src/Testcontainers.LowkeyVault/LowkeyVaultBuilder.cs
+++ b/src/Testcontainers.LowkeyVault/LowkeyVaultBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.LowkeyVault;
///
[PublicAPI]
-public sealed class LowkeyVaultBuilder : ContainerBuilder
+public sealed class LowkeyVaultBuilder
+ : ContainerBuilder
{
public const string LowkeyVaultImage = "nagyesta/lowkey-vault:2.7.1-ubi9-minimal";
@@ -43,7 +44,10 @@ private LowkeyVaultBuilder(LowkeyVaultConfiguration dockerResourceConfiguration)
/// A configured instance of .
public LowkeyVaultBuilder WithArguments(IEnumerable arguments)
{
- return Merge(DockerResourceConfiguration, new LowkeyVaultConfiguration(arguments: arguments));
+ return Merge(
+ DockerResourceConfiguration,
+ new LowkeyVaultConfiguration(arguments: arguments)
+ );
}
///
@@ -51,7 +55,10 @@ public override LowkeyVaultContainer Build()
{
Validate();
- var lowkeyVaultBusBuilder = WithEnvironment("LOWKEY_ARGS", string.Join(" ", DockerResourceConfiguration.Arguments));
+ var lowkeyVaultBusBuilder = WithEnvironment(
+ "LOWKEY_ARGS",
+ string.Join(" ", DockerResourceConfiguration.Arguments)
+ );
return new LowkeyVaultContainer(lowkeyVaultBusBuilder.DockerResourceConfiguration);
}
@@ -63,24 +70,37 @@ protected override LowkeyVaultBuilder Init()
.WithPortBinding(LowkeyVaultPort, true)
.WithPortBinding(LowkeyVaultTokenPort, true)
.WithArguments(new[] { "--LOWKEY_VAULT_RELAXED_PORTS=true" })
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("(?s).*Started LowkeyVaultApp.*$"));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("(?s).*Started LowkeyVaultApp.*$")
+ );
}
///
- protected override LowkeyVaultBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override LowkeyVaultBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new LowkeyVaultConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new LowkeyVaultConfiguration(resourceConfiguration)
+ );
}
///
protected override LowkeyVaultBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new LowkeyVaultConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new LowkeyVaultConfiguration(resourceConfiguration)
+ );
}
///
- protected override LowkeyVaultBuilder Merge(LowkeyVaultConfiguration oldValue, LowkeyVaultConfiguration newValue)
+ protected override LowkeyVaultBuilder Merge(
+ LowkeyVaultConfiguration oldValue,
+ LowkeyVaultConfiguration newValue
+ )
{
return new LowkeyVaultBuilder(new LowkeyVaultConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.LowkeyVault/LowkeyVaultConfiguration.cs b/src/Testcontainers.LowkeyVault/LowkeyVaultConfiguration.cs
index 69a72550d..2f63ab978 100644
--- a/src/Testcontainers.LowkeyVault/LowkeyVaultConfiguration.cs
+++ b/src/Testcontainers.LowkeyVault/LowkeyVaultConfiguration.cs
@@ -17,7 +17,9 @@ public LowkeyVaultConfiguration(IEnumerable arguments = null)
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public LowkeyVaultConfiguration(IResourceConfiguration resourceConfiguration)
+ public LowkeyVaultConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -48,7 +50,10 @@ public LowkeyVaultConfiguration(LowkeyVaultConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public LowkeyVaultConfiguration(LowkeyVaultConfiguration oldValue, LowkeyVaultConfiguration newValue)
+ public LowkeyVaultConfiguration(
+ LowkeyVaultConfiguration oldValue,
+ LowkeyVaultConfiguration newValue
+ )
: base(oldValue, newValue)
{
Arguments = BuildConfiguration.Combine(oldValue.Arguments, newValue.Arguments);
@@ -58,4 +63,4 @@ public LowkeyVaultConfiguration(LowkeyVaultConfiguration oldValue, LowkeyVaultCo
/// Gets the arguments that are added to the LOWKEY_ARGS environment variable.
///
public IEnumerable Arguments { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.LowkeyVault/LowkeyVaultContainer.cs b/src/Testcontainers.LowkeyVault/LowkeyVaultContainer.cs
index 9d53942dd..43c07354e 100644
--- a/src/Testcontainers.LowkeyVault/LowkeyVaultContainer.cs
+++ b/src/Testcontainers.LowkeyVault/LowkeyVaultContainer.cs
@@ -9,9 +9,7 @@ public sealed class LowkeyVaultContainer : DockerContainer
///
/// The container configuration.
public LowkeyVaultContainer(LowkeyVaultConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the base HTTPS address for the Lowkey Vault service.
@@ -19,7 +17,11 @@ public LowkeyVaultContainer(LowkeyVaultConfiguration configuration)
/// The base address URL.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttps, Hostname, GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttps,
+ Hostname,
+ GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultPort)
+ ).ToString();
}
///
@@ -29,7 +31,12 @@ public string GetBaseAddress()
public string GetAuthTokenUrl()
{
const string identityAuthTokenUriPath = "/metadata/identity/oauth2/token";
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultTokenPort), identityAuthTokenUriPath).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultTokenPort),
+ identityAuthTokenUriPath
+ ).ToString();
}
///
@@ -40,22 +47,28 @@ public async Task GetCertificateAsync()
{
const string defaultCertFilePathUriPath = "/metadata/default-cert/lowkey-vault.p12";
- var requestUri = new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultTokenPort), defaultCertFilePathUriPath).Uri;
+ var requestUri = new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultTokenPort),
+ defaultCertFilePathUriPath
+ ).Uri;
using var httpClient = new HttpClient();
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri);
- using var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage)
+ using var httpResponseMessage = await httpClient
+ .SendAsync(httpRequestMessage)
.ConfigureAwait(false);
httpResponseMessage.EnsureSuccessStatusCode();
- var certificateBytes = await httpResponseMessage.Content.ReadAsByteArrayAsync()
+ var certificateBytes = await httpResponseMessage
+ .Content.ReadAsByteArrayAsync()
.ConfigureAwait(false);
- var certificatePassword = await GetCertificatePasswordAsync()
- .ConfigureAwait(false);
+ var certificatePassword = await GetCertificatePasswordAsync().ConfigureAwait(false);
#if NET9_0_OR_GREATER
return X509CertificateLoader.LoadPkcs12Collection(certificateBytes, certificatePassword);
@@ -73,18 +86,23 @@ public async Task GetCertificatePasswordAsync()
{
const string defaultCertPasswordUriPath = "/metadata/default-cert/password";
- var requestUri = new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultTokenPort), defaultCertPasswordUriPath).Uri;
+ var requestUri = new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(LowkeyVaultBuilder.LowkeyVaultTokenPort),
+ defaultCertPasswordUriPath
+ ).Uri;
using var httpClient = new HttpClient();
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri);
- using var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage)
+ using var httpResponseMessage = await httpClient
+ .SendAsync(httpRequestMessage)
.ConfigureAwait(false);
httpResponseMessage.EnsureSuccessStatusCode();
- return await httpResponseMessage.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ return await httpResponseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.LowkeyVault/Testcontainers.LowkeyVault.csproj b/src/Testcontainers.LowkeyVault/Testcontainers.LowkeyVault.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.LowkeyVault/Testcontainers.LowkeyVault.csproj
+++ b/src/Testcontainers.LowkeyVault/Testcontainers.LowkeyVault.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.LowkeyVault/Usings.cs b/src/Testcontainers.LowkeyVault/Usings.cs
index 74dd2925d..7b9b51176 100644
--- a/src/Testcontainers.LowkeyVault/Usings.cs
+++ b/src/Testcontainers.LowkeyVault/Usings.cs
@@ -7,4 +7,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.MariaDb/MariaDbBuilder.cs b/src/Testcontainers.MariaDb/MariaDbBuilder.cs
index 98c067bc2..f6443b25a 100644
--- a/src/Testcontainers.MariaDb/MariaDbBuilder.cs
+++ b/src/Testcontainers.MariaDb/MariaDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.MariaDb;
///
[PublicAPI]
-public sealed class MariaDbBuilder : ContainerBuilder
+public sealed class MariaDbBuilder
+ : ContainerBuilder
{
public const string MariaDbImage = "mariadb:10.10";
@@ -55,7 +56,12 @@ public MariaDbBuilder WithDatabase(string database)
public MariaDbBuilder WithUsername(string username)
{
return Merge(DockerResourceConfiguration, new MariaDbConfiguration(username: username))
- .WithEnvironment("MARIADB_USER", "root".Equals(username, StringComparison.OrdinalIgnoreCase) ? string.Empty : username);
+ .WithEnvironment(
+ "MARIADB_USER",
+ "root".Equals(username, StringComparison.OrdinalIgnoreCase)
+ ? string.Empty
+ : username
+ );
}
///
@@ -77,7 +83,13 @@ public override MariaDbContainer Build()
// By default, the base builder waits until the container is running. However, for MariaDb, a more advanced waiting strategy is necessary that requires access to the configured database, username and password.
// If the user does not provide a custom waiting strategy, append the default MariaDb waiting strategy.
- var mariaDbBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration)));
+ var mariaDbBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
+ );
return new MariaDbContainer(mariaDbBuilder.DockerResourceConfiguration);
}
@@ -98,17 +110,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override MariaDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override MariaDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new MariaDbConfiguration(resourceConfiguration));
}
@@ -120,7 +142,10 @@ protected override MariaDbBuilder Clone(IContainerConfiguration resourceConfigur
}
///
- protected override MariaDbBuilder Merge(MariaDbConfiguration oldValue, MariaDbConfiguration newValue)
+ protected override MariaDbBuilder Merge(
+ MariaDbConfiguration oldValue,
+ MariaDbConfiguration newValue
+ )
{
return new MariaDbBuilder(new MariaDbConfiguration(oldValue, newValue));
}
@@ -136,16 +161,22 @@ private sealed class WaitUntil : IWaitUntil
/// The container configuration.
public WaitUntil(MariaDbConfiguration configuration)
{
- _command = new List { "mariadb", configuration.Database, "--wait", "--silent", "--execute=SELECT 1;" };
+ _command = new List
+ {
+ "mariadb",
+ configuration.Database,
+ "--wait",
+ "--silent",
+ "--execute=SELECT 1;",
+ };
}
///
public async Task UntilAsync(IContainer container)
{
- var execResult = await container.ExecAsync(_command)
- .ConfigureAwait(false);
+ var execResult = await container.ExecAsync(_command).ConfigureAwait(false);
return 0L.Equals(execResult.ExitCode);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MariaDb/MariaDbConfiguration.cs b/src/Testcontainers.MariaDb/MariaDbConfiguration.cs
index 8b41ef7b8..b6d5795c1 100644
--- a/src/Testcontainers.MariaDb/MariaDbConfiguration.cs
+++ b/src/Testcontainers.MariaDb/MariaDbConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class MariaDbConfiguration : ContainerConfiguration
public MariaDbConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public MariaDbConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public MariaDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public MariaDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -77,4 +80,4 @@ public MariaDbConfiguration(MariaDbConfiguration oldValue, MariaDbConfiguration
/// Gets the MariaDb password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MariaDb/MariaDbContainer.cs b/src/Testcontainers.MariaDb/MariaDbContainer.cs
index a1bb69eb4..68b6a1bc3 100644
--- a/src/Testcontainers.MariaDb/MariaDbContainer.cs
+++ b/src/Testcontainers.MariaDb/MariaDbContainer.cs
@@ -28,7 +28,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("Uid", _configuration.Username);
properties.Add("Pwd", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -37,14 +40,31 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "mariadb", _configuration.Database, $"--execute=source {scriptFilePath};" }, ct)
+ return await ExecAsync(
+ new[] { "mariadb", _configuration.Database, $"--execute=source {scriptFilePath};" },
+ ct
+ )
.ConfigureAwait(false);
}
@@ -63,6 +83,11 @@ internal Task WriteConfigurationFileAsync(CancellationToken ct = default)
config.WriteLine("protocol=TCP");
config.WriteLine($"user={_configuration.Username}");
config.WriteLine($"password={_configuration.Password}");
- return CopyAsync(Encoding.Default.GetBytes(config.ToString()), "/etc/mysql/my.cnf", UnixFileModes.UserRead | UnixFileModes.UserWrite, ct);
+ return CopyAsync(
+ Encoding.Default.GetBytes(config.ToString()),
+ "/etc/mysql/my.cnf",
+ UnixFileModes.UserRead | UnixFileModes.UserWrite,
+ ct
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MariaDb/Testcontainers.MariaDb.csproj b/src/Testcontainers.MariaDb/Testcontainers.MariaDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.MariaDb/Testcontainers.MariaDb.csproj
+++ b/src/Testcontainers.MariaDb/Testcontainers.MariaDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.MariaDb/Usings.cs b/src/Testcontainers.MariaDb/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.MariaDb/Usings.cs
+++ b/src/Testcontainers.MariaDb/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Milvus/MilvusBuilder.cs b/src/Testcontainers.Milvus/MilvusBuilder.cs
index 44c2d8a60..9b7047dfc 100644
--- a/src/Testcontainers.Milvus/MilvusBuilder.cs
+++ b/src/Testcontainers.Milvus/MilvusBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Milvus;
///
[PublicAPI]
-public sealed class MilvusBuilder : ContainerBuilder
+public sealed class MilvusBuilder
+ : ContainerBuilder
{
public const string MilvusEtcdConfigFilePath = "/milvus/configs/embedEtcd.yaml";
@@ -12,7 +13,13 @@ public sealed class MilvusBuilder : ContainerBuilder
/// Initializes a new instance of the class.
@@ -70,12 +77,18 @@ protected override MilvusBuilder Init()
.WithEnvironment("ETCD_CONFIG_PATH", MilvusEtcdConfigFilePath)
.WithEnvironment("ETCD_DATA_DIR", "/var/lib/milvus/etcd")
.WithResourceMapping(EtcdConfig, MilvusEtcdConfigFilePath)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(MilvusManagementPort).ForPath("/healthz")));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPort(MilvusManagementPort).ForPath("/healthz")
+ )
+ );
}
///
- protected override MilvusBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override MilvusBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new MilvusConfiguration(resourceConfiguration));
}
@@ -87,8 +100,11 @@ protected override MilvusBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override MilvusBuilder Merge(MilvusConfiguration oldValue, MilvusConfiguration newValue)
+ protected override MilvusBuilder Merge(
+ MilvusConfiguration oldValue,
+ MilvusConfiguration newValue
+ )
{
return new MilvusBuilder(new MilvusConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Milvus/MilvusConfiguration.cs b/src/Testcontainers.Milvus/MilvusConfiguration.cs
index 32b7dba70..4ca9a055c 100644
--- a/src/Testcontainers.Milvus/MilvusConfiguration.cs
+++ b/src/Testcontainers.Milvus/MilvusConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class MilvusConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public MilvusConfiguration()
- {
- }
+ public MilvusConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public MilvusConfiguration(IResourceConfiguration resourceConfiguration)
+ public MilvusConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public MilvusConfiguration(MilvusConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public MilvusConfiguration(MilvusConfiguration oldValue, MilvusConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Milvus/MilvusContainer.cs b/src/Testcontainers.Milvus/MilvusContainer.cs
index a856ad421..cf0297206 100644
--- a/src/Testcontainers.Milvus/MilvusContainer.cs
+++ b/src/Testcontainers.Milvus/MilvusContainer.cs
@@ -9,9 +9,7 @@ public sealed class MilvusContainer : DockerContainer
///
/// The container configuration.
public MilvusContainer(MilvusConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Milvus endpoint.
@@ -19,6 +17,10 @@ public MilvusContainer(MilvusConfiguration configuration)
/// The Milvus endpoint.
public Uri GetEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(MilvusBuilder.MilvusGrpcPort)).Uri;
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(MilvusBuilder.MilvusGrpcPort)
+ ).Uri;
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Milvus/Testcontainers.Milvus.csproj b/src/Testcontainers.Milvus/Testcontainers.Milvus.csproj
index cbff16956..fab0ac0d5 100644
--- a/src/Testcontainers.Milvus/Testcontainers.Milvus.csproj
+++ b/src/Testcontainers.Milvus/Testcontainers.Milvus.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1;net462
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1;net462
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Milvus/Usings.cs b/src/Testcontainers.Milvus/Usings.cs
index 4ee39f0be..1734e5e13 100644
--- a/src/Testcontainers.Milvus/Usings.cs
+++ b/src/Testcontainers.Milvus/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Minio/MinioBuilder.cs b/src/Testcontainers.Minio/MinioBuilder.cs
index 5373864ea..8a7cc909d 100644
--- a/src/Testcontainers.Minio/MinioBuilder.cs
+++ b/src/Testcontainers.Minio/MinioBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Minio;
///
[PublicAPI]
-public sealed class MinioBuilder : ContainerBuilder
+public sealed class MinioBuilder
+ : ContainerBuilder
{
public const string MinioImage = "minio/minio:RELEASE.2023-01-31T02-24-19Z";
@@ -72,8 +73,12 @@ protected override MinioBuilder Init()
.WithCommand("server", "/data")
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/minio/health/ready").ForPort(MinioPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/minio/health/ready").ForPort(MinioPort)
+ )
+ );
}
///
@@ -81,17 +86,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override MinioBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override MinioBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new MinioConfiguration(resourceConfiguration));
}
@@ -107,4 +122,4 @@ protected override MinioBuilder Merge(MinioConfiguration oldValue, MinioConfigur
{
return new MinioBuilder(new MinioConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Minio/MinioConfiguration.cs b/src/Testcontainers.Minio/MinioConfiguration.cs
index fa2c8d5ce..5d4f5521b 100644
--- a/src/Testcontainers.Minio/MinioConfiguration.cs
+++ b/src/Testcontainers.Minio/MinioConfiguration.cs
@@ -9,9 +9,7 @@ public sealed class MinioConfiguration : ContainerConfiguration
///
/// The Minio database.
/// The Minio username.
- public MinioConfiguration(
- string username = null,
- string password = null)
+ public MinioConfiguration(string username = null, string password = null)
{
Username = username;
Password = password;
@@ -21,7 +19,9 @@ public MinioConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public MinioConfiguration(IResourceConfiguration resourceConfiguration)
+ public MinioConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -68,4 +68,4 @@ public MinioConfiguration(MinioConfiguration oldValue, MinioConfiguration newVal
/// Gets the Minio password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Minio/MinioContainer.cs b/src/Testcontainers.Minio/MinioContainer.cs
index 656d577a9..ea8f26c6b 100644
--- a/src/Testcontainers.Minio/MinioContainer.cs
+++ b/src/Testcontainers.Minio/MinioContainer.cs
@@ -40,6 +40,10 @@ public string GetSecretKey()
/// The Minio connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(MinioBuilder.MinioPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(MinioBuilder.MinioPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Minio/Testcontainers.Minio.csproj b/src/Testcontainers.Minio/Testcontainers.Minio.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Minio/Testcontainers.Minio.csproj
+++ b/src/Testcontainers.Minio/Testcontainers.Minio.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Minio/Usings.cs b/src/Testcontainers.Minio/Usings.cs
index 8e5c20fd5..f89f0c94d 100644
--- a/src/Testcontainers.Minio/Usings.cs
+++ b/src/Testcontainers.Minio/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.MongoDb/MongoDbBuilder.cs b/src/Testcontainers.MongoDb/MongoDbBuilder.cs
index 786c401cd..2177754ef 100644
--- a/src/Testcontainers.MongoDb/MongoDbBuilder.cs
+++ b/src/Testcontainers.MongoDb/MongoDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.MongoDb;
///
[PublicAPI]
-public sealed class MongoDbBuilder : ContainerBuilder
+public sealed class MongoDbBuilder
+ : ContainerBuilder
{
public const string MongoDbImage = "mongo:6.0";
@@ -12,7 +13,8 @@ public sealed class MongoDbBuilder : ContainerBuilder \"" + KeyFileFilePath + "\"");
initKeyFileScript.WriteLine("chmod 600 \"" + KeyFileFilePath + "\"");
- return Merge(DockerResourceConfiguration, new MongoDbConfiguration(replicaSetName: replicaSetName))
+ return Merge(
+ DockerResourceConfiguration,
+ new MongoDbConfiguration(replicaSetName: replicaSetName)
+ )
.WithCommand("--replSet", replicaSetName, "--keyFile", KeyFileFilePath, "--bind_ip_all")
- .WithResourceMapping(Encoding.Default.GetBytes(initKeyFileScript.ToString()), InitKeyFileScriptFilePath, Unix.FileMode755);
+ .WithResourceMapping(
+ Encoding.Default.GetBytes(initKeyFileScript.ToString()),
+ InitKeyFileScriptFilePath,
+ Unix.FileMode755
+ );
}
///
@@ -101,7 +116,10 @@ public override MongoDbContainer Build()
}
// If the user does not provide a custom waiting strategy, append the default MongoDb waiting strategy.
- var mongoDbBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(waitUntil));
+ var mongoDbBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(waitUntil));
return new MongoDbContainer(mongoDbBuilder.DockerResourceConfiguration);
}
@@ -118,22 +136,42 @@ protected override MongoDbBuilder Init()
///
protected override void Validate()
{
- const string message = "Missing username or password. Both must be specified for a user to be created.";
+ const string message =
+ "Missing username or password. Both must be specified for a user to be created.";
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull();
- _ = Guard.Argument(DockerResourceConfiguration, "Credentials")
- .ThrowIf(argument => 1.Equals(new[] { argument.Value.Username, argument.Value.Password }.Count(string.IsNullOrWhiteSpace)), argument => new ArgumentException(message, argument.Name));
+ _ = Guard
+ .Argument(DockerResourceConfiguration, "Credentials")
+ .ThrowIf(
+ argument =>
+ 1.Equals(
+ new[] { argument.Value.Username, argument.Value.Password }.Count(
+ string.IsNullOrWhiteSpace
+ )
+ ),
+ argument => new ArgumentException(message, argument.Name)
+ );
}
///
- protected override MongoDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override MongoDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new MongoDbConfiguration(resourceConfiguration));
}
@@ -145,7 +183,10 @@ protected override MongoDbBuilder Clone(IContainerConfiguration resourceConfigur
}
///
- protected override MongoDbBuilder Merge(MongoDbConfiguration oldValue, MongoDbConfiguration newValue)
+ protected override MongoDbBuilder Merge(
+ MongoDbConfiguration oldValue,
+ MongoDbConfiguration newValue
+ )
{
return new MongoDbBuilder(new MongoDbConfiguration(oldValue, newValue));
}
@@ -163,19 +204,27 @@ private sealed class WaitIndicateReadiness : IWaitUntil
/// The container configuration.
public WaitIndicateReadiness(MongoDbConfiguration configuration)
{
- _count = string.IsNullOrEmpty(configuration.Username) && string.IsNullOrEmpty(configuration.Password) ? 1 : 2;
+ _count =
+ string.IsNullOrEmpty(configuration.Username)
+ && string.IsNullOrEmpty(configuration.Password)
+ ? 1
+ : 2;
}
///
public async Task UntilAsync(IContainer container)
{
- var (stdout, stderr) = await container.GetLogsAsync(since: container.StoppedTime, timestampsEnabled: false)
+ var (stdout, stderr) = await container
+ .GetLogsAsync(since: container.StoppedTime, timestampsEnabled: false)
.ConfigureAwait(false);
- return _count.Equals(Array.Empty()
- .Concat(stdout.Split(LineEndings, StringSplitOptions.RemoveEmptyEntries))
- .Concat(stderr.Split(LineEndings, StringSplitOptions.RemoveEmptyEntries))
- .Count(line => line.Contains("Waiting for connections")));
+ return _count.Equals(
+ Array
+ .Empty()
+ .Concat(stdout.Split(LineEndings, StringSplitOptions.RemoveEmptyEntries))
+ .Concat(stderr.Split(LineEndings, StringSplitOptions.RemoveEmptyEntries))
+ .Count(line => line.Contains("Waiting for connections"))
+ );
}
}
@@ -190,7 +239,8 @@ private sealed class WaitInitiateReplicaSet : IWaitUntil
/// The container configuration.
public WaitInitiateReplicaSet(MongoDbConfiguration configuration)
{
- _scriptContent = $"try{{rs.status()}}catch(e){{rs.initiate({{_id:'{configuration.ReplicaSetName}',members:[{{_id:0,host:'127.0.0.1:27017'}}]}});throw e;}}";
+ _scriptContent =
+ $"try{{rs.status()}}catch(e){{rs.initiate({{_id:'{configuration.ReplicaSetName}',members:[{{_id:0,host:'127.0.0.1:27017'}}]}});throw e;}}";
}
///
@@ -202,10 +252,9 @@ public Task UntilAsync(IContainer container)
///
private async Task UntilAsync(MongoDbContainer container)
{
- var execResult = await container.ExecScriptAsync(_scriptContent)
- .ConfigureAwait(false);
+ var execResult = await container.ExecScriptAsync(_scriptContent).ConfigureAwait(false);
return 0L.Equals(execResult.ExitCode);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MongoDb/MongoDbConfiguration.cs b/src/Testcontainers.MongoDb/MongoDbConfiguration.cs
index b069b2959..7845c2c7d 100644
--- a/src/Testcontainers.MongoDb/MongoDbConfiguration.cs
+++ b/src/Testcontainers.MongoDb/MongoDbConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class MongoDbConfiguration : ContainerConfiguration
public MongoDbConfiguration(
string username = null,
string password = null,
- string replicaSetName = null)
+ string replicaSetName = null
+ )
{
Username = username;
Password = password;
@@ -24,7 +25,9 @@ public MongoDbConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public MongoDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public MongoDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -60,7 +63,10 @@ public MongoDbConfiguration(MongoDbConfiguration oldValue, MongoDbConfiguration
{
Username = BuildConfiguration.Combine(oldValue.Username, newValue.Username);
Password = BuildConfiguration.Combine(oldValue.Password, newValue.Password);
- ReplicaSetName = BuildConfiguration.Combine(oldValue.ReplicaSetName, newValue.ReplicaSetName);
+ ReplicaSetName = BuildConfiguration.Combine(
+ oldValue.ReplicaSetName,
+ newValue.ReplicaSetName
+ );
}
///
@@ -80,4 +86,4 @@ public MongoDbConfiguration(MongoDbConfiguration oldValue, MongoDbConfiguration
/// If specified, the container will be started as a single-node replica set.
///
public string ReplicaSetName { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MongoDb/MongoDbContainer.cs b/src/Testcontainers.MongoDb/MongoDbContainer.cs
index 10404d62c..05108326c 100644
--- a/src/Testcontainers.MongoDb/MongoDbContainer.cs
+++ b/src/Testcontainers.MongoDb/MongoDbContainer.cs
@@ -23,7 +23,11 @@ public MongoDbContainer(MongoDbConfiguration configuration)
public string GetConnectionString()
{
// The MongoDb documentation recommends to use percent-encoding for username and password: https://www.mongodb.com/docs/manual/reference/connection-string/.
- var endpoint = new UriBuilder("mongodb", Hostname, GetMappedPublicPort(MongoDbBuilder.MongoDbPort));
+ var endpoint = new UriBuilder(
+ "mongodb",
+ Hostname,
+ GetMappedPublicPort(MongoDbBuilder.MongoDbPort)
+ );
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
endpoint.Query = "?directConnection=true";
@@ -36,11 +40,25 @@ public string GetConnectionString()
/// The content of the JavaScript script to execute.
/// Cancellation token.
/// Task that completes when the JavaScript script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
var whichMongoDbShell = await ExecAsync(new[] { "which", "mongosh" }, ct)
@@ -49,14 +67,15 @@ await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.F
var command = new[]
{
whichMongoDbShell.ExitCode == 0 ? "mongosh" : "mongo",
- "--username", _configuration.Username,
- "--password", _configuration.Password,
+ "--username",
+ _configuration.Username,
+ "--password",
+ _configuration.Password,
"--quiet",
"--eval",
$"load('{scriptFilePath}')",
};
- return await ExecAsync(command, ct)
- .ConfigureAwait(false);
+ return await ExecAsync(command, ct).ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MongoDb/Testcontainers.MongoDb.csproj b/src/Testcontainers.MongoDb/Testcontainers.MongoDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.MongoDb/Testcontainers.MongoDb.csproj
+++ b/src/Testcontainers.MongoDb/Testcontainers.MongoDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.MongoDb/Usings.cs b/src/Testcontainers.MongoDb/Usings.cs
index 16243387a..e446cb013 100644
--- a/src/Testcontainers.MongoDb/Usings.cs
+++ b/src/Testcontainers.MongoDb/Usings.cs
@@ -9,4 +9,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.MsSql/MsSqlBuilder.cs b/src/Testcontainers.MsSql/MsSqlBuilder.cs
index 7a5481f6b..99451149d 100644
--- a/src/Testcontainers.MsSql/MsSqlBuilder.cs
+++ b/src/Testcontainers.MsSql/MsSqlBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.MsSql;
///
[PublicAPI]
-public sealed class MsSqlBuilder : ContainerBuilder
+public sealed class MsSqlBuilder
+ : ContainerBuilder
{
public const string MsSqlImage = "mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04";
@@ -73,13 +74,19 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override MsSqlBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override MsSqlBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new MsSqlConfiguration(resourceConfiguration));
}
@@ -140,13 +147,13 @@ public Task UntilAsync(IContainer container)
///
private static async Task UntilAsync(MsSqlContainer container)
{
- var sqlCmdFilePath = await container.GetSqlCmdFilePathAsync()
- .ConfigureAwait(false);
+ var sqlCmdFilePath = await container.GetSqlCmdFilePathAsync().ConfigureAwait(false);
- var execResult = await container.ExecAsync(new[] { sqlCmdFilePath, "-C", "-Q", "SELECT 1;" })
+ var execResult = await container
+ .ExecAsync(new[] { sqlCmdFilePath, "-C", "-Q", "SELECT 1;" })
.ConfigureAwait(false);
return 0L.Equals(execResult.ExitCode);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MsSql/MsSqlConfiguration.cs b/src/Testcontainers.MsSql/MsSqlConfiguration.cs
index 0e5e2a486..a1ae55ae5 100644
--- a/src/Testcontainers.MsSql/MsSqlConfiguration.cs
+++ b/src/Testcontainers.MsSql/MsSqlConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class MsSqlConfiguration : ContainerConfiguration
public MsSqlConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public MsSqlConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public MsSqlConfiguration(IResourceConfiguration resourceConfiguration)
+ public MsSqlConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -77,4 +80,4 @@ public MsSqlConfiguration(MsSqlConfiguration oldValue, MsSqlConfiguration newVal
/// Gets the MsSql password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MsSql/MsSqlContainer.cs b/src/Testcontainers.MsSql/MsSqlContainer.cs
index 6f3b13f1e..364c59b9a 100644
--- a/src/Testcontainers.MsSql/MsSqlContainer.cs
+++ b/src/Testcontainers.MsSql/MsSqlContainer.cs
@@ -4,7 +4,12 @@ namespace Testcontainers.MsSql;
[PublicAPI]
public sealed class MsSqlContainer : DockerContainer, IDatabaseContainer
{
- private static readonly string[] FindSqlCmdFilePath = { "/bin/sh", "-c", "find /opt/mssql-tools*/bin/sqlcmd -type f -print -quit" };
+ private static readonly string[] FindSqlCmdFilePath =
+ {
+ "/bin/sh",
+ "-c",
+ "find /opt/mssql-tools*/bin/sqlcmd -type f -print -quit",
+ };
private readonly Lazy> _lazySqlCmdFilePath;
@@ -33,7 +38,10 @@ public string GetConnectionString()
properties.Add("User Id", _configuration.Username);
properties.Add("Password", _configuration.Password);
properties.Add("TrustServerCertificate", bool.TrueString);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -55,17 +63,46 @@ public Task GetSqlCmdFilePathAsync(CancellationToken ct = default)
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- var sqlCmdFilePath = await GetSqlCmdFilePathAsync(ct)
- .ConfigureAwait(false);
+ var sqlCmdFilePath = await GetSqlCmdFilePathAsync(ct).ConfigureAwait(false);
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { sqlCmdFilePath, "-C", "-b", "-r", "1", "-U", _configuration.Username, "-P", _configuration.Password, "-i", scriptFilePath }, ct)
+ return await ExecAsync(
+ new[]
+ {
+ sqlCmdFilePath,
+ "-C",
+ "-b",
+ "-r",
+ "1",
+ "-U",
+ _configuration.Username,
+ "-P",
+ _configuration.Password,
+ "-i",
+ scriptFilePath,
+ },
+ ct
+ )
.ConfigureAwait(false);
}
@@ -81,4 +118,4 @@ private async Task FindSqlCmdFilePathAsync()
throw new NotSupportedException("The sqlcmd binary could not be found.");
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MsSql/Testcontainers.MsSql.csproj b/src/Testcontainers.MsSql/Testcontainers.MsSql.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.MsSql/Testcontainers.MsSql.csproj
+++ b/src/Testcontainers.MsSql/Testcontainers.MsSql.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.MsSql/Usings.cs b/src/Testcontainers.MsSql/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.MsSql/Usings.cs
+++ b/src/Testcontainers.MsSql/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.MySql/MySqlBuilder.cs b/src/Testcontainers.MySql/MySqlBuilder.cs
index 91bfc5a9c..7618cdd90 100644
--- a/src/Testcontainers.MySql/MySqlBuilder.cs
+++ b/src/Testcontainers.MySql/MySqlBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.MySql;
///
[PublicAPI]
-public sealed class MySqlBuilder : ContainerBuilder
+public sealed class MySqlBuilder
+ : ContainerBuilder
{
public const string MySqlImage = "mysql:8.0";
@@ -55,7 +56,12 @@ public MySqlBuilder WithDatabase(string database)
public MySqlBuilder WithUsername(string username)
{
return Merge(DockerResourceConfiguration, new MySqlConfiguration(username: username))
- .WithEnvironment("MYSQL_USER", "root".Equals(username, StringComparison.OrdinalIgnoreCase) ? string.Empty : username);
+ .WithEnvironment(
+ "MYSQL_USER",
+ "root".Equals(username, StringComparison.OrdinalIgnoreCase)
+ ? string.Empty
+ : username
+ );
}
///
@@ -77,7 +83,13 @@ public override MySqlContainer Build()
// By default, the base builder waits until the container is running. However, for MySql, a more advanced waiting strategy is necessary that requires access to the configured database, username and password.
// If the user does not provide a custom waiting strategy, append the default MySql waiting strategy.
- var mySqlBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration)));
+ var mySqlBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
+ );
return new MySqlContainer(mySqlBuilder.DockerResourceConfiguration);
}
@@ -90,7 +102,13 @@ protected override MySqlBuilder Init()
.WithDatabase(DefaultDatabase)
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithStartupCallback((container, ct) => Task.WhenAll(container.CreateMySqlFilesDirectoryAsync(ct), container.WriteConfigurationFileAsync(ct)));
+ .WithStartupCallback(
+ (container, ct) =>
+ Task.WhenAll(
+ container.CreateMySqlFilesDirectoryAsync(ct),
+ container.WriteConfigurationFileAsync(ct)
+ )
+ );
}
///
@@ -98,17 +116,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override MySqlBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override MySqlBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new MySqlConfiguration(resourceConfiguration));
}
@@ -136,16 +164,22 @@ private sealed class WaitUntil : IWaitUntil
/// The container configuration.
public WaitUntil(MySqlConfiguration configuration)
{
- _command = new List { "mysql", configuration.Database, "--wait", "--silent", "--execute=SELECT 1;" };
+ _command = new List
+ {
+ "mysql",
+ configuration.Database,
+ "--wait",
+ "--silent",
+ "--execute=SELECT 1;",
+ };
}
///
public async Task UntilAsync(IContainer container)
{
- var execResult = await container.ExecAsync(_command)
- .ConfigureAwait(false);
+ var execResult = await container.ExecAsync(_command).ConfigureAwait(false);
return 0L.Equals(execResult.ExitCode);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MySql/MySqlConfiguration.cs b/src/Testcontainers.MySql/MySqlConfiguration.cs
index b97f020ea..a8c60ea60 100644
--- a/src/Testcontainers.MySql/MySqlConfiguration.cs
+++ b/src/Testcontainers.MySql/MySqlConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class MySqlConfiguration : ContainerConfiguration
public MySqlConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public MySqlConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public MySqlConfiguration(IResourceConfiguration resourceConfiguration)
+ public MySqlConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -77,4 +80,4 @@ public MySqlConfiguration(MySqlConfiguration oldValue, MySqlConfiguration newVal
/// Gets the MySql password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MySql/MySqlContainer.cs b/src/Testcontainers.MySql/MySqlContainer.cs
index 209625cda..945080404 100644
--- a/src/Testcontainers.MySql/MySqlContainer.cs
+++ b/src/Testcontainers.MySql/MySqlContainer.cs
@@ -28,7 +28,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("Uid", _configuration.Username);
properties.Add("Pwd", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -37,14 +40,31 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "mysql", _configuration.Database, $"--execute=source {scriptFilePath};" }, ct)
+ return await ExecAsync(
+ new[] { "mysql", _configuration.Database, $"--execute=source {scriptFilePath};" },
+ ct
+ )
.ConfigureAwait(false);
}
@@ -77,6 +97,11 @@ internal Task WriteConfigurationFileAsync(CancellationToken ct = default)
config.WriteLine("protocol=TCP");
config.WriteLine($"user={_configuration.Username}");
config.WriteLine($"password={_configuration.Password}");
- return CopyAsync(Encoding.Default.GetBytes(config.ToString()), "/etc/mysql/my.cnf", UnixFileModes.UserRead | UnixFileModes.UserWrite, ct);
+ return CopyAsync(
+ Encoding.Default.GetBytes(config.ToString()),
+ "/etc/mysql/my.cnf",
+ UnixFileModes.UserRead | UnixFileModes.UserWrite,
+ ct
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.MySql/Testcontainers.MySql.csproj b/src/Testcontainers.MySql/Testcontainers.MySql.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.MySql/Testcontainers.MySql.csproj
+++ b/src/Testcontainers.MySql/Testcontainers.MySql.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.MySql/Usings.cs b/src/Testcontainers.MySql/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.MySql/Usings.cs
+++ b/src/Testcontainers.MySql/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Nats/NatsBuilder.cs b/src/Testcontainers.Nats/NatsBuilder.cs
index eaea58cca..365fa6083 100644
--- a/src/Testcontainers.Nats/NatsBuilder.cs
+++ b/src/Testcontainers.Nats/NatsBuilder.cs
@@ -87,18 +87,37 @@ protected override void Validate()
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull();
- _ = Guard.Argument(DockerResourceConfiguration, "Credentials")
- .ThrowIf(argument => 1.Equals(new[] { argument.Value.Username, argument.Value.Password }.Count(string.IsNullOrWhiteSpace)), argument => new ArgumentException(message, argument.Name));
+ _ = Guard
+ .Argument(DockerResourceConfiguration, "Credentials")
+ .ThrowIf(
+ argument =>
+ 1.Equals(
+ new[] { argument.Value.Username, argument.Value.Password }.Count(
+ string.IsNullOrWhiteSpace
+ )
+ ),
+ argument => new ArgumentException(message, argument.Name)
+ );
}
///
- protected override NatsBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override NatsBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new NatsConfiguration(resourceConfiguration));
}
@@ -114,4 +133,4 @@ protected override NatsBuilder Merge(NatsConfiguration oldValue, NatsConfigurati
{
return new NatsBuilder(new NatsConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Nats/NatsConfiguration.cs b/src/Testcontainers.Nats/NatsConfiguration.cs
index 4c410b773..05362f0a8 100644
--- a/src/Testcontainers.Nats/NatsConfiguration.cs
+++ b/src/Testcontainers.Nats/NatsConfiguration.cs
@@ -9,9 +9,7 @@ public sealed class NatsConfiguration : ContainerConfiguration
///
/// The Nats username.
/// The Nats password.
- public NatsConfiguration(
- string username = null,
- string password = null)
+ public NatsConfiguration(string username = null, string password = null)
{
Username = username;
Password = password;
@@ -21,7 +19,9 @@ public NatsConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public NatsConfiguration(IResourceConfiguration resourceConfiguration)
+ public NatsConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -68,4 +68,4 @@ public NatsConfiguration(NatsConfiguration oldValue, NatsConfiguration newValue)
/// The Nats password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Nats/NatsContainer.cs b/src/Testcontainers.Nats/NatsContainer.cs
index 24f3e80fc..89a14eb59 100644
--- a/src/Testcontainers.Nats/NatsContainer.cs
+++ b/src/Testcontainers.Nats/NatsContainer.cs
@@ -25,7 +25,11 @@ public NatsContainer(NatsConfiguration configuration)
/// A Nats connection string in the format: nats://hostname:port.
public string GetConnectionString()
{
- var endpoint = new UriBuilder("nats", Hostname, GetMappedPublicPort(NatsBuilder.NatsClientPort));
+ var endpoint = new UriBuilder(
+ "nats",
+ Hostname,
+ GetMappedPublicPort(NatsBuilder.NatsClientPort)
+ );
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
@@ -37,6 +41,10 @@ public string GetConnectionString()
/// An HTTP address in the format: http://hostname:port.
public string GetManagementEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(NatsBuilder.NatsHttpManagementPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(NatsBuilder.NatsHttpManagementPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Nats/Testcontainers.Nats.csproj b/src/Testcontainers.Nats/Testcontainers.Nats.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Nats/Testcontainers.Nats.csproj
+++ b/src/Testcontainers.Nats/Testcontainers.Nats.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Nats/Usings.cs b/src/Testcontainers.Nats/Usings.cs
index f82c6873d..e8535f53b 100644
--- a/src/Testcontainers.Nats/Usings.cs
+++ b/src/Testcontainers.Nats/Usings.cs
@@ -5,4 +5,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Neo4j/Neo4jBuilder.cs b/src/Testcontainers.Neo4j/Neo4jBuilder.cs
index 399076936..f92f658cf 100644
--- a/src/Testcontainers.Neo4j/Neo4jBuilder.cs
+++ b/src/Testcontainers.Neo4j/Neo4jBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Neo4j;
///
[PublicAPI]
-public sealed class Neo4jBuilder : ContainerBuilder
+public sealed class Neo4jBuilder
+ : ContainerBuilder
{
public const string Neo4jImage = "neo4j:5.4";
@@ -33,7 +34,8 @@ private Neo4jBuilder(Neo4jConfiguration resourceConfiguration)
protected override Neo4jConfiguration DockerResourceConfiguration { get; }
///
- protected override string AcceptLicenseAgreementEnvVar { get; } = "NEO4J_ACCEPT_LICENSE_AGREEMENT";
+ protected override string AcceptLicenseAgreementEnvVar { get; } =
+ "NEO4J_ACCEPT_LICENSE_AGREEMENT";
///
protected override string AcceptLicenseAgreement { get; } = "yes";
@@ -84,18 +86,32 @@ public Neo4jBuilder WithEnterpriseEdition(bool acceptLicenseAgreement)
else if (image.MatchVersion(v => Array.Exists(operatingSystems, v.Contains)))
{
MatchEvaluator evaluator = match => $"{enterpriseSuffix}-{match.Value}";
- tag = Regex.Replace(image.Tag, string.Join("|", operatingSystems), evaluator, RegexOptions.None, TimeSpan.FromSeconds(1));
+ tag = Regex.Replace(
+ image.Tag,
+ string.Join("|", operatingSystems),
+ evaluator,
+ RegexOptions.None,
+ TimeSpan.FromSeconds(1)
+ );
}
else
{
tag = $"{image.Tag}-{enterpriseSuffix}";
}
- var enterpriseImage = new DockerImage(image.Repository, image.Registry, tag, tag == null ? image.Digest : null);
+ var enterpriseImage = new DockerImage(
+ image.Repository,
+ image.Registry,
+ tag,
+ tag == null ? image.Digest : null
+ );
- var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement;
+ var licenseAgreement = acceptLicenseAgreement
+ ? AcceptLicenseAgreement
+ : DeclineLicenseAgreement;
- return WithImage(enterpriseImage).WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
+ return WithImage(enterpriseImage)
+ .WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
}
///
@@ -112,11 +128,26 @@ protected override void Validate()
base.Validate();
- Predicate licenseAgreementNotAccepted = value => value.Image.Tag != null && value.Image.Tag.Contains("enterprise")
- && (!value.Environments.TryGetValue(AcceptLicenseAgreementEnvVar, out var licenseAgreementValue) || !AcceptLicenseAgreement.Equals(licenseAgreementValue, StringComparison.Ordinal));
-
- _ = Guard.Argument(DockerResourceConfiguration, nameof(DockerResourceConfiguration.Image))
- .ThrowIf(argument => licenseAgreementNotAccepted(argument.Value), argument => throw new ArgumentException(string.Format(message, DockerResourceConfiguration.Image.FullName), argument.Name));
+ Predicate licenseAgreementNotAccepted = value =>
+ value.Image.Tag != null
+ && value.Image.Tag.Contains("enterprise")
+ && (
+ !value.Environments.TryGetValue(
+ AcceptLicenseAgreementEnvVar,
+ out var licenseAgreementValue
+ ) || !AcceptLicenseAgreement.Equals(licenseAgreementValue, StringComparison.Ordinal)
+ );
+
+ _ = Guard
+ .Argument(DockerResourceConfiguration, nameof(DockerResourceConfiguration.Image))
+ .ThrowIf(
+ argument => licenseAgreementNotAccepted(argument.Value),
+ argument =>
+ throw new ArgumentException(
+ string.Format(message, DockerResourceConfiguration.Image.FullName),
+ argument.Name
+ )
+ );
}
///
@@ -127,12 +158,18 @@ protected override Neo4jBuilder Init()
.WithPortBinding(Neo4jHttpPort, true)
.WithPortBinding(Neo4jBoltPort, true)
.WithEnvironment("NEO4J_AUTH", "none")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/").ForPort(Neo4jHttpPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/").ForPort(Neo4jHttpPort)
+ )
+ );
}
///
- protected override Neo4jBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override Neo4jBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new Neo4jConfiguration(resourceConfiguration));
}
@@ -148,4 +185,4 @@ protected override Neo4jBuilder Merge(Neo4jConfiguration oldValue, Neo4jConfigur
{
return new Neo4jBuilder(new Neo4jConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Neo4j/Neo4jConfiguration.cs b/src/Testcontainers.Neo4j/Neo4jConfiguration.cs
index 422e695ee..15be4e2a1 100644
--- a/src/Testcontainers.Neo4j/Neo4jConfiguration.cs
+++ b/src/Testcontainers.Neo4j/Neo4jConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class Neo4jConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public Neo4jConfiguration()
- {
- }
+ public Neo4jConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public Neo4jConfiguration(IResourceConfiguration resourceConfiguration)
+ public Neo4jConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public Neo4jConfiguration(Neo4jConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public Neo4jConfiguration(Neo4jConfiguration oldValue, Neo4jConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Neo4j/Neo4jContainer.cs b/src/Testcontainers.Neo4j/Neo4jContainer.cs
index cbc5c7e35..fb723701e 100644
--- a/src/Testcontainers.Neo4j/Neo4jContainer.cs
+++ b/src/Testcontainers.Neo4j/Neo4jContainer.cs
@@ -9,9 +9,7 @@ public sealed class Neo4jContainer : DockerContainer
///
/// The container configuration.
public Neo4jContainer(Neo4jConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Neo4j connection string.
@@ -19,6 +17,10 @@ public Neo4jContainer(Neo4jConfiguration configuration)
/// The Neo4j connection string.
public string GetConnectionString()
{
- return new UriBuilder("neo4j", Hostname, GetMappedPublicPort(Neo4jBuilder.Neo4jBoltPort)).ToString();
+ return new UriBuilder(
+ "neo4j",
+ Hostname,
+ GetMappedPublicPort(Neo4jBuilder.Neo4jBoltPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Neo4j/Testcontainers.Neo4j.csproj b/src/Testcontainers.Neo4j/Testcontainers.Neo4j.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Neo4j/Testcontainers.Neo4j.csproj
+++ b/src/Testcontainers.Neo4j/Testcontainers.Neo4j.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Neo4j/Usings.cs b/src/Testcontainers.Neo4j/Usings.cs
index 271ad97d9..7d6803788 100644
--- a/src/Testcontainers.Neo4j/Usings.cs
+++ b/src/Testcontainers.Neo4j/Usings.cs
@@ -6,4 +6,4 @@
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using DotNet.Testcontainers.Images;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Ollama/OllamaBuilder.cs b/src/Testcontainers.Ollama/OllamaBuilder.cs
index 0001de7b8..ca4250b16 100644
--- a/src/Testcontainers.Ollama/OllamaBuilder.cs
+++ b/src/Testcontainers.Ollama/OllamaBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Ollama;
///
[PublicAPI]
-public sealed class OllamaBuilder : ContainerBuilder
+public sealed class OllamaBuilder
+ : ContainerBuilder
{
public const string OllamaImage = "ollama/ollama:0.6.6";
@@ -43,12 +44,18 @@ protected override OllamaBuilder Init()
return base.Init()
.WithImage(OllamaImage)
.WithPortBinding(OllamaPort, true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/api/version").ForPort(OllamaPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/api/version").ForPort(OllamaPort)
+ )
+ );
}
///
- protected override OllamaBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override OllamaBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new OllamaConfiguration(resourceConfiguration));
}
@@ -60,8 +67,11 @@ protected override OllamaBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override OllamaBuilder Merge(OllamaConfiguration oldValue, OllamaConfiguration newValue)
+ protected override OllamaBuilder Merge(
+ OllamaConfiguration oldValue,
+ OllamaConfiguration newValue
+ )
{
return new OllamaBuilder(new OllamaConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Ollama/OllamaConfiguration.cs b/src/Testcontainers.Ollama/OllamaConfiguration.cs
index c520558e4..c4912dfb0 100644
--- a/src/Testcontainers.Ollama/OllamaConfiguration.cs
+++ b/src/Testcontainers.Ollama/OllamaConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class OllamaConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public OllamaConfiguration()
- {
- }
+ public OllamaConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public OllamaConfiguration(IResourceConfiguration resourceConfiguration)
+ public OllamaConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public OllamaConfiguration(OllamaConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public OllamaConfiguration(OllamaConfiguration oldValue, OllamaConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Ollama/OllamaContainer.cs b/src/Testcontainers.Ollama/OllamaContainer.cs
index 0effcf125..af35efd7c 100644
--- a/src/Testcontainers.Ollama/OllamaContainer.cs
+++ b/src/Testcontainers.Ollama/OllamaContainer.cs
@@ -9,9 +9,7 @@ public sealed class OllamaContainer : DockerContainer
///
/// The container configuration.
public OllamaContainer(OllamaConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Ollama base address.
@@ -19,6 +17,10 @@ public OllamaContainer(OllamaConfiguration configuration)
/// The Ollama base address.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(OllamaBuilder.OllamaPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(OllamaBuilder.OllamaPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Ollama/Testcontainers.Ollama.csproj b/src/Testcontainers.Ollama/Testcontainers.Ollama.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Ollama/Testcontainers.Ollama.csproj
+++ b/src/Testcontainers.Ollama/Testcontainers.Ollama.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Ollama/Usings.cs b/src/Testcontainers.Ollama/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.Ollama/Usings.cs
+++ b/src/Testcontainers.Ollama/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.OpenSearch/OpenSearchBuilder.cs b/src/Testcontainers.OpenSearch/OpenSearchBuilder.cs
index 50f1e4e5a..1e0c3a0fa 100644
--- a/src/Testcontainers.OpenSearch/OpenSearchBuilder.cs
+++ b/src/Testcontainers.OpenSearch/OpenSearchBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.OpenSearch;
///
[PublicAPI]
-public sealed class OpenSearchBuilder : ContainerBuilder
+public sealed class OpenSearchBuilder
+ : ContainerBuilder
{
public const string OpenSearchImage = "opensearchproject/opensearch:2.12.0";
@@ -70,8 +71,14 @@ public OpenSearchBuilder WithPassword(string password)
/// A configured instance of .
public OpenSearchBuilder WithSecurityEnabled(bool securityEnabled = true)
{
- return Merge(DockerResourceConfiguration, new OpenSearchConfiguration(tlsEnabled: securityEnabled))
- .WithEnvironment("plugins.security.disabled", (!securityEnabled).ToString().ToLowerInvariant());
+ return Merge(
+ DockerResourceConfiguration,
+ new OpenSearchConfiguration(tlsEnabled: securityEnabled)
+ )
+ .WithEnvironment(
+ "plugins.security.disabled",
+ (!securityEnabled).ToString().ToLowerInvariant()
+ );
}
///
@@ -98,7 +105,13 @@ public override OpenSearchContainer Build()
// By default, the base builder waits until the container is running. However, for OpenSearch, a more advanced waiting strategy is necessary that requires access to the password.
// If the user does not provide a custom waiting strategy, append the default OpenSearch waiting strategy.
- openSearchBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? openSearchBuilder : openSearchBuilder.WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration)));
+ openSearchBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? openSearchBuilder
+ : openSearchBuilder.WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
+ );
return new OpenSearchContainer(openSearchBuilder.DockerResourceConfiguration);
}
@@ -121,25 +134,40 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override OpenSearchBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override OpenSearchBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new OpenSearchConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new OpenSearchConfiguration(resourceConfiguration)
+ );
}
///
protected override OpenSearchBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new OpenSearchConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new OpenSearchConfiguration(resourceConfiguration)
+ );
}
///
- protected override OpenSearchBuilder Merge(OpenSearchConfiguration oldValue, OpenSearchConfiguration newValue)
+ protected override OpenSearchBuilder Merge(
+ OpenSearchConfiguration oldValue,
+ OpenSearchConfiguration newValue
+ )
{
return new OpenSearchBuilder(new OpenSearchConfiguration(oldValue, newValue));
}
@@ -189,8 +217,7 @@ public async Task UntilAsync(IContainer container)
.WithBasicAuthentication(_username, _password)
.ForPort(OpenSearchRestApiPort);
- return await httpWaitStrategy.UntilAsync(container)
- .ConfigureAwait(false);
+ return await httpWaitStrategy.UntilAsync(container).ConfigureAwait(false);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.OpenSearch/OpenSearchConfiguration.cs b/src/Testcontainers.OpenSearch/OpenSearchConfiguration.cs
index 613b75cb1..ac21644d5 100644
--- a/src/Testcontainers.OpenSearch/OpenSearchConfiguration.cs
+++ b/src/Testcontainers.OpenSearch/OpenSearchConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class OpenSearchConfiguration : ContainerConfiguration
public OpenSearchConfiguration(
bool? tlsEnabled = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
TlsEnabled = tlsEnabled;
Username = username;
@@ -24,35 +25,34 @@ public OpenSearchConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public OpenSearchConfiguration(IResourceConfiguration resourceConfiguration)
- : base(resourceConfiguration)
- {
- }
+ public OpenSearchConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
+ : base(resourceConfiguration) { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
public OpenSearchConfiguration(IContainerConfiguration resourceConfiguration)
- : base(resourceConfiguration)
- {
- }
+ : base(resourceConfiguration) { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
public OpenSearchConfiguration(OpenSearchConfiguration resourceConfiguration)
- : this(new OpenSearchConfiguration(), resourceConfiguration)
- {
- }
+ : this(new OpenSearchConfiguration(), resourceConfiguration) { }
///
/// Initializes a new instance of the class.
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public OpenSearchConfiguration(OpenSearchConfiguration oldValue, OpenSearchConfiguration newValue)
+ public OpenSearchConfiguration(
+ OpenSearchConfiguration oldValue,
+ OpenSearchConfiguration newValue
+ )
: base(oldValue, newValue)
{
TlsEnabled = BuildConfiguration.Combine(oldValue.TlsEnabled, newValue.TlsEnabled);
@@ -74,4 +74,4 @@ public OpenSearchConfiguration(OpenSearchConfiguration oldValue, OpenSearchConfi
/// Gets the OpenSearch password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.OpenSearch/OpenSearchContainer.cs b/src/Testcontainers.OpenSearch/OpenSearchContainer.cs
index 49213a424..a8c9abc11 100644
--- a/src/Testcontainers.OpenSearch/OpenSearchContainer.cs
+++ b/src/Testcontainers.OpenSearch/OpenSearchContainer.cs
@@ -31,7 +31,13 @@ public NetworkCredential GetCredentials()
/// The OpenSearch connection string.
public string GetConnectionString()
{
- var schema = _configuration.TlsEnabled.GetValueOrDefault() ? Uri.UriSchemeHttps : Uri.UriSchemeHttp;
- return new UriBuilder(schema, Hostname, GetMappedPublicPort(OpenSearchBuilder.OpenSearchRestApiPort)).ToString();
+ var schema = _configuration.TlsEnabled.GetValueOrDefault()
+ ? Uri.UriSchemeHttps
+ : Uri.UriSchemeHttp;
+ return new UriBuilder(
+ schema,
+ Hostname,
+ GetMappedPublicPort(OpenSearchBuilder.OpenSearchRestApiPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.OpenSearch/Testcontainers.OpenSearch.csproj b/src/Testcontainers.OpenSearch/Testcontainers.OpenSearch.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.OpenSearch/Testcontainers.OpenSearch.csproj
+++ b/src/Testcontainers.OpenSearch/Testcontainers.OpenSearch.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.OpenSearch/Usings.cs b/src/Testcontainers.OpenSearch/Usings.cs
index ca1247a6e..55c0c4d26 100644
--- a/src/Testcontainers.OpenSearch/Usings.cs
+++ b/src/Testcontainers.OpenSearch/Usings.cs
@@ -8,4 +8,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Oracle/OracleBuilder.cs b/src/Testcontainers.Oracle/OracleBuilder.cs
index e6c5710b5..ec80d2575 100644
--- a/src/Testcontainers.Oracle/OracleBuilder.cs
+++ b/src/Testcontainers.Oracle/OracleBuilder.cs
@@ -2,13 +2,16 @@ namespace Testcontainers.Oracle;
///
[PublicAPI]
-public sealed class OracleBuilder : ContainerBuilder
+public sealed class OracleBuilder
+ : ContainerBuilder
{
public const string OracleImage = "gvenzl/oracle-xe:21.3.0-slim-faststart";
public const ushort OraclePort = 1521;
- [Obsolete("This constant is obsolete and should not be used. It is only applicable for Oracle images between versions 11 and 22.")]
+ [Obsolete(
+ "This constant is obsolete and should not be used. It is only applicable for Oracle images between versions 11 and 22."
+ )]
public const string DefaultDatabase = "XEPDB1";
public const string DefaultUsername = "oracle";
@@ -81,12 +84,19 @@ public override OracleContainer Build()
var defaultServiceName = GetDefaultServiceName();
if (DockerResourceConfiguration.Database == null)
{
- return new OracleContainer(WithDatabase(defaultServiceName).DockerResourceConfiguration);
+ return new OracleContainer(
+ WithDatabase(defaultServiceName).DockerResourceConfiguration
+ );
}
if (DockerResourceConfiguration.Database != defaultServiceName)
{
- return new OracleContainer(WithEnvironment("ORACLE_DATABASE", DockerResourceConfiguration.Database).DockerResourceConfiguration);
+ return new OracleContainer(
+ WithEnvironment(
+ "ORACLE_DATABASE",
+ DockerResourceConfiguration.Database
+ ).DockerResourceConfiguration
+ );
}
return new OracleContainer(DockerResourceConfiguration);
@@ -100,7 +110,9 @@ protected override OracleBuilder Init()
.WithPortBinding(OraclePort, true)
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("DATABASE IS READY TO USE!"));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("DATABASE IS READY TO USE!")
+ );
}
///
@@ -108,25 +120,43 @@ protected override void Validate()
{
base.Validate();
- const string message = "The image '{0}' does not support configuring the database. It is only supported on Oracle 18 and onwards.";
+ const string message =
+ "The image '{0}' does not support configuring the database. It is only supported on Oracle 18 and onwards.";
Predicate databaseConfigurationNotSupported = value =>
value.Database != null && value.Image.MatchVersion(v => v.Major < 18);
- _ = Guard.Argument(DockerResourceConfiguration, nameof(DockerResourceConfiguration.Database))
- .ThrowIf(argument => databaseConfigurationNotSupported(argument.Value), _ => throw new NotSupportedException(string.Format(message, DockerResourceConfiguration.Image.FullName)));
-
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(DockerResourceConfiguration, nameof(DockerResourceConfiguration.Database))
+ .ThrowIf(
+ argument => databaseConfigurationNotSupported(argument.Value),
+ _ =>
+ throw new NotSupportedException(
+ string.Format(message, DockerResourceConfiguration.Image.FullName)
+ )
+ );
+
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override OracleBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override OracleBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new OracleConfiguration(resourceConfiguration));
}
@@ -138,7 +168,10 @@ protected override OracleBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override OracleBuilder Merge(OracleConfiguration oldValue, OracleConfiguration newValue)
+ protected override OracleBuilder Merge(
+ OracleConfiguration oldValue,
+ OracleConfiguration newValue
+ )
{
return new OracleBuilder(new OracleConfiguration(oldValue, newValue));
}
@@ -157,4 +190,4 @@ private string GetDefaultServiceName()
return "XE";
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Oracle/OracleConfiguration.cs b/src/Testcontainers.Oracle/OracleConfiguration.cs
index 815b033f2..bc9484724 100644
--- a/src/Testcontainers.Oracle/OracleConfiguration.cs
+++ b/src/Testcontainers.Oracle/OracleConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class OracleConfiguration : ContainerConfiguration
public OracleConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public OracleConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public OracleConfiguration(IResourceConfiguration resourceConfiguration)
+ public OracleConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -77,4 +80,4 @@ public OracleConfiguration(OracleConfiguration oldValue, OracleConfiguration new
/// Gets the Oracle password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Oracle/OracleContainer.cs b/src/Testcontainers.Oracle/OracleContainer.cs
index 54eac0c72..7bfd64db9 100644
--- a/src/Testcontainers.Oracle/OracleContainer.cs
+++ b/src/Testcontainers.Oracle/OracleContainer.cs
@@ -22,8 +22,16 @@ public OracleContainer(OracleConfiguration configuration)
/// The Oracle connection string.
public string GetConnectionString()
{
- const string dataSource = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVICE_NAME={2})));User Id={3};Password={4};";
- return string.Format(dataSource, Hostname, GetMappedPublicPort(OracleBuilder.OraclePort), _configuration.Database, _configuration.Username, _configuration.Password);
+ const string dataSource =
+ "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVICE_NAME={2})));User Id={3};Password={4};";
+ return string.Format(
+ dataSource,
+ Hostname,
+ GetMappedPublicPort(OracleBuilder.OraclePort),
+ _configuration.Database,
+ _configuration.Username,
+ _configuration.Password
+ );
}
///
@@ -32,14 +40,36 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "/bin/sh", "-c", $"exit | sqlplus -LOGON -SILENT {_configuration.Username}/{_configuration.Password}@localhost:1521/{_configuration.Database} @{scriptFilePath}" }, ct)
+ return await ExecAsync(
+ new[]
+ {
+ "/bin/sh",
+ "-c",
+ $"exit | sqlplus -LOGON -SILENT {_configuration.Username}/{_configuration.Password}@localhost:1521/{_configuration.Database} @{scriptFilePath}",
+ },
+ ct
+ )
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Oracle/Testcontainers.Oracle.csproj b/src/Testcontainers.Oracle/Testcontainers.Oracle.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Oracle/Testcontainers.Oracle.csproj
+++ b/src/Testcontainers.Oracle/Testcontainers.Oracle.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Oracle/Usings.cs b/src/Testcontainers.Oracle/Usings.cs
index 6fe3559a7..43011e602 100644
--- a/src/Testcontainers.Oracle/Usings.cs
+++ b/src/Testcontainers.Oracle/Usings.cs
@@ -8,4 +8,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Papercut/PapercutBuilder.cs b/src/Testcontainers.Papercut/PapercutBuilder.cs
index 69293818d..690aab7c8 100644
--- a/src/Testcontainers.Papercut/PapercutBuilder.cs
+++ b/src/Testcontainers.Papercut/PapercutBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Papercut;
///
[PublicAPI]
-public sealed class PapercutBuilder : ContainerBuilder
+public sealed class PapercutBuilder
+ : ContainerBuilder
{
public const string PapercutImage = "changemakerstudiosus/papercut-smtp:latest";
@@ -46,12 +47,21 @@ protected override PapercutBuilder Init()
.WithImage(PapercutImage)
.WithPortBinding(SmtpPort, true)
.WithPortBinding(HttpPort, true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/health").ForPort(HttpPort).ForResponseMessageMatching(IsInstanceHealthyAsync)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request
+ .ForPath("/health")
+ .ForPort(HttpPort)
+ .ForResponseMessageMatching(IsInstanceHealthyAsync)
+ )
+ );
}
///
- protected override PapercutBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override PapercutBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new PapercutConfiguration(resourceConfiguration));
}
@@ -63,7 +73,10 @@ protected override PapercutBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override PapercutBuilder Merge(PapercutConfiguration oldValue, PapercutConfiguration newValue)
+ protected override PapercutBuilder Merge(
+ PapercutConfiguration oldValue,
+ PapercutConfiguration newValue
+ )
{
return new PapercutBuilder(new PapercutConfiguration(oldValue, newValue));
}
@@ -75,9 +88,11 @@ protected override PapercutBuilder Merge(PapercutConfiguration oldValue, Papercu
/// A value indicating whether the instance is healthy or not.
private static async Task IsInstanceHealthyAsync(HttpResponseMessage response)
{
- var body = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var body = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
- return "Papercut WebUI server started successfully.".Equals(body, StringComparison.OrdinalIgnoreCase);
+ return "Papercut WebUI server started successfully.".Equals(
+ body,
+ StringComparison.OrdinalIgnoreCase
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Papercut/PapercutConfiguration.cs b/src/Testcontainers.Papercut/PapercutConfiguration.cs
index 6582a0276..aac9809eb 100644
--- a/src/Testcontainers.Papercut/PapercutConfiguration.cs
+++ b/src/Testcontainers.Papercut/PapercutConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class PapercutConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public PapercutConfiguration()
- {
- }
+ public PapercutConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public PapercutConfiguration(IResourceConfiguration resourceConfiguration)
+ public PapercutConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public PapercutConfiguration(PapercutConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public PapercutConfiguration(PapercutConfiguration oldValue, PapercutConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Papercut/PapercutContainer.cs b/src/Testcontainers.Papercut/PapercutContainer.cs
index 2ad934865..4ec077f2d 100644
--- a/src/Testcontainers.Papercut/PapercutContainer.cs
+++ b/src/Testcontainers.Papercut/PapercutContainer.cs
@@ -9,9 +9,7 @@ public sealed class PapercutContainer : DockerContainer
///
/// The container configuration.
public PapercutContainer(PapercutConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the SMTP port.
@@ -24,6 +22,10 @@ public PapercutContainer(PapercutConfiguration configuration)
/// The Papercut base address.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(PapercutBuilder.HttpPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(PapercutBuilder.HttpPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Papercut/Testcontainers.Papercut.csproj b/src/Testcontainers.Papercut/Testcontainers.Papercut.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Papercut/Testcontainers.Papercut.csproj
+++ b/src/Testcontainers.Papercut/Testcontainers.Papercut.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Papercut/Usings.cs b/src/Testcontainers.Papercut/Usings.cs
index 2dfa21a9b..3e36f0c5e 100644
--- a/src/Testcontainers.Papercut/Usings.cs
+++ b/src/Testcontainers.Papercut/Usings.cs
@@ -5,4 +5,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.PostgreSql/PostgreSqlBuilder.cs b/src/Testcontainers.PostgreSql/PostgreSqlBuilder.cs
index 73ec3a317..2757303eb 100644
--- a/src/Testcontainers.PostgreSql/PostgreSqlBuilder.cs
+++ b/src/Testcontainers.PostgreSql/PostgreSqlBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.PostgreSql;
///
[PublicAPI]
-public sealed class PostgreSqlBuilder : ContainerBuilder
+public sealed class PostgreSqlBuilder
+ : ContainerBuilder
{
public const string PostgreSqlImage = "postgres:15.1";
@@ -76,7 +77,13 @@ public override PostgreSqlContainer Build()
// By default, the base builder waits until the container is running. However, for PostgreSql, a more advanced waiting strategy is necessary that requires access to the configured database and username.
// If the user does not provide a custom waiting strategy, append the default PostgreSql waiting strategy.
- var postgreSqlBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration)));
+ var postgreSqlBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
+ );
return new PostgreSqlContainer(postgreSqlBuilder.DockerResourceConfiguration);
}
@@ -100,25 +107,40 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override PostgreSqlBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override PostgreSqlBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new PostgreSqlConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new PostgreSqlConfiguration(resourceConfiguration)
+ );
}
///
protected override PostgreSqlBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new PostgreSqlConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new PostgreSqlConfiguration(resourceConfiguration)
+ );
}
///
- protected override PostgreSqlBuilder Merge(PostgreSqlConfiguration oldValue, PostgreSqlConfiguration newValue)
+ protected override PostgreSqlBuilder Merge(
+ PostgreSqlConfiguration oldValue,
+ PostgreSqlConfiguration newValue
+ )
{
return new PostgreSqlBuilder(new PostgreSqlConfiguration(oldValue, newValue));
}
@@ -135,7 +157,16 @@ private sealed class WaitUntil : IWaitUntil
public WaitUntil(PostgreSqlConfiguration configuration)
{
// Explicitly specify the host to ensure readiness only after the initdb scripts have executed, and the server is listening on TCP/IP.
- _command = new List { "pg_isready", "--host", "localhost", "--dbname", configuration.Database, "--username", configuration.Username };
+ _command = new List
+ {
+ "pg_isready",
+ "--host",
+ "localhost",
+ "--dbname",
+ configuration.Database,
+ "--username",
+ configuration.Username,
+ };
}
///
@@ -149,15 +180,16 @@ public WaitUntil(PostgreSqlConfiguration configuration)
/// Thrown when the PostgreSql image does not contain pg_isready.
public async Task UntilAsync(IContainer container)
{
- var execResult = await container.ExecAsync(_command)
- .ConfigureAwait(false);
+ var execResult = await container.ExecAsync(_command).ConfigureAwait(false);
if (execResult.Stderr.Contains("pg_isready was not found"))
{
- throw new NotSupportedException($"The '{container.Image.FullName}' image does not contain: pg_isready. Please use 'postgres:9.3' onwards.");
+ throw new NotSupportedException(
+ $"The '{container.Image.FullName}' image does not contain: pg_isready. Please use 'postgres:9.3' onwards."
+ );
}
return 0L.Equals(execResult.ExitCode);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.PostgreSql/PostgreSqlConfiguration.cs b/src/Testcontainers.PostgreSql/PostgreSqlConfiguration.cs
index 05873fe8a..f19a8d8aa 100644
--- a/src/Testcontainers.PostgreSql/PostgreSqlConfiguration.cs
+++ b/src/Testcontainers.PostgreSql/PostgreSqlConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class PostgreSqlConfiguration : ContainerConfiguration
public PostgreSqlConfiguration(
string database = null,
string username = null,
- string password = null)
+ string password = null
+ )
{
Database = database;
Username = username;
@@ -24,7 +25,9 @@ public PostgreSqlConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public PostgreSqlConfiguration(IResourceConfiguration resourceConfiguration)
+ public PostgreSqlConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -55,7 +58,10 @@ public PostgreSqlConfiguration(PostgreSqlConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public PostgreSqlConfiguration(PostgreSqlConfiguration oldValue, PostgreSqlConfiguration newValue)
+ public PostgreSqlConfiguration(
+ PostgreSqlConfiguration oldValue,
+ PostgreSqlConfiguration newValue
+ )
: base(oldValue, newValue)
{
Database = BuildConfiguration.Combine(oldValue.Database, newValue.Database);
@@ -77,4 +83,4 @@ public PostgreSqlConfiguration(PostgreSqlConfiguration oldValue, PostgreSqlConfi
/// Gets the PostgreSql password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.PostgreSql/PostgreSqlContainer.cs b/src/Testcontainers.PostgreSql/PostgreSqlContainer.cs
index b4ebdf8a9..b5bd51304 100644
--- a/src/Testcontainers.PostgreSql/PostgreSqlContainer.cs
+++ b/src/Testcontainers.PostgreSql/PostgreSqlContainer.cs
@@ -28,7 +28,10 @@ public string GetConnectionString()
properties.Add("Database", _configuration.Database);
properties.Add("Username", _configuration.Username);
properties.Add("Password", _configuration.Password);
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
///
@@ -37,14 +40,40 @@ public string GetConnectionString()
/// The content of the SQL script to execute.
/// Cancellation token.
/// Task that completes when the SQL script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
- return await ExecAsync(new[] { "psql", "--username", _configuration.Username, "--dbname", _configuration.Database, "--file", scriptFilePath }, ct)
+ return await ExecAsync(
+ new[]
+ {
+ "psql",
+ "--username",
+ _configuration.Username,
+ "--dbname",
+ _configuration.Database,
+ "--file",
+ scriptFilePath,
+ },
+ ct
+ )
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.PostgreSql/Testcontainers.PostgreSql.csproj b/src/Testcontainers.PostgreSql/Testcontainers.PostgreSql.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.PostgreSql/Testcontainers.PostgreSql.csproj
+++ b/src/Testcontainers.PostgreSql/Testcontainers.PostgreSql.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.PostgreSql/Usings.cs b/src/Testcontainers.PostgreSql/Usings.cs
index e2b02a51e..3481268bc 100644
--- a/src/Testcontainers.PostgreSql/Usings.cs
+++ b/src/Testcontainers.PostgreSql/Usings.cs
@@ -10,4 +10,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.PubSub/PubSubBuilder.cs b/src/Testcontainers.PubSub/PubSubBuilder.cs
index 3956e8a13..18dd418a3 100644
--- a/src/Testcontainers.PubSub/PubSubBuilder.cs
+++ b/src/Testcontainers.PubSub/PubSubBuilder.cs
@@ -2,9 +2,11 @@ namespace Testcontainers.PubSub;
///
[PublicAPI]
-public sealed class PubSubBuilder : ContainerBuilder
+public sealed class PubSubBuilder
+ : ContainerBuilder
{
- public const string GoogleCloudCliImage = "gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators";
+ public const string GoogleCloudCliImage =
+ "gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators";
public const ushort PubSubPort = 8085;
@@ -44,12 +46,21 @@ protected override PubSubBuilder Init()
.WithImage(GoogleCloudCliImage)
.WithPortBinding(PubSubPort, true)
.WithEntrypoint("gcloud")
- .WithCommand("beta", "emulators", "pubsub", "start", "--host-port", "0.0.0.0:" + PubSubPort)
+ .WithCommand(
+ "beta",
+ "emulators",
+ "pubsub",
+ "start",
+ "--host-port",
+ "0.0.0.0:" + PubSubPort
+ )
.WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("(?s).*started.*$"));
}
///
- protected override PubSubBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override PubSubBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new PubSubConfiguration(resourceConfiguration));
}
@@ -61,8 +72,11 @@ protected override PubSubBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override PubSubBuilder Merge(PubSubConfiguration oldValue, PubSubConfiguration newValue)
+ protected override PubSubBuilder Merge(
+ PubSubConfiguration oldValue,
+ PubSubConfiguration newValue
+ )
{
return new PubSubBuilder(new PubSubConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.PubSub/PubSubConfiguration.cs b/src/Testcontainers.PubSub/PubSubConfiguration.cs
index f093f497b..eae320365 100644
--- a/src/Testcontainers.PubSub/PubSubConfiguration.cs
+++ b/src/Testcontainers.PubSub/PubSubConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class PubSubConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public PubSubConfiguration()
- {
- }
+ public PubSubConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public PubSubConfiguration(IResourceConfiguration resourceConfiguration)
+ public PubSubConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public PubSubConfiguration(PubSubConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public PubSubConfiguration(PubSubConfiguration oldValue, PubSubConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.PubSub/PubSubContainer.cs b/src/Testcontainers.PubSub/PubSubContainer.cs
index b3a8e7ec6..c70aee851 100644
--- a/src/Testcontainers.PubSub/PubSubContainer.cs
+++ b/src/Testcontainers.PubSub/PubSubContainer.cs
@@ -9,9 +9,7 @@ public sealed class PubSubContainer : DockerContainer
///
/// The container configuration.
public PubSubContainer(PubSubConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the PubSub emulator endpoint.
@@ -19,6 +17,10 @@ public PubSubContainer(PubSubConfiguration configuration)
/// The PubSub emulator endpoint.
public string GetEmulatorEndpoint()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(PubSubBuilder.PubSubPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(PubSubBuilder.PubSubPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.PubSub/Testcontainers.PubSub.csproj b/src/Testcontainers.PubSub/Testcontainers.PubSub.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.PubSub/Testcontainers.PubSub.csproj
+++ b/src/Testcontainers.PubSub/Testcontainers.PubSub.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.PubSub/Usings.cs b/src/Testcontainers.PubSub/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.PubSub/Usings.cs
+++ b/src/Testcontainers.PubSub/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Pulsar/PulsarBuilder.cs b/src/Testcontainers.Pulsar/PulsarBuilder.cs
index 23218b1ea..6cf7150db 100644
--- a/src/Testcontainers.Pulsar/PulsarBuilder.cs
+++ b/src/Testcontainers.Pulsar/PulsarBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Pulsar;
///
[PublicAPI]
-public sealed class PulsarBuilder : ContainerBuilder
+public sealed class PulsarBuilder
+ : ContainerBuilder
{
public const string PulsarImage = "apachepulsar/pulsar:3.0.9";
@@ -16,7 +17,8 @@ public sealed class PulsarBuilder : ContainerBuilder AuthenticationEnvVars = InitAuthenticationEnvVars();
+ private static readonly IReadOnlyDictionary AuthenticationEnvVars =
+ InitAuthenticationEnvVars();
///
/// Initializes a new instance of the class.
@@ -49,7 +51,10 @@ private PulsarBuilder(PulsarConfiguration resourceConfiguration)
/// A configured instance of .
public PulsarBuilder WithAuthentication()
{
- return Merge(DockerResourceConfiguration, new PulsarConfiguration(authenticationEnabled: true))
+ return Merge(
+ DockerResourceConfiguration,
+ new PulsarConfiguration(authenticationEnabled: true)
+ )
.WithEnvironment(AuthenticationEnvVars);
}
@@ -60,7 +65,10 @@ public PulsarBuilder WithAuthentication()
/// A configured instance of .
public PulsarBuilder WithFunctionsWorker(bool functionsWorkerEnabled = true)
{
- return Merge(DockerResourceConfiguration, new PulsarConfiguration(functionsWorkerEnabled: functionsWorkerEnabled));
+ return Merge(
+ DockerResourceConfiguration,
+ new PulsarConfiguration(functionsWorkerEnabled: functionsWorkerEnabled)
+ );
}
///
@@ -80,9 +88,14 @@ public override PulsarContainer Build()
waitStrategy = waitStrategy.UntilMessageIsLogged("Function worker service started");
}
- waitStrategy = waitStrategy.AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration.AuthenticationEnabled.GetValueOrDefault()));
+ waitStrategy = waitStrategy.AddCustomWaitStrategy(
+ new WaitUntil(DockerResourceConfiguration.AuthenticationEnabled.GetValueOrDefault())
+ );
- var pulsarBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(waitStrategy);
+ var pulsarBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(waitStrategy);
return new PulsarContainer(pulsarBuilder.DockerResourceConfiguration);
}
@@ -95,12 +108,19 @@ protected override PulsarBuilder Init()
.WithPortBinding(PulsarWebServicePort, true)
.WithFunctionsWorker(false)
.WithEntrypoint("/bin/sh", "-c")
- .WithCommand("while [ ! -f " + StartupScriptFilePath + " ]; do sleep 0.1; done; " + StartupScriptFilePath)
+ .WithCommand(
+ "while [ ! -f "
+ + StartupScriptFilePath
+ + " ]; do sleep 0.1; done; "
+ + StartupScriptFilePath
+ )
.WithStartupCallback((container, ct) => container.CopyStartupScriptAsync(ct));
}
///
- protected override PulsarBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override PulsarBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new PulsarConfiguration(resourceConfiguration));
}
@@ -112,19 +132,26 @@ protected override PulsarBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override PulsarBuilder Merge(PulsarConfiguration oldValue, PulsarConfiguration newValue)
+ protected override PulsarBuilder Merge(
+ PulsarConfiguration oldValue,
+ PulsarConfiguration newValue
+ )
{
return new PulsarBuilder(new PulsarConfiguration(oldValue, newValue));
}
private static IReadOnlyDictionary InitAuthenticationEnvVars()
{
- const string authenticationPlugin = "org.apache.pulsar.client.impl.auth.AuthenticationToken";
+ const string authenticationPlugin =
+ "org.apache.pulsar.client.impl.auth.AuthenticationToken";
var authenticationEnvVars = new Dictionary();
authenticationEnvVars.Add("authenticateOriginalAuthData", "false");
authenticationEnvVars.Add("authenticationEnabled", "true");
authenticationEnvVars.Add("authorizationEnabled", "true");
- authenticationEnvVars.Add("authenticationProviders", "org.apache.pulsar.broker.authentication.AuthenticationProviderToken");
+ authenticationEnvVars.Add(
+ "authenticationProviders",
+ "org.apache.pulsar.broker.authentication.AuthenticationProviderToken"
+ );
authenticationEnvVars.Add("brokerClientAuthenticationPlugin", authenticationPlugin);
authenticationEnvVars.Add("CLIENT_PREFIX_authPlugin", authenticationPlugin);
authenticationEnvVars.Add("PULSAR_PREFIX_authenticationRefreshCheckSeconds", "5");
@@ -167,10 +194,14 @@ private async Task UntilAsync(PulsarContainer container)
{
try
{
- _authToken = await container.CreateAuthenticationTokenAsync(TimeSpan.FromHours(1))
+ _authToken = await container
+ .CreateAuthenticationTokenAsync(TimeSpan.FromHours(1))
.ConfigureAwait(false);
- _ = _httpWaitStrategy.WithHeader("Authorization", "Bearer " + _authToken.Trim());
+ _ = _httpWaitStrategy.WithHeader(
+ "Authorization",
+ "Bearer " + _authToken.Trim()
+ );
}
catch
{
@@ -178,8 +209,7 @@ private async Task UntilAsync(PulsarContainer container)
}
}
- return await _httpWaitStrategy.UntilAsync(container)
- .ConfigureAwait(false);
+ return await _httpWaitStrategy.UntilAsync(container).ConfigureAwait(false);
}
///
@@ -189,14 +219,13 @@ private async Task UntilAsync(PulsarContainer container)
/// A value indicating whether the cluster is healthy or not.
private static async Task IsClusterHealthyAsync(HttpResponseMessage response)
{
- var jsonString = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var jsonString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- var status = JsonDocument.Parse(jsonString)
- .RootElement
- .EnumerateArray()
+ var status = JsonDocument
+ .Parse(jsonString)
+ .RootElement.EnumerateArray()
.ElementAt(0)
.GetString();
@@ -208,4 +237,4 @@ private static async Task IsClusterHealthyAsync(HttpResponseMessage respon
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Pulsar/PulsarConfiguration.cs b/src/Testcontainers.Pulsar/PulsarConfiguration.cs
index 9a290878b..1717d738b 100644
--- a/src/Testcontainers.Pulsar/PulsarConfiguration.cs
+++ b/src/Testcontainers.Pulsar/PulsarConfiguration.cs
@@ -11,7 +11,8 @@ public sealed class PulsarConfiguration : ContainerConfiguration
/// A value indicating whether function workers is enabled or not.
public PulsarConfiguration(
bool? authenticationEnabled = null,
- bool? functionsWorkerEnabled = null)
+ bool? functionsWorkerEnabled = null
+ )
{
AuthenticationEnabled = authenticationEnabled;
FunctionsWorkerEnabled = functionsWorkerEnabled;
@@ -21,7 +22,9 @@ public PulsarConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public PulsarConfiguration(IResourceConfiguration resourceConfiguration)
+ public PulsarConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -55,8 +58,12 @@ public PulsarConfiguration(PulsarConfiguration resourceConfiguration)
public PulsarConfiguration(PulsarConfiguration oldValue, PulsarConfiguration newValue)
: base(oldValue, newValue)
{
- AuthenticationEnabled = (oldValue.AuthenticationEnabled.HasValue && oldValue.AuthenticationEnabled.Value) || (newValue.AuthenticationEnabled.HasValue && newValue.AuthenticationEnabled.Value);
- FunctionsWorkerEnabled = (oldValue.FunctionsWorkerEnabled.HasValue && oldValue.FunctionsWorkerEnabled.Value) || (newValue.FunctionsWorkerEnabled.HasValue && newValue.FunctionsWorkerEnabled.Value);
+ AuthenticationEnabled =
+ (oldValue.AuthenticationEnabled.HasValue && oldValue.AuthenticationEnabled.Value)
+ || (newValue.AuthenticationEnabled.HasValue && newValue.AuthenticationEnabled.Value);
+ FunctionsWorkerEnabled =
+ (oldValue.FunctionsWorkerEnabled.HasValue && oldValue.FunctionsWorkerEnabled.Value)
+ || (newValue.FunctionsWorkerEnabled.HasValue && newValue.FunctionsWorkerEnabled.Value);
}
///
@@ -68,4 +75,4 @@ public PulsarConfiguration(PulsarConfiguration oldValue, PulsarConfiguration new
/// Gets a value indicating whether function workers is enabled or not.
///
public bool? FunctionsWorkerEnabled { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Pulsar/PulsarContainer.cs b/src/Testcontainers.Pulsar/PulsarContainer.cs
index 290a88bdd..0680fd29a 100644
--- a/src/Testcontainers.Pulsar/PulsarContainer.cs
+++ b/src/Testcontainers.Pulsar/PulsarContainer.cs
@@ -22,7 +22,11 @@ public PulsarContainer(PulsarConfiguration configuration)
/// The Pulsar broker address.
public string GetBrokerAddress()
{
- return new UriBuilder("pulsar", Hostname, GetMappedPublicPort(PulsarBuilder.PulsarBrokerDataPort)).ToString();
+ return new UriBuilder(
+ "pulsar",
+ Hostname,
+ GetMappedPublicPort(PulsarBuilder.PulsarBrokerDataPort)
+ ).ToString();
}
///
@@ -31,7 +35,11 @@ public string GetBrokerAddress()
/// The Pulsar web service address.
public string GetServiceAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(PulsarBuilder.PulsarWebServicePort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(PulsarBuilder.PulsarWebServicePort)
+ ).ToString();
}
///
@@ -41,9 +49,15 @@ public string GetServiceAddress()
/// Cancellation token.
/// A task that completes when the authentication token has been created.
///
- public async Task CreateAuthenticationTokenAsync(TimeSpan expiryTime, CancellationToken ct = default)
+ public async Task CreateAuthenticationTokenAsync(
+ TimeSpan expiryTime,
+ CancellationToken ct = default
+ )
{
- if (_configuration.AuthenticationEnabled.HasValue && !_configuration.AuthenticationEnabled.Value)
+ if (
+ _configuration.AuthenticationEnabled.HasValue
+ && !_configuration.AuthenticationEnabled.Value
+ )
{
throw new ArgumentException("Failed to create token. Authentication is not enabled.");
}
@@ -65,7 +79,9 @@ public async Task CreateAuthenticationTokenAsync(TimeSpan expiryTime, Ca
if (_configuration.Image.MatchVersion(IsVersionAffectedByGhIssue22811))
{
- Logger.LogWarning("The 'apachepulsar/pulsar:3.2.0-3' and '3.3.0' images contains a regression. The expiry time is converted to the wrong unit of time: https://github.com/apache/pulsar/issues/22811.");
+ Logger.LogWarning(
+ "The 'apachepulsar/pulsar:3.2.0-3' and '3.3.0' images contains a regression. The expiry time is converted to the wrong unit of time: https://github.com/apache/pulsar/issues/22811."
+ );
secondsToMilliseconds = 1000;
}
else
@@ -77,12 +93,13 @@ public async Task CreateAuthenticationTokenAsync(TimeSpan expiryTime, Ca
command.Add($"{secondsToMilliseconds * expiryTime.TotalSeconds}s");
}
- var tokensResult = await ExecAsync(command, ct)
- .ConfigureAwait(false);
+ var tokensResult = await ExecAsync(command, ct).ConfigureAwait(false);
if (tokensResult.ExitCode != 0)
{
- throw new ArgumentException($"Failed to create token. Command returned a non-zero exit code: {tokensResult.Stderr}.");
+ throw new ArgumentException(
+ $"Failed to create token. Command returned a non-zero exit code: {tokensResult.Stderr}."
+ );
}
return tokensResult.Stdout;
@@ -99,28 +116,51 @@ internal Task CopyStartupScriptAsync(CancellationToken ct = default)
startupScript.NewLine = "\n";
startupScript.WriteLine("#!/bin/bash");
- if (_configuration.AuthenticationEnabled.HasValue && _configuration.AuthenticationEnabled.Value)
+ if (
+ _configuration.AuthenticationEnabled.HasValue
+ && _configuration.AuthenticationEnabled.Value
+ )
{
- startupScript.WriteLine("bin/pulsar tokens create-secret-key --output " + PulsarBuilder.SecretKeyFilePath);
- startupScript.WriteLine("export brokerClientAuthenticationParameters=token:$(bin/pulsar tokens create --secret-key $PULSAR_PREFIX_tokenSecretKey --subject $superUserRoles)");
- startupScript.WriteLine("export CLIENT_PREFIX_authParams=$brokerClientAuthenticationParameters");
+ startupScript.WriteLine(
+ "bin/pulsar tokens create-secret-key --output " + PulsarBuilder.SecretKeyFilePath
+ );
+ startupScript.WriteLine(
+ "export brokerClientAuthenticationParameters=token:$(bin/pulsar tokens create --secret-key $PULSAR_PREFIX_tokenSecretKey --subject $superUserRoles)"
+ );
+ startupScript.WriteLine(
+ "export CLIENT_PREFIX_authParams=$brokerClientAuthenticationParameters"
+ );
startupScript.WriteLine("bin/apply-config-from-env.py conf/standalone.conf");
- startupScript.WriteLine("bin/apply-config-from-env.py --prefix CLIENT_PREFIX_ conf/client.conf");
+ startupScript.WriteLine(
+ "bin/apply-config-from-env.py --prefix CLIENT_PREFIX_ conf/client.conf"
+ );
}
startupScript.Write("bin/pulsar standalone");
- if (_configuration.FunctionsWorkerEnabled.HasValue && !_configuration.FunctionsWorkerEnabled.Value)
+ if (
+ _configuration.FunctionsWorkerEnabled.HasValue
+ && !_configuration.FunctionsWorkerEnabled.Value
+ )
{
startupScript.Write(" --no-functions-worker");
startupScript.Write(" --no-stream-storage");
}
- return CopyAsync(Encoding.Default.GetBytes(startupScript.ToString()), PulsarBuilder.StartupScriptFilePath, Unix.FileMode755, ct);
+ return CopyAsync(
+ Encoding.Default.GetBytes(startupScript.ToString()),
+ PulsarBuilder.StartupScriptFilePath,
+ Unix.FileMode755,
+ ct
+ );
}
private static bool IsVersionAffectedByGhIssue22811(System.Version version)
{
- return version.Major == 3 && ((version.Minor == 2 && version.Build is >= 0 and <= 3) || (version.Minor == 3 && version.Build == 0));
+ return version.Major == 3
+ && (
+ (version.Minor == 2 && version.Build is >= 0 and <= 3)
+ || (version.Minor == 3 && version.Build == 0)
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Pulsar/Testcontainers.Pulsar.csproj b/src/Testcontainers.Pulsar/Testcontainers.Pulsar.csproj
index a108060b3..22a90c564 100644
--- a/src/Testcontainers.Pulsar/Testcontainers.Pulsar.csproj
+++ b/src/Testcontainers.Pulsar/Testcontainers.Pulsar.csproj
@@ -1,12 +1,16 @@
-
- netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Pulsar/Usings.cs b/src/Testcontainers.Pulsar/Usings.cs
index cbed90f27..e00a8360e 100644
--- a/src/Testcontainers.Pulsar/Usings.cs
+++ b/src/Testcontainers.Pulsar/Usings.cs
@@ -13,4 +13,4 @@
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
global using JetBrains.Annotations;
-global using Microsoft.Extensions.Logging;
\ No newline at end of file
+global using Microsoft.Extensions.Logging;
diff --git a/src/Testcontainers.Qdrant/QdrantBuilder.cs b/src/Testcontainers.Qdrant/QdrantBuilder.cs
index 703119346..c76990794 100644
--- a/src/Testcontainers.Qdrant/QdrantBuilder.cs
+++ b/src/Testcontainers.Qdrant/QdrantBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Qdrant;
///
[PublicAPI]
-public sealed class QdrantBuilder : ContainerBuilder
+public sealed class QdrantBuilder
+ : ContainerBuilder
{
public const string QdrantImage = "qdrant/qdrant:v1.13.4";
@@ -55,7 +56,10 @@ public QdrantBuilder WithApiKey(string apiKey)
/// A configured instance of .
public QdrantBuilder WithCertificate(string certificate, string certificateKey)
{
- return Merge(DockerResourceConfiguration, new QdrantConfiguration(certificate: certificate, certificateKey: certificateKey))
+ return Merge(
+ DockerResourceConfiguration,
+ new QdrantConfiguration(certificate: certificate, certificateKey: certificateKey)
+ )
.WithEnvironment("QDRANT__SERVICE__ENABLE_TLS", "1")
.WithEnvironment("QDRANT__TLS__CERT", CertificateFilePath)
.WithEnvironment("QDRANT__TLS__KEY", CertificateKeyFilePath)
@@ -70,7 +74,13 @@ public override QdrantContainer Build()
// By default, the base builder waits until the container is running. However, for Qdrant, a more advanced waiting strategy is necessary that requires access to the configured certificate.
// If the user does not provide a custom waiting strategy, append the default Qdrant waiting strategy.
- var qdrantBuilder = DockerResourceConfiguration.WaitStrategies.Count() > 1 ? this : WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration)));
+ var qdrantBuilder =
+ DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
+ );
return new QdrantContainer(qdrantBuilder.DockerResourceConfiguration);
}
@@ -84,7 +94,9 @@ protected override QdrantBuilder Init()
}
///
- protected override QdrantBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override QdrantBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new QdrantConfiguration(resourceConfiguration));
}
@@ -96,7 +108,10 @@ protected override QdrantBuilder Clone(IContainerConfiguration resourceConfigura
}
///
- protected override QdrantBuilder Merge(QdrantConfiguration oldValue, QdrantConfiguration newValue)
+ protected override QdrantBuilder Merge(
+ QdrantConfiguration oldValue,
+ QdrantConfiguration newValue
+ )
{
return new QdrantBuilder(new QdrantConfiguration(oldValue, newValue));
}
@@ -127,8 +142,7 @@ public async Task UntilAsync(IContainer container)
.ForPort(QdrantHttpPort)
.ForPath("/readyz");
- return await httpWaitStrategy.UntilAsync(container)
- .ConfigureAwait(false);
+ return await httpWaitStrategy.UntilAsync(container).ConfigureAwait(false);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Qdrant/QdrantConfiguration.cs b/src/Testcontainers.Qdrant/QdrantConfiguration.cs
index 99a4288d0..cf1f66bb8 100644
--- a/src/Testcontainers.Qdrant/QdrantConfiguration.cs
+++ b/src/Testcontainers.Qdrant/QdrantConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class QdrantConfiguration : ContainerConfiguration
public QdrantConfiguration(
string apiKey = null,
string certificate = null,
- string certificateKey = null)
+ string certificateKey = null
+ )
{
ApiKey = apiKey;
Certificate = certificate;
@@ -24,7 +25,9 @@ public QdrantConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public QdrantConfiguration(IResourceConfiguration resourceConfiguration)
+ public QdrantConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -60,7 +63,10 @@ public QdrantConfiguration(QdrantConfiguration oldValue, QdrantConfiguration new
{
ApiKey = BuildConfiguration.Combine(oldValue.ApiKey, newValue.ApiKey);
Certificate = BuildConfiguration.Combine(oldValue.Certificate, newValue.Certificate);
- CertificateKey = BuildConfiguration.Combine(oldValue.CertificateKey, newValue.CertificateKey);
+ CertificateKey = BuildConfiguration.Combine(
+ oldValue.CertificateKey,
+ newValue.CertificateKey
+ );
}
///
@@ -82,4 +88,4 @@ public QdrantConfiguration(QdrantConfiguration oldValue, QdrantConfiguration new
/// Gets the private key associated with the certificate in PEM format.
///
public string CertificateKey { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Qdrant/QdrantContainer.cs b/src/Testcontainers.Qdrant/QdrantContainer.cs
index f6399ee44..19c30aeba 100644
--- a/src/Testcontainers.Qdrant/QdrantContainer.cs
+++ b/src/Testcontainers.Qdrant/QdrantContainer.cs
@@ -22,7 +22,11 @@ public QdrantContainer(QdrantConfiguration configuration)
public string GetHttpConnectionString()
{
var scheme = _configuration.TlsEnabled ? Uri.UriSchemeHttps : Uri.UriSchemeHttp;
- var endpoint = new UriBuilder(scheme, Hostname, GetMappedPublicPort(QdrantBuilder.QdrantHttpPort));
+ var endpoint = new UriBuilder(
+ scheme,
+ Hostname,
+ GetMappedPublicPort(QdrantBuilder.QdrantHttpPort)
+ );
return endpoint.ToString();
}
@@ -32,7 +36,11 @@ public string GetHttpConnectionString()
public string GetGrpcConnectionString()
{
var scheme = _configuration.TlsEnabled ? Uri.UriSchemeHttps : Uri.UriSchemeHttp;
- var endpoint = new UriBuilder(scheme, Hostname, GetMappedPublicPort(QdrantBuilder.QdrantGrpcPort));
+ var endpoint = new UriBuilder(
+ scheme,
+ Hostname,
+ GetMappedPublicPort(QdrantBuilder.QdrantGrpcPort)
+ );
return endpoint.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Qdrant/Testcontainers.Qdrant.csproj b/src/Testcontainers.Qdrant/Testcontainers.Qdrant.csproj
index cbff16956..fab0ac0d5 100644
--- a/src/Testcontainers.Qdrant/Testcontainers.Qdrant.csproj
+++ b/src/Testcontainers.Qdrant/Testcontainers.Qdrant.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1;net462
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1;net462
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Qdrant/Usings.cs b/src/Testcontainers.Qdrant/Usings.cs
index 9c8bc5fba..235a9a4e9 100644
--- a/src/Testcontainers.Qdrant/Usings.cs
+++ b/src/Testcontainers.Qdrant/Usings.cs
@@ -7,4 +7,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.RabbitMq/RabbitMqBuilder.cs b/src/Testcontainers.RabbitMq/RabbitMqBuilder.cs
index 5b72bbb95..f78a30b7d 100644
--- a/src/Testcontainers.RabbitMq/RabbitMqBuilder.cs
+++ b/src/Testcontainers.RabbitMq/RabbitMqBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.RabbitMq;
///
[PublicAPI]
-public sealed class RabbitMqBuilder : ContainerBuilder
+public sealed class RabbitMqBuilder
+ : ContainerBuilder
{
public const string RabbitMqImage = "rabbitmq:3.11";
@@ -71,7 +72,9 @@ protected override RabbitMqBuilder Init()
.WithPortBinding(RabbitMqPort, true)
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Server startup complete"));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("Server startup complete")
+ );
}
///
@@ -79,17 +82,27 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override RabbitMqBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override RabbitMqBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new RabbitMqConfiguration(resourceConfiguration));
}
@@ -101,8 +114,11 @@ protected override RabbitMqBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override RabbitMqBuilder Merge(RabbitMqConfiguration oldValue, RabbitMqConfiguration newValue)
+ protected override RabbitMqBuilder Merge(
+ RabbitMqConfiguration oldValue,
+ RabbitMqConfiguration newValue
+ )
{
return new RabbitMqBuilder(new RabbitMqConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.RabbitMq/RabbitMqConfiguration.cs b/src/Testcontainers.RabbitMq/RabbitMqConfiguration.cs
index b9248ba62..587109fdd 100644
--- a/src/Testcontainers.RabbitMq/RabbitMqConfiguration.cs
+++ b/src/Testcontainers.RabbitMq/RabbitMqConfiguration.cs
@@ -9,9 +9,7 @@ public sealed class RabbitMqConfiguration : ContainerConfiguration
///
/// The RabbitMq username.
/// The RabbitMq password.
- public RabbitMqConfiguration(
- string username = null,
- string password = null)
+ public RabbitMqConfiguration(string username = null, string password = null)
{
Username = username;
Password = password;
@@ -21,7 +19,9 @@ public RabbitMqConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public RabbitMqConfiguration(IResourceConfiguration resourceConfiguration)
+ public RabbitMqConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -68,4 +68,4 @@ public RabbitMqConfiguration(RabbitMqConfiguration oldValue, RabbitMqConfigurati
/// Gets the RabbitMq password.
///
public string Password { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.RabbitMq/RabbitMqContainer.cs b/src/Testcontainers.RabbitMq/RabbitMqContainer.cs
index d679e9203..b8b4850b1 100644
--- a/src/Testcontainers.RabbitMq/RabbitMqContainer.cs
+++ b/src/Testcontainers.RabbitMq/RabbitMqContainer.cs
@@ -22,9 +22,13 @@ public RabbitMqContainer(RabbitMqConfiguration configuration)
/// The RabbitMq connection string.
public string GetConnectionString()
{
- var endpoint = new UriBuilder("amqp", Hostname, GetMappedPublicPort(RabbitMqBuilder.RabbitMqPort));
+ var endpoint = new UriBuilder(
+ "amqp",
+ Hostname,
+ GetMappedPublicPort(RabbitMqBuilder.RabbitMqPort)
+ );
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.RabbitMq/Testcontainers.RabbitMq.csproj b/src/Testcontainers.RabbitMq/Testcontainers.RabbitMq.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.RabbitMq/Testcontainers.RabbitMq.csproj
+++ b/src/Testcontainers.RabbitMq/Testcontainers.RabbitMq.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.RabbitMq/Usings.cs b/src/Testcontainers.RabbitMq/Usings.cs
index 8e5c20fd5..f89f0c94d 100644
--- a/src/Testcontainers.RabbitMq/Usings.cs
+++ b/src/Testcontainers.RabbitMq/Usings.cs
@@ -4,4 +4,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.RavenDb/RavenDbBuilder.cs b/src/Testcontainers.RavenDb/RavenDbBuilder.cs
index 86fc1435f..650c65cab 100644
--- a/src/Testcontainers.RavenDb/RavenDbBuilder.cs
+++ b/src/Testcontainers.RavenDb/RavenDbBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.RavenDb;
///
[PublicAPI]
-public sealed class RavenDbBuilder : ContainerBuilder
+public sealed class RavenDbBuilder
+ : ContainerBuilder
{
public const string RavenDbImage = "ravendb/ravendb:5.4-ubuntu-latest";
@@ -47,7 +48,9 @@ protected override RavenDbBuilder Init()
}
///
- protected override RavenDbBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override RavenDbBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new RavenDbConfiguration(resourceConfiguration));
}
@@ -59,8 +62,11 @@ protected override RavenDbBuilder Clone(IContainerConfiguration resourceConfigur
}
///
- protected override RavenDbBuilder Merge(RavenDbConfiguration oldValue, RavenDbConfiguration newValue)
+ protected override RavenDbBuilder Merge(
+ RavenDbConfiguration oldValue,
+ RavenDbConfiguration newValue
+ )
{
return new RavenDbBuilder(new RavenDbConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.RavenDb/RavenDbConfiguration.cs b/src/Testcontainers.RavenDb/RavenDbConfiguration.cs
index c36cfc26e..170c4adda 100644
--- a/src/Testcontainers.RavenDb/RavenDbConfiguration.cs
+++ b/src/Testcontainers.RavenDb/RavenDbConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class RavenDbConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public RavenDbConfiguration()
- {
- }
+ public RavenDbConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public RavenDbConfiguration(IResourceConfiguration resourceConfiguration)
+ public RavenDbConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public RavenDbConfiguration(RavenDbConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public RavenDbConfiguration(RavenDbConfiguration oldValue, RavenDbConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.RavenDb/RavenDbContainer.cs b/src/Testcontainers.RavenDb/RavenDbContainer.cs
index 62a5ad872..c025a3831 100644
--- a/src/Testcontainers.RavenDb/RavenDbContainer.cs
+++ b/src/Testcontainers.RavenDb/RavenDbContainer.cs
@@ -9,9 +9,7 @@ public sealed class RavenDbContainer : DockerContainer
///
/// The container configuration.
public RavenDbContainer(RavenDbConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the RavenDb connection string.
@@ -19,6 +17,10 @@ public RavenDbContainer(RavenDbConfiguration configuration)
/// The RavenDb connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(RavenDbBuilder.RavenDbPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(RavenDbBuilder.RavenDbPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.RavenDb/Testcontainers.RavenDb.csproj b/src/Testcontainers.RavenDb/Testcontainers.RavenDb.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.RavenDb/Testcontainers.RavenDb.csproj
+++ b/src/Testcontainers.RavenDb/Testcontainers.RavenDb.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.RavenDb/Usings.cs b/src/Testcontainers.RavenDb/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.RavenDb/Usings.cs
+++ b/src/Testcontainers.RavenDb/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Redis/RedisBuilder.cs b/src/Testcontainers.Redis/RedisBuilder.cs
index 9c8be98d3..4251fcf96 100644
--- a/src/Testcontainers.Redis/RedisBuilder.cs
+++ b/src/Testcontainers.Redis/RedisBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Redis;
///
[PublicAPI]
-public sealed class RedisBuilder : ContainerBuilder
+public sealed class RedisBuilder
+ : ContainerBuilder
{
public const string RedisImage = "redis:7.0";
@@ -47,7 +48,9 @@ protected override RedisBuilder Init()
}
///
- protected override RedisBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override RedisBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new RedisConfiguration(resourceConfiguration));
}
@@ -63,4 +66,4 @@ protected override RedisBuilder Merge(RedisConfiguration oldValue, RedisConfigur
{
return new RedisBuilder(new RedisConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Redis/RedisConfiguration.cs b/src/Testcontainers.Redis/RedisConfiguration.cs
index 05d1d911a..81c1aeffe 100644
--- a/src/Testcontainers.Redis/RedisConfiguration.cs
+++ b/src/Testcontainers.Redis/RedisConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class RedisConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public RedisConfiguration()
- {
- }
+ public RedisConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public RedisConfiguration(IResourceConfiguration resourceConfiguration)
+ public RedisConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public RedisConfiguration(RedisConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public RedisConfiguration(RedisConfiguration oldValue, RedisConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Redis/RedisContainer.cs b/src/Testcontainers.Redis/RedisContainer.cs
index 4c30d0917..dc36aecd2 100644
--- a/src/Testcontainers.Redis/RedisContainer.cs
+++ b/src/Testcontainers.Redis/RedisContainer.cs
@@ -9,9 +9,7 @@ public sealed class RedisContainer : DockerContainer
///
/// The container configuration.
public RedisContainer(RedisConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Redis connection string.
@@ -19,7 +17,9 @@ public RedisContainer(RedisConfiguration configuration)
/// The Redis connection string.
public string GetConnectionString()
{
- return new UriBuilder("redis", Hostname, GetMappedPublicPort(RedisBuilder.RedisPort)).Uri.Authority;
+ return new UriBuilder("redis", Hostname, GetMappedPublicPort(RedisBuilder.RedisPort))
+ .Uri
+ .Authority;
}
///
@@ -28,14 +28,28 @@ public string GetConnectionString()
/// The content of the Lua script to execute.
/// Cancellation token.
/// Task that completes when the Lua script has been executed.
- public async Task ExecScriptAsync(string scriptContent, CancellationToken ct = default)
+ public async Task ExecScriptAsync(
+ string scriptContent,
+ CancellationToken ct = default
+ )
{
- var scriptFilePath = string.Join("/", string.Empty, "tmp", Guid.NewGuid().ToString("D"), Path.GetRandomFileName());
+ var scriptFilePath = string.Join(
+ "/",
+ string.Empty,
+ "tmp",
+ Guid.NewGuid().ToString("D"),
+ Path.GetRandomFileName()
+ );
- await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
+ await CopyAsync(
+ Encoding.Default.GetBytes(scriptContent),
+ scriptFilePath,
+ Unix.FileMode644,
+ ct
+ )
.ConfigureAwait(false);
return await ExecAsync(new[] { "redis-cli", "--eval", scriptFilePath, "0" }, ct)
.ConfigureAwait(false);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Redis/Testcontainers.Redis.csproj b/src/Testcontainers.Redis/Testcontainers.Redis.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Redis/Testcontainers.Redis.csproj
+++ b/src/Testcontainers.Redis/Testcontainers.Redis.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Redis/Usings.cs b/src/Testcontainers.Redis/Usings.cs
index 3c22a4545..b517ff22f 100644
--- a/src/Testcontainers.Redis/Usings.cs
+++ b/src/Testcontainers.Redis/Usings.cs
@@ -7,4 +7,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Redpanda/RedpandaBuilder.cs b/src/Testcontainers.Redpanda/RedpandaBuilder.cs
index d3116d614..2bb1c94da 100644
--- a/src/Testcontainers.Redpanda/RedpandaBuilder.cs
+++ b/src/Testcontainers.Redpanda/RedpandaBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Redpanda;
///
[PublicAPI]
-public sealed class RedpandaBuilder : ContainerBuilder
+public sealed class RedpandaBuilder
+ : ContainerBuilder
{
public const string RedpandaImage = "docker.redpanda.com/redpandadata/redpanda:v22.2.1";
@@ -49,26 +50,49 @@ protected override RedpandaBuilder Init()
.WithPortBinding(SchemaRegistryPort, true)
.WithPortBinding(RedpandaPort, true)
.WithEntrypoint("/bin/sh", "-c")
- .WithCommand("while [ ! -f " + StartupScriptFilePath + " ]; do sleep 0.1; done; " + StartupScriptFilePath)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Started Kafka API server"))
- .WithStartupCallback((container, ct) =>
- {
- const char lf = '\n';
- var startupScript = new StringBuilder();
- startupScript.Append("#!/bin/bash");
- startupScript.Append(lf);
- startupScript.Append("/usr/bin/rpk redpanda start ");
- startupScript.Append("--mode dev-container ");
- startupScript.Append("--smp 1 ");
- startupScript.Append("--memory 1G ");
- startupScript.Append("--kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 ");
- startupScript.Append("--advertise-kafka-addr PLAINTEXT://127.0.0.1:29092,OUTSIDE://" + container.Hostname + ":" + container.GetMappedPublicPort(RedpandaPort));
- return container.CopyAsync(Encoding.Default.GetBytes(startupScript.ToString()), StartupScriptFilePath, Unix.FileMode755, ct);
- });
+ .WithCommand(
+ "while [ ! -f "
+ + StartupScriptFilePath
+ + " ]; do sleep 0.1; done; "
+ + StartupScriptFilePath
+ )
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("Started Kafka API server")
+ )
+ .WithStartupCallback(
+ (container, ct) =>
+ {
+ const char lf = '\n';
+ var startupScript = new StringBuilder();
+ startupScript.Append("#!/bin/bash");
+ startupScript.Append(lf);
+ startupScript.Append("/usr/bin/rpk redpanda start ");
+ startupScript.Append("--mode dev-container ");
+ startupScript.Append("--smp 1 ");
+ startupScript.Append("--memory 1G ");
+ startupScript.Append(
+ "--kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 "
+ );
+ startupScript.Append(
+ "--advertise-kafka-addr PLAINTEXT://127.0.0.1:29092,OUTSIDE://"
+ + container.Hostname
+ + ":"
+ + container.GetMappedPublicPort(RedpandaPort)
+ );
+ return container.CopyAsync(
+ Encoding.Default.GetBytes(startupScript.ToString()),
+ StartupScriptFilePath,
+ Unix.FileMode755,
+ ct
+ );
+ }
+ );
}
///
- protected override RedpandaBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override RedpandaBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new RedpandaConfiguration(resourceConfiguration));
}
@@ -80,8 +104,11 @@ protected override RedpandaBuilder Clone(IContainerConfiguration resourceConfigu
}
///
- protected override RedpandaBuilder Merge(RedpandaConfiguration oldValue, RedpandaConfiguration newValue)
+ protected override RedpandaBuilder Merge(
+ RedpandaConfiguration oldValue,
+ RedpandaConfiguration newValue
+ )
{
return new RedpandaBuilder(new RedpandaConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Redpanda/RedpandaConfiguration.cs b/src/Testcontainers.Redpanda/RedpandaConfiguration.cs
index 5bc672eba..46626fa7b 100644
--- a/src/Testcontainers.Redpanda/RedpandaConfiguration.cs
+++ b/src/Testcontainers.Redpanda/RedpandaConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class RedpandaConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public RedpandaConfiguration()
- {
- }
+ public RedpandaConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public RedpandaConfiguration(IResourceConfiguration resourceConfiguration)
+ public RedpandaConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public RedpandaConfiguration(RedpandaConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public RedpandaConfiguration(RedpandaConfiguration oldValue, RedpandaConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Redpanda/RedpandaContainer.cs b/src/Testcontainers.Redpanda/RedpandaContainer.cs
index 0ac279353..6424bdad5 100644
--- a/src/Testcontainers.Redpanda/RedpandaContainer.cs
+++ b/src/Testcontainers.Redpanda/RedpandaContainer.cs
@@ -9,9 +9,7 @@ public sealed class RedpandaContainer : DockerContainer
///
/// The container configuration.
public RedpandaContainer(RedpandaConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Schema Registry address.
@@ -19,7 +17,11 @@ public RedpandaContainer(RedpandaConfiguration configuration)
/// The Schema Registry address.
public string GetSchemaRegistryAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(RedpandaBuilder.SchemaRegistryPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(RedpandaBuilder.SchemaRegistryPort)
+ ).ToString();
}
///
@@ -28,6 +30,10 @@ public string GetSchemaRegistryAddress()
/// The bootstrap address.
public string GetBootstrapAddress()
{
- return new UriBuilder("PLAINTEXT", Hostname, GetMappedPublicPort(RedpandaBuilder.RedpandaPort)).ToString();
+ return new UriBuilder(
+ "PLAINTEXT",
+ Hostname,
+ GetMappedPublicPort(RedpandaBuilder.RedpandaPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Redpanda/Testcontainers.Redpanda.csproj b/src/Testcontainers.Redpanda/Testcontainers.Redpanda.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Redpanda/Testcontainers.Redpanda.csproj
+++ b/src/Testcontainers.Redpanda/Testcontainers.Redpanda.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Redpanda/Usings.cs b/src/Testcontainers.Redpanda/Usings.cs
index fd6c6ccbc..1734e5e13 100644
--- a/src/Testcontainers.Redpanda/Usings.cs
+++ b/src/Testcontainers.Redpanda/Usings.cs
@@ -1,7 +1,7 @@
global using System;
-global using Docker.DotNet.Models;
global using System.Text;
+global using Docker.DotNet.Models;
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs b/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs
index 0938396dc..82f9d589e 100644
--- a/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs
+++ b/src/Testcontainers.ServiceBus/ServiceBusBuilder.cs
@@ -2,13 +2,15 @@ namespace Testcontainers.ServiceBus;
///
[PublicAPI]
-public sealed class ServiceBusBuilder : ContainerBuilder
+public sealed class ServiceBusBuilder
+ : ContainerBuilder
{
public const string ServiceBusNetworkAlias = "servicebus-container";
public const string DatabaseNetworkAlias = "database-container";
- public const string ServiceBusImage = "mcr.microsoft.com/azure-messaging/servicebus-emulator:latest";
+ public const string ServiceBusImage =
+ "mcr.microsoft.com/azure-messaging/servicebus-emulator:latest";
public const ushort ServiceBusPort = 5672;
@@ -55,7 +57,9 @@ private ServiceBusBuilder(ServiceBusConfiguration resourceConfiguration)
/// A configured instance of .
public override ServiceBusBuilder WithAcceptLicenseAgreement(bool acceptLicenseAgreement)
{
- var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement;
+ var licenseAgreement = acceptLicenseAgreement
+ ? AcceptLicenseAgreement
+ : DeclineLicenseAgreement;
return WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
}
@@ -76,9 +80,13 @@ public ServiceBusBuilder WithMsSqlContainer(
INetwork network,
MsSqlContainer container,
string networkAlias,
- string password = MsSqlBuilder.DefaultPassword)
+ string password = MsSqlBuilder.DefaultPassword
+ )
{
- return Merge(DockerResourceConfiguration, new ServiceBusConfiguration(databaseContainer: container))
+ return Merge(
+ DockerResourceConfiguration,
+ new ServiceBusConfiguration(databaseContainer: container)
+ )
.DependsOn(container)
.WithNetwork(network)
.WithNetworkAliases(ServiceBusNetworkAlias)
@@ -96,7 +104,10 @@ public ServiceBusBuilder WithMsSqlContainer(
/// A configured instance of .
public ServiceBusBuilder WithConfig(string configFilePath)
{
- return WithResourceMapping(new FileInfo(configFilePath), new FileInfo("/ServiceBus_Emulator/ConfigFiles/Config.json"));
+ return WithResourceMapping(
+ new FileInfo(configFilePath),
+ new FileInfo("/ServiceBus_Emulator/ConfigFiles/Config.json")
+ );
}
///
@@ -112,8 +123,7 @@ public override ServiceBusContainer Build()
// If the user has not provided an existing MSSQL container instance,
// we configure one.
- var network = new NetworkBuilder()
- .Build();
+ var network = new NetworkBuilder().Build();
var container = new MsSqlBuilder()
.WithNetwork(network)
@@ -132,25 +142,40 @@ protected override ServiceBusBuilder Init()
.WithPortBinding(ServiceBusPort, true)
.WithPortBinding(ServiceBusHttpPort, true)
.WithEnvironment("SQL_WAIT_INTERVAL", "0")
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(ServiceBusHttpPort).ForPath("/health")));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPort(ServiceBusHttpPort).ForPath("/health")
+ )
+ );
}
///
- protected override ServiceBusBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ServiceBusBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new ServiceBusConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ServiceBusConfiguration(resourceConfiguration)
+ );
}
///
protected override ServiceBusBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new ServiceBusConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new ServiceBusConfiguration(resourceConfiguration)
+ );
}
///
- protected override ServiceBusBuilder Merge(ServiceBusConfiguration oldValue, ServiceBusConfiguration newValue)
+ protected override ServiceBusBuilder Merge(
+ ServiceBusConfiguration oldValue,
+ ServiceBusConfiguration newValue
+ )
{
return new ServiceBusBuilder(new ServiceBusConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ServiceBus/ServiceBusConfiguration.cs b/src/Testcontainers.ServiceBus/ServiceBusConfiguration.cs
index d12b8ac71..689cc4c59 100644
--- a/src/Testcontainers.ServiceBus/ServiceBusConfiguration.cs
+++ b/src/Testcontainers.ServiceBus/ServiceBusConfiguration.cs
@@ -17,7 +17,9 @@ public ServiceBusConfiguration(IDatabaseContainer databaseContainer = null)
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ServiceBusConfiguration(IResourceConfiguration resourceConfiguration)
+ public ServiceBusConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -48,14 +50,20 @@ public ServiceBusConfiguration(ServiceBusConfiguration resourceConfiguration)
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- public ServiceBusConfiguration(ServiceBusConfiguration oldValue, ServiceBusConfiguration newValue)
+ public ServiceBusConfiguration(
+ ServiceBusConfiguration oldValue,
+ ServiceBusConfiguration newValue
+ )
: base(oldValue, newValue)
{
- DatabaseContainer = BuildConfiguration.Combine(oldValue.DatabaseContainer, newValue.DatabaseContainer);
+ DatabaseContainer = BuildConfiguration.Combine(
+ oldValue.DatabaseContainer,
+ newValue.DatabaseContainer
+ );
}
///
/// Gets the database container.
///
public IDatabaseContainer DatabaseContainer { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ServiceBus/ServiceBusContainer.cs b/src/Testcontainers.ServiceBus/ServiceBusContainer.cs
index 32c35d3e7..74781a640 100644
--- a/src/Testcontainers.ServiceBus/ServiceBusContainer.cs
+++ b/src/Testcontainers.ServiceBus/ServiceBusContainer.cs
@@ -9,9 +9,7 @@ public sealed class ServiceBusContainer : DockerContainer
///
/// The container configuration.
public ServiceBusContainer(ServiceBusConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Service Bus connection string.
@@ -20,10 +18,20 @@ public ServiceBusContainer(ServiceBusConfiguration configuration)
public string GetConnectionString()
{
var properties = new Dictionary();
- properties.Add("Endpoint", new UriBuilder("amqp", Hostname, GetMappedPublicPort(ServiceBusBuilder.ServiceBusPort)).ToString());
+ properties.Add(
+ "Endpoint",
+ new UriBuilder(
+ "amqp",
+ Hostname,
+ GetMappedPublicPort(ServiceBusBuilder.ServiceBusPort)
+ ).ToString()
+ );
properties.Add("SharedAccessKeyName", "RootManageSharedAccessKey");
properties.Add("SharedAccessKey", "SAS_KEY_VALUE");
properties.Add("UseDevelopmentEmulator", "true");
- return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
+ return string.Join(
+ ";",
+ properties.Select(property => string.Join("=", property.Key, property.Value))
+ );
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.ServiceBus/Testcontainers.ServiceBus.csproj b/src/Testcontainers.ServiceBus/Testcontainers.ServiceBus.csproj
index f24f1b880..98bc56ba1 100644
--- a/src/Testcontainers.ServiceBus/Testcontainers.ServiceBus.csproj
+++ b/src/Testcontainers.ServiceBus/Testcontainers.ServiceBus.csproj
@@ -1,13 +1,17 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.ServiceBus/Usings.cs b/src/Testcontainers.ServiceBus/Usings.cs
index b8e2cde7e..1beb1dfaa 100644
--- a/src/Testcontainers.ServiceBus/Usings.cs
+++ b/src/Testcontainers.ServiceBus/Usings.cs
@@ -8,4 +8,4 @@
global using DotNet.Testcontainers.Containers;
global using DotNet.Testcontainers.Networks;
global using JetBrains.Annotations;
-global using Testcontainers.MsSql;
\ No newline at end of file
+global using Testcontainers.MsSql;
diff --git a/src/Testcontainers.Sftp/SftpBuilder.cs b/src/Testcontainers.Sftp/SftpBuilder.cs
index d37b7c460..45a102fbc 100644
--- a/src/Testcontainers.Sftp/SftpBuilder.cs
+++ b/src/Testcontainers.Sftp/SftpBuilder.cs
@@ -63,7 +63,10 @@ public SftpBuilder WithPassword(string password)
/// A configured instance of .
public SftpBuilder WithUploadDirectory(string uploadDirectory)
{
- return Merge(DockerResourceConfiguration, new SftpConfiguration(uploadDirectory: uploadDirectory));
+ return Merge(
+ DockerResourceConfiguration,
+ new SftpConfiguration(uploadDirectory: uploadDirectory)
+ );
}
///
@@ -71,13 +74,16 @@ public override SftpContainer Build()
{
Validate();
- var sftpBuilder = WithCommand(string.Join(
- ":",
- DockerResourceConfiguration.Username,
- DockerResourceConfiguration.Password,
- string.Empty,
- string.Empty,
- DockerResourceConfiguration.UploadDirectory));
+ var sftpBuilder = WithCommand(
+ string.Join(
+ ":",
+ DockerResourceConfiguration.Username,
+ DockerResourceConfiguration.Password,
+ string.Empty,
+ string.Empty,
+ DockerResourceConfiguration.UploadDirectory
+ )
+ );
return new SftpContainer(sftpBuilder.DockerResourceConfiguration);
}
@@ -91,7 +97,9 @@ protected override SftpBuilder Init()
.WithUsername(DefaultUsername)
.WithPassword(DefaultPassword)
.WithUploadDirectory(DefaultUploadDirectory)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Server listening on .+"));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer().UntilMessageIsLogged("Server listening on .+")
+ );
}
///
@@ -99,21 +107,35 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Username,
+ nameof(DockerResourceConfiguration.Username)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Password,
+ nameof(DockerResourceConfiguration.Password)
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.UploadDirectory, nameof(DockerResourceConfiguration.UploadDirectory))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.UploadDirectory,
+ nameof(DockerResourceConfiguration.UploadDirectory)
+ )
.NotNull()
.NotEmpty();
}
///
- protected override SftpBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override SftpBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
return Merge(DockerResourceConfiguration, new SftpConfiguration(resourceConfiguration));
}
@@ -129,4 +151,4 @@ protected override SftpBuilder Merge(SftpConfiguration oldValue, SftpConfigurati
{
return new SftpBuilder(new SftpConfiguration(oldValue, newValue));
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Sftp/SftpConfiguration.cs b/src/Testcontainers.Sftp/SftpConfiguration.cs
index 9dfb00c44..2a616500b 100644
--- a/src/Testcontainers.Sftp/SftpConfiguration.cs
+++ b/src/Testcontainers.Sftp/SftpConfiguration.cs
@@ -13,7 +13,8 @@ public sealed class SftpConfiguration : ContainerConfiguration
public SftpConfiguration(
string username = null,
string password = null,
- string uploadDirectory = null)
+ string uploadDirectory = null
+ )
{
Username = username;
Password = password;
@@ -24,7 +25,9 @@ public SftpConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public SftpConfiguration(IResourceConfiguration resourceConfiguration)
+ public SftpConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -60,7 +63,10 @@ public SftpConfiguration(SftpConfiguration oldValue, SftpConfiguration newValue)
{
Username = BuildConfiguration.Combine(oldValue.Username, newValue.Username);
Password = BuildConfiguration.Combine(oldValue.Password, newValue.Password);
- UploadDirectory = BuildConfiguration.Combine(oldValue.UploadDirectory, newValue.UploadDirectory);
+ UploadDirectory = BuildConfiguration.Combine(
+ oldValue.UploadDirectory,
+ newValue.UploadDirectory
+ );
}
///
@@ -77,4 +83,4 @@ public SftpConfiguration(SftpConfiguration oldValue, SftpConfiguration newValue)
/// Gets the directory to which files are uploaded.
///
public string UploadDirectory { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Sftp/SftpContainer.cs b/src/Testcontainers.Sftp/SftpContainer.cs
index d93956f73..207908e13 100644
--- a/src/Testcontainers.Sftp/SftpContainer.cs
+++ b/src/Testcontainers.Sftp/SftpContainer.cs
@@ -9,7 +9,5 @@ public sealed class SftpContainer : DockerContainer
///
/// The container configuration.
public SftpContainer(SftpConfiguration configuration)
- : base(configuration)
- {
- }
-}
\ No newline at end of file
+ : base(configuration) { }
+}
diff --git a/src/Testcontainers.Sftp/Testcontainers.Sftp.csproj b/src/Testcontainers.Sftp/Testcontainers.Sftp.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Sftp/Testcontainers.Sftp.csproj
+++ b/src/Testcontainers.Sftp/Testcontainers.Sftp.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Sftp/Usings.cs b/src/Testcontainers.Sftp/Usings.cs
index fa3a104a1..9add3e4ce 100644
--- a/src/Testcontainers.Sftp/Usings.cs
+++ b/src/Testcontainers.Sftp/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Typesense/Testcontainers.Typesense.csproj b/src/Testcontainers.Typesense/Testcontainers.Typesense.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Typesense/Testcontainers.Typesense.csproj
+++ b/src/Testcontainers.Typesense/Testcontainers.Typesense.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Typesense/TypesenseBuilder.cs b/src/Testcontainers.Typesense/TypesenseBuilder.cs
index c7f926f3f..90f9aa81c 100644
--- a/src/Testcontainers.Typesense/TypesenseBuilder.cs
+++ b/src/Testcontainers.Typesense/TypesenseBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Typesense;
///
[PublicAPI]
-public sealed class TypesenseBuilder : ContainerBuilder
+public sealed class TypesenseBuilder
+ : ContainerBuilder
{
public const string TypesenseImage = "typesense/typesense:28.0";
@@ -69,8 +70,15 @@ protected override TypesenseBuilder Init()
.WithPortBinding(TypesensePort, true)
.WithDataDirectory(DefaultDataDirectory)
.WithApiKey(DefaultApiKey)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPort(TypesensePort).ForPath("/health").ForResponseMessageMatching(IsNodeReadyAsync)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request
+ .ForPort(TypesensePort)
+ .ForPath("/health")
+ .ForResponseMessageMatching(IsNodeReadyAsync)
+ )
+ );
}
///
@@ -78,38 +86,53 @@ protected override void Validate()
{
base.Validate();
- _ = Guard.Argument(DockerResourceConfiguration.Environments["TYPESENSE_DATA_DIR"], "DataDirectory")
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Environments["TYPESENSE_DATA_DIR"],
+ "DataDirectory"
+ )
.NotNull()
.NotEmpty();
- _ = Guard.Argument(DockerResourceConfiguration.Environments["TYPESENSE_API_KEY"], "ApiKey")
+ _ = Guard
+ .Argument(DockerResourceConfiguration.Environments["TYPESENSE_API_KEY"], "ApiKey")
.NotNull()
.NotEmpty();
}
///
- protected override TypesenseBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override TypesenseBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new TypesenseConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new TypesenseConfiguration(resourceConfiguration)
+ );
}
///
protected override TypesenseBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new TypesenseConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new TypesenseConfiguration(resourceConfiguration)
+ );
}
///
- protected override TypesenseBuilder Merge(TypesenseConfiguration oldValue, TypesenseConfiguration newValue)
+ protected override TypesenseBuilder Merge(
+ TypesenseConfiguration oldValue,
+ TypesenseConfiguration newValue
+ )
{
return new TypesenseBuilder(new TypesenseConfiguration(oldValue, newValue));
}
private static async Task IsNodeReadyAsync(HttpResponseMessage response)
{
- var content = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return "{\"ok\":true}".Equals(content, StringComparison.OrdinalIgnoreCase);
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Typesense/TypesenseConfiguration.cs b/src/Testcontainers.Typesense/TypesenseConfiguration.cs
index aaa5a4b50..eef997bbc 100644
--- a/src/Testcontainers.Typesense/TypesenseConfiguration.cs
+++ b/src/Testcontainers.Typesense/TypesenseConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class TypesenseConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public TypesenseConfiguration()
- {
- }
+ public TypesenseConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public TypesenseConfiguration(IResourceConfiguration resourceConfiguration)
+ public TypesenseConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public TypesenseConfiguration(TypesenseConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public TypesenseConfiguration(TypesenseConfiguration oldValue, TypesenseConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Typesense/TypesenseContainer.cs b/src/Testcontainers.Typesense/TypesenseContainer.cs
index d94a63aee..073e83b33 100644
--- a/src/Testcontainers.Typesense/TypesenseContainer.cs
+++ b/src/Testcontainers.Typesense/TypesenseContainer.cs
@@ -9,9 +9,7 @@ public sealed class TypesenseContainer : DockerContainer
///
/// The container configuration.
public TypesenseContainer(TypesenseConfiguration configuration)
- : base(configuration)
- {
- }
+ : base(configuration) { }
///
/// Gets the Typesense base address.
@@ -19,6 +17,10 @@ public TypesenseContainer(TypesenseConfiguration configuration)
/// The Typesense base address.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(TypesenseBuilder.TypesensePort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(TypesenseBuilder.TypesensePort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Typesense/Usings.cs b/src/Testcontainers.Typesense/Usings.cs
index cafc6c2ef..30575e05d 100644
--- a/src/Testcontainers.Typesense/Usings.cs
+++ b/src/Testcontainers.Typesense/Usings.cs
@@ -6,4 +6,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Weaviate/Testcontainers.Weaviate.csproj b/src/Testcontainers.Weaviate/Testcontainers.Weaviate.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.Weaviate/Testcontainers.Weaviate.csproj
+++ b/src/Testcontainers.Weaviate/Testcontainers.Weaviate.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Weaviate/Usings.cs b/src/Testcontainers.Weaviate/Usings.cs
index 79fd3af9b..b31708db0 100644
--- a/src/Testcontainers.Weaviate/Usings.cs
+++ b/src/Testcontainers.Weaviate/Usings.cs
@@ -3,4 +3,4 @@
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
\ No newline at end of file
+global using JetBrains.Annotations;
diff --git a/src/Testcontainers.Weaviate/WeaviateBuilder.cs b/src/Testcontainers.Weaviate/WeaviateBuilder.cs
index 92d56dcaa..e562d5dec 100644
--- a/src/Testcontainers.Weaviate/WeaviateBuilder.cs
+++ b/src/Testcontainers.Weaviate/WeaviateBuilder.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Weaviate;
///
[PublicAPI]
-public sealed class WeaviateBuilder : ContainerBuilder
+public sealed class WeaviateBuilder
+ : ContainerBuilder
{
public const string WeaviateImage = "semitechnologies/weaviate:1.26.14";
@@ -13,15 +14,16 @@ public sealed class WeaviateBuilder : ContainerBuilder
/// Initializes a new instance of the class.
///
- public WeaviateBuilder() : this(new WeaviateConfiguration())
- => DockerResourceConfiguration = Init().DockerResourceConfiguration;
+ public WeaviateBuilder()
+ : this(new WeaviateConfiguration()) =>
+ DockerResourceConfiguration = Init().DockerResourceConfiguration;
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- private WeaviateBuilder(WeaviateConfiguration resourceConfiguration) : base(resourceConfiguration)
- => DockerResourceConfiguration = resourceConfiguration;
+ private WeaviateBuilder(WeaviateConfiguration resourceConfiguration)
+ : base(resourceConfiguration) => DockerResourceConfiguration = resourceConfiguration;
///
protected override WeaviateConfiguration DockerResourceConfiguration { get; }
@@ -34,28 +36,34 @@ public override WeaviateContainer Build()
}
///
- protected override WeaviateBuilder Init()
- => base.Init()
+ protected override WeaviateBuilder Init() =>
+ base.Init()
.WithImage(WeaviateImage)
.WithPortBinding(WeaviateHttpPort, true)
.WithPortBinding(WeaviateGrpcPort, true)
.WithEnvironment("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "true")
.WithEnvironment("PERSISTENCE_DATA_PATH", "/var/lib/weaviate")
- .WithWaitStrategy(Wait.ForUnixContainer()
- .UntilPortIsAvailable(WeaviateHttpPort)
- .UntilPortIsAvailable(WeaviateGrpcPort)
- .UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/v1/.well-known/ready").ForPort(WeaviateHttpPort)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilPortIsAvailable(WeaviateHttpPort)
+ .UntilPortIsAvailable(WeaviateGrpcPort)
+ .UntilHttpRequestIsSucceeded(request =>
+ request.ForPath("/v1/.well-known/ready").ForPort(WeaviateHttpPort)
+ )
+ );
///
- protected override WeaviateBuilder Clone(IResourceConfiguration resourceConfiguration)
- => Merge(DockerResourceConfiguration, new WeaviateConfiguration(resourceConfiguration));
+ protected override WeaviateBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ ) => Merge(DockerResourceConfiguration, new WeaviateConfiguration(resourceConfiguration));
///
- protected override WeaviateBuilder Clone(IContainerConfiguration resourceConfiguration)
- => Merge(DockerResourceConfiguration, new WeaviateConfiguration(resourceConfiguration));
+ protected override WeaviateBuilder Clone(IContainerConfiguration resourceConfiguration) =>
+ Merge(DockerResourceConfiguration, new WeaviateConfiguration(resourceConfiguration));
///
- protected override WeaviateBuilder Merge(WeaviateConfiguration oldValue, WeaviateConfiguration newValue)
- => new(new WeaviateConfiguration(oldValue, newValue));
-}
\ No newline at end of file
+ protected override WeaviateBuilder Merge(
+ WeaviateConfiguration oldValue,
+ WeaviateConfiguration newValue
+ ) => new(new WeaviateConfiguration(oldValue, newValue));
+}
diff --git a/src/Testcontainers.Weaviate/WeaviateConfiguration.cs b/src/Testcontainers.Weaviate/WeaviateConfiguration.cs
index 87d42c016..fa683affa 100644
--- a/src/Testcontainers.Weaviate/WeaviateConfiguration.cs
+++ b/src/Testcontainers.Weaviate/WeaviateConfiguration.cs
@@ -7,15 +7,15 @@ public sealed class WeaviateConfiguration : ContainerConfiguration
///
/// Initializes a new instance of the class.
///
- public WeaviateConfiguration()
- {
- }
+ public WeaviateConfiguration() { }
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public WeaviateConfiguration(IResourceConfiguration resourceConfiguration)
+ public WeaviateConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -47,7 +47,5 @@ public WeaviateConfiguration(WeaviateConfiguration resourceConfiguration)
/// The old Docker resource configuration.
/// The new Docker resource configuration.
public WeaviateConfiguration(WeaviateConfiguration oldValue, WeaviateConfiguration newValue)
- : base(oldValue, newValue)
- {
- }
-}
\ No newline at end of file
+ : base(oldValue, newValue) { }
+}
diff --git a/src/Testcontainers.Weaviate/WeaviateContainer.cs b/src/Testcontainers.Weaviate/WeaviateContainer.cs
index 6eba03c0d..f5f25a068 100644
--- a/src/Testcontainers.Weaviate/WeaviateContainer.cs
+++ b/src/Testcontainers.Weaviate/WeaviateContainer.cs
@@ -2,7 +2,8 @@ namespace Testcontainers.Weaviate;
///
[PublicAPI]
-public sealed class WeaviateContainer(WeaviateConfiguration configuration) : DockerContainer(configuration)
+public sealed class WeaviateContainer(WeaviateConfiguration configuration)
+ : DockerContainer(configuration)
{
///
/// Gets the Weaviate base address.
@@ -10,6 +11,10 @@ public sealed class WeaviateContainer(WeaviateConfiguration configuration) : Doc
/// The Weaviate base address.
public string GetBaseAddress()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(WeaviateBuilder.WeaviateHttpPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(WeaviateBuilder.WeaviateHttpPort)
+ ).ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.WebDriver/Testcontainers.WebDriver.csproj b/src/Testcontainers.WebDriver/Testcontainers.WebDriver.csproj
index 9a25b9c4d..fd9c3fe09 100644
--- a/src/Testcontainers.WebDriver/Testcontainers.WebDriver.csproj
+++ b/src/Testcontainers.WebDriver/Testcontainers.WebDriver.csproj
@@ -1,12 +1,16 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.WebDriver/Usings.cs b/src/Testcontainers.WebDriver/Usings.cs
index 00e88cf71..e4b6354ae 100644
--- a/src/Testcontainers.WebDriver/Usings.cs
+++ b/src/Testcontainers.WebDriver/Usings.cs
@@ -13,4 +13,4 @@
global using DotNet.Testcontainers.Images;
global using DotNet.Testcontainers.Networks;
global using JetBrains.Annotations;
-global using Microsoft.Extensions.Logging.Abstractions;
\ No newline at end of file
+global using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Testcontainers.WebDriver/WebDriverBrowser.cs b/src/Testcontainers.WebDriver/WebDriverBrowser.cs
index 5e04f32c4..80ad92892 100644
--- a/src/Testcontainers.WebDriver/WebDriverBrowser.cs
+++ b/src/Testcontainers.WebDriver/WebDriverBrowser.cs
@@ -9,26 +9,30 @@ public readonly struct WebDriverBrowser
///
/// Gets the Selenium standalone Chrome configuration.
///
- public static readonly WebDriverBrowser Chrome = new WebDriverBrowser("selenium/standalone-chrome:110.0");
+ public static readonly WebDriverBrowser Chrome = new WebDriverBrowser(
+ "selenium/standalone-chrome:110.0"
+ );
///
/// Gets the Selenium standalone Firefox configuration.
///
- public static readonly WebDriverBrowser Firefox = new WebDriverBrowser("selenium/standalone-firefox:110.0");
+ public static readonly WebDriverBrowser Firefox = new WebDriverBrowser(
+ "selenium/standalone-firefox:110.0"
+ );
///
/// Gets the Selenium standalone Edge configuration.
///
- public static readonly WebDriverBrowser Edge = new WebDriverBrowser("selenium/standalone-edge:110.0");
+ public static readonly WebDriverBrowser Edge = new WebDriverBrowser(
+ "selenium/standalone-edge:110.0"
+ );
///
/// Initializes a new instance of the struct.
///
/// The Selenium standalone Docker image.
public WebDriverBrowser(string image)
- : this(new DockerImage(image))
- {
- }
+ : this(new DockerImage(image)) { }
///
/// Initializes a new instance of the struct.
@@ -44,4 +48,4 @@ public WebDriverBrowser(IImage image)
///
[NotNull]
public IImage Image { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.WebDriver/WebDriverBuilder.cs b/src/Testcontainers.WebDriver/WebDriverBuilder.cs
index 4ec108ecc..7c1cb77cf 100644
--- a/src/Testcontainers.WebDriver/WebDriverBuilder.cs
+++ b/src/Testcontainers.WebDriver/WebDriverBuilder.cs
@@ -5,7 +5,8 @@ namespace Testcontainers.WebDriver;
/// Find further information about the Selenium Grid image, including its configurations, here: https://github.com/SeleniumHQ/docker-selenium.
///
[PublicAPI]
-public sealed class WebDriverBuilder : ContainerBuilder
+public sealed class WebDriverBuilder
+ : ContainerBuilder
{
public const string WebDriverNetworkAlias = "standalone-container";
@@ -17,7 +18,12 @@ public sealed class WebDriverBuilder : ContainerBuilder
/// Initializes a new instance of the class.
@@ -64,7 +70,10 @@ public WebDriverBuilder WithBrowser(WebDriverBrowser webDriverBrowser)
/// A configured instance of .
public WebDriverBuilder WithConfigurationFromTomlFile(string configTomlFilePath)
{
- return WithResourceMapping(new FileInfo(configTomlFilePath), new FileInfo("/opt/bin/config.toml"));
+ return WithResourceMapping(
+ new FileInfo(configTomlFilePath),
+ new FileInfo("/opt/bin/config.toml")
+ );
}
///
@@ -81,7 +90,10 @@ public WebDriverBuilder WithRecording()
.WithEnvironment("DISPLAY_CONTAINER_NAME", WebDriverNetworkAlias)
.Build();
- return Merge(DockerResourceConfiguration, new WebDriverConfiguration(ffmpegContainer: ffmpegContainer));
+ return Merge(
+ DockerResourceConfiguration,
+ new WebDriverConfiguration(ffmpegContainer: ffmpegContainer)
+ );
}
///
@@ -100,24 +112,42 @@ protected override WebDriverBuilder Init()
.WithNetworkAliases(WebDriverNetworkAlias)
.WithPortBinding(WebDriverPort, true)
.WithPortBinding(VncServerPort, true)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
- request.ForPath("/wd/hub/status").ForPort(WebDriverPort).ForResponseMessageMatching(IsGridReadyAsync)));
+ .WithWaitStrategy(
+ Wait.ForUnixContainer()
+ .UntilHttpRequestIsSucceeded(request =>
+ request
+ .ForPath("/wd/hub/status")
+ .ForPort(WebDriverPort)
+ .ForResponseMessageMatching(IsGridReadyAsync)
+ )
+ );
}
///
- protected override WebDriverBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override WebDriverBuilder Clone(
+ IResourceConfiguration resourceConfiguration
+ )
{
- return Merge(DockerResourceConfiguration, new WebDriverConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new WebDriverConfiguration(resourceConfiguration)
+ );
}
///
protected override WebDriverBuilder Clone(IContainerConfiguration resourceConfiguration)
{
- return Merge(DockerResourceConfiguration, new WebDriverConfiguration(resourceConfiguration));
+ return Merge(
+ DockerResourceConfiguration,
+ new WebDriverConfiguration(resourceConfiguration)
+ );
}
///
- protected override WebDriverBuilder Merge(WebDriverConfiguration oldValue, WebDriverConfiguration newValue)
+ protected override WebDriverBuilder Merge(
+ WebDriverConfiguration oldValue,
+ WebDriverConfiguration newValue
+ )
{
return new WebDriverBuilder(new WebDriverConfiguration(oldValue, newValue));
}
@@ -132,14 +162,13 @@ protected override WebDriverBuilder Merge(WebDriverConfiguration oldValue, WebDr
/// A value indicating whether the Selenium Grid is ready.
private static async Task IsGridReadyAsync(HttpResponseMessage response)
{
- var jsonString = await response.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var jsonString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- return JsonDocument.Parse(jsonString)
- .RootElement
- .GetProperty("value")
+ return JsonDocument
+ .Parse(jsonString)
+ .RootElement.GetProperty("value")
.GetProperty("ready")
.GetBoolean();
}
@@ -148,4 +177,4 @@ private static async Task IsGridReadyAsync(HttpResponseMessage response)
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.WebDriver/WebDriverConfiguration.cs b/src/Testcontainers.WebDriver/WebDriverConfiguration.cs
index cd5f2fc01..ed111c9eb 100644
--- a/src/Testcontainers.WebDriver/WebDriverConfiguration.cs
+++ b/src/Testcontainers.WebDriver/WebDriverConfiguration.cs
@@ -17,7 +17,9 @@ public WebDriverConfiguration(IContainer ffmpegContainer = null)
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public WebDriverConfiguration(IResourceConfiguration resourceConfiguration)
+ public WebDriverConfiguration(
+ IResourceConfiguration resourceConfiguration
+ )
: base(resourceConfiguration)
{
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
@@ -51,11 +53,14 @@ public WebDriverConfiguration(WebDriverConfiguration resourceConfiguration)
public WebDriverConfiguration(WebDriverConfiguration oldValue, WebDriverConfiguration newValue)
: base(oldValue, newValue)
{
- FFmpegContainer = BuildConfiguration.Combine(oldValue.FFmpegContainer, newValue.FFmpegContainer);
+ FFmpegContainer = BuildConfiguration.Combine(
+ oldValue.FFmpegContainer,
+ newValue.FFmpegContainer
+ );
}
///
/// Gets the FFmpeg container.
///
public IContainer FFmpegContainer { get; }
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.WebDriver/WebDriverContainer.cs b/src/Testcontainers.WebDriver/WebDriverContainer.cs
index 4797d6e0d..f6a003578 100644
--- a/src/Testcontainers.WebDriver/WebDriverContainer.cs
+++ b/src/Testcontainers.WebDriver/WebDriverContainer.cs
@@ -25,7 +25,11 @@ public WebDriverContainer(WebDriverConfiguration configuration)
/// The Selenium Grid connection string.
public string GetConnectionString()
{
- return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(WebDriverBuilder.WebDriverPort)).ToString();
+ return new UriBuilder(
+ Uri.UriSchemeHttp,
+ Hostname,
+ GetMappedPublicPort(WebDriverBuilder.WebDriverPort)
+ ).ToString();
}
///
@@ -48,18 +52,30 @@ public INetwork GetNetwork()
/// The video recording is either not enabled or the container has not been stopped.
public async Task ExportVideoAsync(string target, CancellationToken ct = default)
{
- Guard.Argument(_ffmpegContainer.State, nameof(_ffmpegContainer.State))
- .ThrowIf(argument => TestcontainersStates.Undefined.Equals(argument.Value), _ => new InvalidOperationException("Could not export video. Please enable the video recording first."));
-
- Guard.Argument(_ffmpegContainer.State, nameof(_ffmpegContainer.State))
- .ThrowIf(argument => !TestcontainersStates.Exited.Equals(argument.Value), _ => new InvalidOperationException("Could not export video. Please stop the WebDriver container first."));
-
- var bytes = await _ffmpegContainer.ReadFileAsync(WebDriverBuilder.VideoFilePath, ct)
+ Guard
+ .Argument(_ffmpegContainer.State, nameof(_ffmpegContainer.State))
+ .ThrowIf(
+ argument => TestcontainersStates.Undefined.Equals(argument.Value),
+ _ => new InvalidOperationException(
+ "Could not export video. Please enable the video recording first."
+ )
+ );
+
+ Guard
+ .Argument(_ffmpegContainer.State, nameof(_ffmpegContainer.State))
+ .ThrowIf(
+ argument => !TestcontainersStates.Exited.Equals(argument.Value),
+ _ => new InvalidOperationException(
+ "Could not export video. Please stop the WebDriver container first."
+ )
+ );
+
+ var bytes = await _ffmpegContainer
+ .ReadFileAsync(WebDriverBuilder.VideoFilePath, ct)
.ConfigureAwait(false);
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
- await File.WriteAllBytesAsync(target, bytes, ct)
- .ConfigureAwait(false);
+ await File.WriteAllBytesAsync(target, bytes, ct).ConfigureAwait(false);
#else
File.WriteAllBytes(target, bytes);
#endif
@@ -68,11 +84,9 @@ await File.WriteAllBytesAsync(target, bytes, ct)
///
protected override async Task UnsafeCreateAsync(CancellationToken ct = default)
{
- await _configuration.Networks.Single().CreateAsync(ct)
- .ConfigureAwait(false);
+ await _configuration.Networks.Single().CreateAsync(ct).ConfigureAwait(false);
- await base.UnsafeCreateAsync(ct)
- .ConfigureAwait(false);
+ await base.UnsafeCreateAsync(ct).ConfigureAwait(false);
}
///
@@ -84,21 +98,17 @@ protected override Task UnsafeDeleteAsync(CancellationToken ct = default)
///
protected override async Task UnsafeStartAsync(CancellationToken ct = default)
{
- await base.UnsafeStartAsync(ct)
- .ConfigureAwait(false);
+ await base.UnsafeStartAsync(ct).ConfigureAwait(false);
- await _ffmpegContainer.StartAsync(ct)
- .ConfigureAwait(false);
+ await _ffmpegContainer.StartAsync(ct).ConfigureAwait(false);
}
///
protected override async Task UnsafeStopAsync(CancellationToken ct = default)
{
- await _ffmpegContainer.StopAsync(ct)
- .ConfigureAwait(false);
+ await _ffmpegContainer.StopAsync(ct).ConfigureAwait(false);
- await base.UnsafeStopAsync(ct)
- .ConfigureAwait(false);
+ await base.UnsafeStopAsync(ct).ConfigureAwait(false);
}
///
@@ -106,23 +116,28 @@ await base.UnsafeStopAsync(ct)
///
private sealed class FFmpegContainer : DockerContainer
{
- static FFmpegContainer()
- {
- }
+ static FFmpegContainer() { }
///
/// Initializes a new instance of the class.
///
private FFmpegContainer()
- : base(new ContainerConfiguration(new ResourceConfiguration(new DockerEndpointAuthenticationConfiguration(new Uri("tcp://ffmpeg")), null, null, false, NullLogger.Instance)))
- {
- }
+ : base(
+ new ContainerConfiguration(
+ new ResourceConfiguration(
+ new DockerEndpointAuthenticationConfiguration(new Uri("tcp://ffmpeg")),
+ null,
+ null,
+ false,
+ NullLogger.Instance
+ )
+ )
+ ) { }
///
/// Gets the instance.
///
- public static IContainer Instance { get; }
- = new FFmpegContainer();
+ public static IContainer Instance { get; } = new FFmpegContainer();
///
public override Task StartAsync(CancellationToken ct = default)
@@ -136,4 +151,4 @@ public override Task StopAsync(CancellationToken ct = default)
return Task.CompletedTask;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/ContainerFixture.cs b/src/Testcontainers.Xunit/ContainerFixture.cs
index d368e46cf..360e31bd1 100644
--- a/src/Testcontainers.Xunit/ContainerFixture.cs
+++ b/src/Testcontainers.Xunit/ContainerFixture.cs
@@ -12,4 +12,4 @@ namespace Testcontainers.Xunit;
public class ContainerFixture(IMessageSink messageSink)
: ContainerLifetime(new MessageSinkLogger(messageSink))
where TBuilderEntity : IContainerBuilder, new()
- where TContainerEntity : IContainer;
\ No newline at end of file
+ where TContainerEntity : IContainer;
diff --git a/src/Testcontainers.Xunit/ContainerLifetime.cs b/src/Testcontainers.Xunit/ContainerLifetime.cs
index 3b07842f7..d6cbc844d 100644
--- a/src/Testcontainers.Xunit/ContainerLifetime.cs
+++ b/src/Testcontainers.Xunit/ContainerLifetime.cs
@@ -16,7 +16,9 @@ public abstract class ContainerLifetime : IAsy
protected ContainerLifetime(ILogger logger)
{
- _container = new Lazy(() => Configure(new TBuilderEntity().WithLogger(logger)).Build());
+ _container = new Lazy(() =>
+ Configure(new TBuilderEntity().WithLogger(logger)).Build()
+ );
}
///
@@ -41,8 +43,7 @@ public TContainerEntity Container
///
async LifetimeTask IAsyncDisposable.DisposeAsync()
{
- await DisposeAsyncCore()
- .ConfigureAwait(false);
+ await DisposeAsyncCore().ConfigureAwait(false);
GC.SuppressFinalize(this);
}
@@ -81,7 +82,7 @@ await Container.StartAsync(TestContext.Current.CancellationToken)
#else
await Container.StartAsync()
#endif
- .ConfigureAwait(false);
+ .ConfigureAwait(false);
}
catch (Exception e)
{
@@ -91,15 +92,14 @@ await Container.StartAsync()
#if XUNIT_V3
///
-#else
- ///
+#else
+ ///
#endif
protected virtual async LifetimeTask DisposeAsyncCore()
{
if (_exception == null)
{
- await Container.DisposeAsync()
- .ConfigureAwait(false);
+ await Container.DisposeAsync().ConfigureAwait(false);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/ContainerTest.cs b/src/Testcontainers.Xunit/ContainerTest.cs
index 50130830e..311136bc4 100644
--- a/src/Testcontainers.Xunit/ContainerTest.cs
+++ b/src/Testcontainers.Xunit/ContainerTest.cs
@@ -9,10 +9,13 @@ namespace Testcontainers.Xunit;
/// The builder entity.
/// The container entity.
[PublicAPI]
-public abstract class ContainerTest(ITestOutputHelper testOutputHelper, Func configure = null)
- : ContainerLifetime(new TestOutputLogger(testOutputHelper))
+public abstract class ContainerTest(
+ ITestOutputHelper testOutputHelper,
+ Func configure = null
+) : ContainerLifetime(new TestOutputLogger(testOutputHelper))
where TBuilderEntity : IContainerBuilder, new()
where TContainerEntity : IContainer
{
- protected override TBuilderEntity Configure(TBuilderEntity builder) => configure != null ? configure(builder) : builder;
-}
\ No newline at end of file
+ protected override TBuilderEntity Configure(TBuilderEntity builder) =>
+ configure != null ? configure(builder) : builder;
+}
diff --git a/src/Testcontainers.Xunit/DbContainerFixture.cs b/src/Testcontainers.Xunit/DbContainerFixture.cs
index f533f06ed..8d64a1dc1 100644
--- a/src/Testcontainers.Xunit/DbContainerFixture.cs
+++ b/src/Testcontainers.Xunit/DbContainerFixture.cs
@@ -9,7 +9,8 @@ namespace Testcontainers.Xunit;
/// The container entity.
[PublicAPI]
public abstract class DbContainerFixture(IMessageSink messageSink)
- : ContainerFixture(messageSink), IDbContainerTestMethods
+ : ContainerFixture(messageSink),
+ IDbContainerTestMethods
where TBuilderEntity : IContainerBuilder, new()
where TContainerEntity : IContainer, IDatabaseContainer
{
@@ -18,10 +19,12 @@ public abstract class DbContainerFixture(IMess
///
protected override async LifetimeTask InitializeAsync()
{
- await base.InitializeAsync()
- .ConfigureAwait(false);
+ await base.InitializeAsync().ConfigureAwait(false);
- _testMethods = new DbContainerTestMethods(DbProviderFactory, new Lazy(() => ConnectionString));
+ _testMethods = new DbContainerTestMethods(
+ DbProviderFactory,
+ new Lazy(() => ConnectionString)
+ );
}
///
@@ -29,12 +32,10 @@ protected override async LifetimeTask DisposeAsyncCore()
{
if (_testMethods != null)
{
- await _testMethods.DisposeAsync()
- .ConfigureAwait(true);
+ await _testMethods.DisposeAsync().ConfigureAwait(true);
}
- await base.DisposeAsyncCore()
- .ConfigureAwait(true);
+ await base.DisposeAsyncCore().ConfigureAwait(true);
}
///
@@ -55,12 +56,15 @@ await base.DisposeAsyncCore()
public DbConnection OpenConnection() => _testMethods.OpenConnection();
///
- public ValueTask OpenConnectionAsync(CancellationToken cancellationToken = default) => _testMethods.OpenConnectionAsync(cancellationToken);
+ public ValueTask OpenConnectionAsync(
+ CancellationToken cancellationToken = default
+ ) => _testMethods.OpenConnectionAsync(cancellationToken);
///
- public DbCommand CreateCommand(string commandText = null) => _testMethods.CreateCommand(commandText);
+ public DbCommand CreateCommand(string commandText = null) =>
+ _testMethods.CreateCommand(commandText);
///
public DbBatch CreateBatch() => _testMethods.CreateBatch();
#endif
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/DbContainerTest.cs b/src/Testcontainers.Xunit/DbContainerTest.cs
index ae5b29bfc..457f1b885 100644
--- a/src/Testcontainers.Xunit/DbContainerTest.cs
+++ b/src/Testcontainers.Xunit/DbContainerTest.cs
@@ -7,8 +7,12 @@ namespace Testcontainers.Xunit;
/// The builder entity.
/// The container entity.
[PublicAPI]
-public abstract class DbContainerTest(ITestOutputHelper testOutputHelper, Func configure = null)
- : ContainerTest(testOutputHelper, configure), IDbContainerTestMethods
+public abstract class DbContainerTest(
+ ITestOutputHelper testOutputHelper,
+ Func configure = null
+)
+ : ContainerTest(testOutputHelper, configure),
+ IDbContainerTestMethods
where TBuilderEntity : IContainerBuilder, new()
where TContainerEntity : IContainer, IDatabaseContainer
{
@@ -17,10 +21,12 @@ public abstract class DbContainerTest(ITestOut
///
protected override async LifetimeTask InitializeAsync()
{
- await base.InitializeAsync()
- .ConfigureAwait(false);
+ await base.InitializeAsync().ConfigureAwait(false);
- _testMethods = new DbContainerTestMethods(DbProviderFactory, new Lazy(() => ConnectionString));
+ _testMethods = new DbContainerTestMethods(
+ DbProviderFactory,
+ new Lazy(() => ConnectionString)
+ );
}
///
@@ -28,12 +34,10 @@ protected override async LifetimeTask DisposeAsyncCore()
{
if (_testMethods != null)
{
- await _testMethods.DisposeAsync()
- .ConfigureAwait(true);
+ await _testMethods.DisposeAsync().ConfigureAwait(true);
}
- await base.DisposeAsyncCore()
- .ConfigureAwait(true);
+ await base.DisposeAsyncCore().ConfigureAwait(true);
}
///
@@ -54,12 +58,15 @@ await base.DisposeAsyncCore()
public DbConnection OpenConnection() => _testMethods.OpenConnection();
///
- public ValueTask OpenConnectionAsync(CancellationToken cancellationToken = default) => _testMethods.OpenConnectionAsync(cancellationToken);
+ public ValueTask OpenConnectionAsync(
+ CancellationToken cancellationToken = default
+ ) => _testMethods.OpenConnectionAsync(cancellationToken);
///
- public DbCommand CreateCommand(string commandText = null) => _testMethods.CreateCommand(commandText);
+ public DbCommand CreateCommand(string commandText = null) =>
+ _testMethods.CreateCommand(commandText);
///
public DbBatch CreateBatch() => _testMethods.CreateBatch();
#endif
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/DbContainerTestMethods.cs b/src/Testcontainers.Xunit/DbContainerTestMethods.cs
index ec798553b..710de2e37 100644
--- a/src/Testcontainers.Xunit/DbContainerTestMethods.cs
+++ b/src/Testcontainers.Xunit/DbContainerTestMethods.cs
@@ -1,9 +1,14 @@
namespace Testcontainers.Xunit;
-internal sealed class DbContainerTestMethods(DbProviderFactory dbProviderFactory, Lazy connectionString) : IDbContainerTestMethods, IAsyncDisposable
+internal sealed class DbContainerTestMethods(
+ DbProviderFactory dbProviderFactory,
+ Lazy connectionString
+) : IDbContainerTestMethods, IAsyncDisposable
{
- private readonly DbProviderFactory _dbProviderFactory = dbProviderFactory ?? throw new ArgumentNullException(nameof(dbProviderFactory));
- private readonly Lazy _connectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
+ private readonly DbProviderFactory _dbProviderFactory =
+ dbProviderFactory ?? throw new ArgumentNullException(nameof(dbProviderFactory));
+ private readonly Lazy _connectionString =
+ connectionString ?? throw new ArgumentNullException(nameof(connectionString));
#if NET8_0_OR_GREATER
[CanBeNull]
@@ -21,9 +26,12 @@ private DbDataSource DbDataSource
public DbConnection OpenConnection() => DbDataSource.OpenConnection();
- public ValueTask OpenConnectionAsync(CancellationToken cancellationToken = default) => DbDataSource.OpenConnectionAsync(cancellationToken);
+ public ValueTask OpenConnectionAsync(
+ CancellationToken cancellationToken = default
+ ) => DbDataSource.OpenConnectionAsync(cancellationToken);
- public DbCommand CreateCommand(string commandText = null) => DbDataSource.CreateCommand(commandText);
+ public DbCommand CreateCommand(string commandText = null) =>
+ DbDataSource.CreateCommand(commandText);
public DbBatch CreateBatch() => DbDataSource.CreateBatch();
@@ -31,11 +39,15 @@ private DbDataSource DbDataSource
#else
public DbConnection CreateConnection()
{
- var connection = _dbProviderFactory.CreateConnection() ?? throw new InvalidOperationException($"DbProviderFactory.CreateConnection() returned null for {_dbProviderFactory}");
+ var connection =
+ _dbProviderFactory.CreateConnection()
+ ?? throw new InvalidOperationException(
+ $"DbProviderFactory.CreateConnection() returned null for {_dbProviderFactory}"
+ );
connection.ConnectionString = _connectionString.Value;
return connection;
}
public ValueTask DisposeAsync() => default;
#endif
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/IDbContainerTestMethods.cs b/src/Testcontainers.Xunit/IDbContainerTestMethods.cs
index a45e032c2..35e95aead 100644
--- a/src/Testcontainers.Xunit/IDbContainerTestMethods.cs
+++ b/src/Testcontainers.Xunit/IDbContainerTestMethods.cs
@@ -60,4 +60,4 @@ internal interface IDbContainerTestMethods
/// A that's ready for execution against the database.
DbBatch CreateBatch();
#endif
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/Logger.cs b/src/Testcontainers.Xunit/Logger.cs
index e3d8e5b53..cca6ebd1e 100644
--- a/src/Testcontainers.Xunit/Logger.cs
+++ b/src/Testcontainers.Xunit/Logger.cs
@@ -2,14 +2,30 @@ namespace Testcontainers.Xunit;
internal abstract class Logger : ILogger
{
- protected static string GetMessage(TState state, Exception exception, Func formatter)
+ protected static string GetMessage(
+ TState state,
+ Exception exception,
+ Func formatter
+ )
{
- return exception == null ? formatter(state, null) : $"{formatter(state, exception)}{Environment.NewLine}{exception}";
+ return exception == null
+ ? formatter(state, null)
+ : $"{formatter(state, exception)}{Environment.NewLine}{exception}";
}
- protected abstract void Log(TState state, Exception exception, Func formatter);
+ protected abstract void Log(
+ TState state,
+ Exception exception,
+ Func formatter
+ );
- public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
+ public void Log(
+ LogLevel logLevel,
+ EventId eventId,
+ TState state,
+ Exception exception,
+ Func formatter
+ )
{
Log(state, exception, formatter);
}
@@ -17,4 +33,4 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except
public bool IsEnabled(LogLevel logLevel) => logLevel != LogLevel.None;
public IDisposable BeginScope(TState state) => new NullScope();
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/MessageSinkLogger.cs b/src/Testcontainers.Xunit/MessageSinkLogger.cs
index 29a53d166..0a850705c 100644
--- a/src/Testcontainers.Xunit/MessageSinkLogger.cs
+++ b/src/Testcontainers.Xunit/MessageSinkLogger.cs
@@ -4,7 +4,11 @@ internal sealed class MessageSinkLogger(IMessageSink messageSink) : Logger
{
private readonly IMessageSink _messageSink = messageSink;
- protected override void Log(TState state, Exception exception, Func formatter)
+ protected override void Log(
+ TState state,
+ Exception exception,
+ Func formatter
+ )
{
if (_messageSink == null)
{
@@ -35,4 +39,4 @@ public override bool Equals(object obj)
/// logs the runtime information once per Docker Engine API client and logger.
///
public override int GetHashCode() => _messageSink?.GetHashCode() ?? 0;
-}
\ No newline at end of file
+}
diff --git a/src/Testcontainers.Xunit/NullScope.cs b/src/Testcontainers.Xunit/NullScope.cs
index 16c6393dc..37e54646f 100644
--- a/src/Testcontainers.Xunit/NullScope.cs
+++ b/src/Testcontainers.Xunit/NullScope.cs
@@ -2,7 +2,5 @@ namespace Testcontainers.Xunit;
internal sealed class NullScope : IDisposable
{
- public void Dispose()
- {
- }
-}
\ No newline at end of file
+ public void Dispose() { }
+}
diff --git a/src/Testcontainers.Xunit/TestOutputLogger.cs b/src/Testcontainers.Xunit/TestOutputLogger.cs
index e4e856ee2..6454afb1c 100644
--- a/src/Testcontainers.Xunit/TestOutputLogger.cs
+++ b/src/Testcontainers.Xunit/TestOutputLogger.cs
@@ -4,7 +4,11 @@ internal sealed class TestOutputLogger(ITestOutputHelper testOutputHelper) : Log
{
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
- protected override void Log(TState state, Exception exception, Func formatter)
+ protected override void Log(
+ TState state,
+ Exception exception,
+ Func formatter
+ )
{
if (testOutputHelper == null)
{
@@ -12,6 +16,8 @@ protected override void Log(TState state, Exception exception, Func
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers.Xunit/Usings.cs b/src/Testcontainers.Xunit/Usings.cs
index 90d314624..861615c69 100644
--- a/src/Testcontainers.Xunit/Usings.cs
+++ b/src/Testcontainers.Xunit/Usings.cs
@@ -16,4 +16,4 @@
#else
global using Xunit.Abstractions;
global using LifetimeTask = System.Threading.Tasks.Task;
-#endif
\ No newline at end of file
+#endif
diff --git a/src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj b/src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj
index a59b84b03..c99dac385 100644
--- a/src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj
+++ b/src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj
@@ -1,18 +1,22 @@
-
- net8.0;net9.0;netstandard2.0;netstandard2.1
- latest
- $(DefineConstants);XUNIT_V3
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+ $(DefineConstants);XUNIT_V3
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Testcontainers/Builders/AbstractBuilder`4.cs b/src/Testcontainers/Builders/AbstractBuilder`4.cs
index 5b7c0d857..e8369d395 100644
--- a/src/Testcontainers/Builders/AbstractBuilder`4.cs
+++ b/src/Testcontainers/Builders/AbstractBuilder`4.cs
@@ -18,7 +18,12 @@ namespace DotNet.Testcontainers.Builders
/// The underlying Docker.DotNet resource entity.
/// The configuration entity.
[PublicAPI]
- public abstract class AbstractBuilder : IAbstractBuilder
+ public abstract class AbstractBuilder<
+ TBuilderEntity,
+ TResourceEntity,
+ TCreateResourceEntity,
+ TConfigurationEntity
+ > : IAbstractBuilder
where TBuilderEntity : IAbstractBuilder
where TConfigurationEntity : IResourceConfiguration
{
@@ -26,9 +31,7 @@ public abstract class AbstractBuilder class.
///
/// The Docker resource configuration.
- protected AbstractBuilder(TConfigurationEntity dockerResourceConfiguration)
- {
- }
+ protected AbstractBuilder(TConfigurationEntity dockerResourceConfiguration) { }
///
/// Gets the Docker resource configuration.
@@ -48,21 +51,32 @@ public TBuilderEntity WithDockerEndpoint(Uri endpoint)
}
///
- public TBuilderEntity WithDockerEndpoint(IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig)
+ public TBuilderEntity WithDockerEndpoint(
+ IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig
+ )
{
- return Clone(new ResourceConfiguration(dockerEndpointAuthenticationConfiguration: dockerEndpointAuthConfig));
+ return Clone(
+ new ResourceConfiguration(
+ dockerEndpointAuthenticationConfiguration: dockerEndpointAuthConfig
+ )
+ );
}
///
public TBuilderEntity WithCleanUp(bool cleanUp)
{
- return WithResourceReaperSessionId(TestcontainersSettings.ResourceReaperEnabled && cleanUp ? ResourceReaper.DefaultSessionId : Guid.Empty);
+ return WithResourceReaperSessionId(
+ TestcontainersSettings.ResourceReaperEnabled && cleanUp
+ ? ResourceReaper.DefaultSessionId
+ : Guid.Empty
+ );
}
///
public TBuilderEntity WithReuse(bool reuse)
{
- return Clone(new ResourceConfiguration(reuse: reuse)).WithCleanUp(!reuse);
+ return Clone(new ResourceConfiguration(reuse: reuse))
+ .WithCleanUp(!reuse);
}
///
@@ -78,10 +92,14 @@ public TBuilderEntity WithLabel(IReadOnlyDictionary labels)
}
///
- public TBuilderEntity WithCreateParameterModifier(Action parameterModifier)
+ public TBuilderEntity WithCreateParameterModifier(
+ Action parameterModifier
+ )
{
var parameterModifiers = new[] { parameterModifier };
- return Clone(new ResourceConfiguration(parameterModifiers: parameterModifiers));
+ return Clone(
+ new ResourceConfiguration(parameterModifiers: parameterModifiers)
+ );
}
///
@@ -100,7 +118,10 @@ public TBuilderEntity WithLogger(ILogger logger)
/// A configured instance of .
protected TBuilderEntity WithResourceReaperSessionId(Guid resourceReaperSessionId)
{
- return WithLabel(ResourceReaper.ResourceReaperSessionLabel, resourceReaperSessionId.ToString("D"));
+ return WithLabel(
+ ResourceReaper.ResourceReaperSessionLabel,
+ resourceReaperSessionId.ToString("D")
+ );
}
///
@@ -131,7 +152,9 @@ protected TBuilderEntity WithResourceReaperSessionId(Guid resourceReaperSessionI
/// A configured instance of .
protected virtual TBuilderEntity Init()
{
- return WithDockerEndpoint(TestcontainersSettings.OS.DockerEndpointAuthConfig).WithLabel(DefaultLabels.Instance).WithLogger(ConsoleLogger.Instance);
+ return WithDockerEndpoint(TestcontainersSettings.OS.DockerEndpointAuthConfig)
+ .WithLabel(DefaultLabels.Instance)
+ .WithLogger(ConsoleLogger.Instance);
}
///
@@ -140,15 +163,34 @@ protected virtual TBuilderEntity Init()
/// Thrown when a mandatory Docker resource configuration is not set.
protected virtual void Validate()
{
- _ = Guard.Argument(DockerResourceConfiguration.Logger, nameof(IResourceConfiguration.Logger))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.Logger,
+ nameof(IResourceConfiguration.Logger)
+ )
.NotNull();
- _ = Guard.Argument(DockerResourceConfiguration.DockerEndpointAuthConfig, nameof(IResourceConfiguration.DockerEndpointAuthConfig))
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration.DockerEndpointAuthConfig,
+ nameof(IResourceConfiguration.DockerEndpointAuthConfig)
+ )
.ThrowIf(argument => argument.Value == null, CreateDockerUnavailableException);
- const string reuseNotSupported = "Reuse cannot be used in conjunction with WithCleanUp(true).";
- _ = Guard.Argument(DockerResourceConfiguration, nameof(IResourceConfiguration.Reuse))
- .ThrowIf(argument => argument.Value.Reuse.HasValue && argument.Value.Reuse.Value && !Guid.Empty.Equals(argument.Value.SessionId), argument => new ArgumentException(reuseNotSupported, argument.Name));
+ const string reuseNotSupported =
+ "Reuse cannot be used in conjunction with WithCleanUp(true).";
+ _ = Guard
+ .Argument(
+ DockerResourceConfiguration,
+ nameof(IResourceConfiguration.Reuse)
+ )
+ .ThrowIf(
+ argument =>
+ argument.Value.Reuse.HasValue
+ && argument.Value.Reuse.Value
+ && !Guid.Empty.Equals(argument.Value.SessionId),
+ argument => new ArgumentException(reuseNotSupported, argument.Name)
+ );
}
///
@@ -156,7 +198,9 @@ protected virtual void Validate()
///
/// The Docker resource configuration.
/// A configured instance of .
- protected abstract TBuilderEntity Clone(IResourceConfiguration resourceConfiguration);
+ protected abstract TBuilderEntity Clone(
+ IResourceConfiguration resourceConfiguration
+ );
///
/// Merges the Docker resource builder configuration.
@@ -164,22 +208,35 @@ protected virtual void Validate()
/// The old Docker resource configuration.
/// The new Docker resource configuration.
/// A configured instance of .
- protected abstract TBuilderEntity Merge(TConfigurationEntity oldValue, TConfigurationEntity newValue);
-
- private static Exception CreateDockerUnavailableException(Guard.ArgumentInfo argument)
+ protected abstract TBuilderEntity Merge(
+ TConfigurationEntity oldValue,
+ TConfigurationEntity newValue
+ );
+
+ private static Exception CreateDockerUnavailableException(
+ Guard.ArgumentInfo argument
+ )
{
- var unavailableExceptions = TestcontainersSettings.DockerEndpointAuthProviders
- .Select(authProvider => authProvider.LastException)
+ var unavailableExceptions = TestcontainersSettings
+ .DockerEndpointAuthProviders.Select(authProvider => authProvider.LastException)
.Where(exception => exception != null);
var exception = new AggregateException(unavailableExceptions);
var exceptionInfo = new StringBuilder(512);
- exceptionInfo.AppendLine("Docker is either not running or misconfigured. Please ensure that Docker is running and that the endpoint is properly configured.");
- exceptionInfo.AppendLine("You can customize your configuration using either the environment variables or the ~/.testcontainers.properties file.");
- exceptionInfo.AppendLine("For more information, visit: https://dotnet.testcontainers.org/custom_configuration/.");
+ exceptionInfo.AppendLine(
+ "Docker is either not running or misconfigured. Please ensure that Docker is running and that the endpoint is properly configured."
+ );
+ exceptionInfo.AppendLine(
+ "You can customize your configuration using either the environment variables or the ~/.testcontainers.properties file."
+ );
+ exceptionInfo.AppendLine(
+ "For more information, visit: https://dotnet.testcontainers.org/custom_configuration/."
+ );
exceptionInfo.AppendLine(" Details: ");
- exceptionInfo.Append(string.Join(Environment.NewLine, exception.InnerExceptions.Select(e => " " + e.Message)));
+ exceptionInfo.Append(
+ string.Join(Environment.NewLine, exception.InnerExceptions.Select(e => " " + e.Message))
+ );
return new DockerUnavailableException(exceptionInfo.ToString(), exception);
}
diff --git a/src/Testcontainers/Builders/Base64Provider.cs b/src/Testcontainers/Builders/Base64Provider.cs
index 465477792..2baeec621 100644
--- a/src/Testcontainers/Builders/Base64Provider.cs
+++ b/src/Testcontainers/Builders/Base64Provider.cs
@@ -22,9 +22,7 @@ internal sealed class Base64Provider : IDockerRegistryAuthenticationProvider
/// The logger.
[PublicAPI]
public Base64Provider(JsonDocument jsonDocument, ILogger logger)
- : this(jsonDocument.RootElement, logger)
- {
- }
+ : this(jsonDocument.RootElement, logger) { }
///
/// Initializes a new instance of the class.
@@ -59,9 +57,16 @@ public static bool HasDockerRegistryName(JsonProperty property, string registryH
return true;
}
- if (TryGetHost(propertyName, out var propertyNameNormalized) && TryGetHost(registryHost, out var registryHostNormalized))
+ if (
+ TryGetHost(propertyName, out var propertyNameNormalized)
+ && TryGetHost(registryHost, out var registryHostNormalized)
+ )
{
- return string.Equals(propertyNameNormalized, registryHostNormalized, StringComparison.OrdinalIgnoreCase);
+ return string.Equals(
+ propertyNameNormalized,
+ registryHostNormalized,
+ StringComparison.OrdinalIgnoreCase
+ );
}
else
{
@@ -72,7 +77,11 @@ public static bool HasDockerRegistryName(JsonProperty property, string registryH
///
public bool IsApplicable(string hostname)
{
- return !JsonValueKind.Undefined.Equals(_rootElement.ValueKind) && !JsonValueKind.Null.Equals(_rootElement.ValueKind) && _rootElement.EnumerateObject().Any(property => HasDockerRegistryName(property, hostname));
+ return !JsonValueKind.Undefined.Equals(_rootElement.ValueKind)
+ && !JsonValueKind.Null.Equals(_rootElement.ValueKind)
+ && _rootElement
+ .EnumerateObject()
+ .Any(property => HasDockerRegistryName(property, hostname));
}
///
@@ -85,21 +94,31 @@ public IDockerRegistryAuthenticationConfiguration GetAuthConfig(string hostname)
return null;
}
- var authProperty = _rootElement.EnumerateObject().LastOrDefault(property => HasDockerRegistryName(property, hostname));
+ var authProperty = _rootElement
+ .EnumerateObject()
+ .LastOrDefault(property => HasDockerRegistryName(property, hostname));
if (JsonValueKind.Undefined.Equals(authProperty.Value.ValueKind))
{
return null;
}
- if (authProperty.Value.TryGetProperty("identitytoken", out var identityToken) && JsonValueKind.String.Equals(identityToken.ValueKind))
+ if (
+ authProperty.Value.TryGetProperty("identitytoken", out var identityToken)
+ && JsonValueKind.String.Equals(identityToken.ValueKind)
+ )
{
var identityTokenValue = identityToken.GetString();
if (!string.IsNullOrEmpty(identityTokenValue))
{
_logger.DockerRegistryCredentialFound(hostname);
- return new DockerRegistryAuthenticationConfiguration(authProperty.Name, null, null, identityTokenValue);
+ return new DockerRegistryAuthenticationConfiguration(
+ authProperty.Name,
+ null,
+ null,
+ identityTokenValue
+ );
}
}
@@ -108,7 +127,9 @@ public IDockerRegistryAuthenticationConfiguration GetAuthConfig(string hostname)
return null;
}
- if (!JsonValueKind.String.Equals(auth.ValueKind) && !JsonValueKind.Null.Equals(auth.ValueKind))
+ if (
+ !JsonValueKind.String.Equals(auth.ValueKind) && !JsonValueKind.Null.Equals(auth.ValueKind)
+ )
{
_logger.DockerRegistryAuthPropertyValueKindInvalid(hostname, auth.ValueKind);
return null;
@@ -143,7 +164,11 @@ public IDockerRegistryAuthenticationConfiguration GetAuthConfig(string hostname)
}
_logger.DockerRegistryCredentialFound(hostname);
- return new DockerRegistryAuthenticationConfiguration(authProperty.Name, credential[0], credential[1]);
+ return new DockerRegistryAuthenticationConfiguration(
+ authProperty.Name,
+ credential[0],
+ credential[1]
+ );
}
///
diff --git a/src/Testcontainers/Builders/BuildConfiguration.cs b/src/Testcontainers/Builders/BuildConfiguration.cs
index a4dcec675..71adbd361 100644
--- a/src/Testcontainers/Builders/BuildConfiguration.cs
+++ b/src/Testcontainers/Builders/BuildConfiguration.cs
@@ -33,9 +33,7 @@ public static T Combine(T oldValue, T newValue)
/// The new configuration.
/// The type of elements in the collection.
/// An updated configuration.
- public static IEnumerable Combine(
- IEnumerable oldValue,
- IEnumerable newValue)
+ public static IEnumerable Combine(IEnumerable oldValue, IEnumerable newValue)
{
if (newValue == null && oldValue == null)
{
@@ -59,9 +57,7 @@ public static IEnumerable Combine(
/// The new configuration.
/// The type of elements in the collection.
/// An updated configuration.
- public static IReadOnlyList Combine(
- IReadOnlyList oldValue,
- IReadOnlyList newValue)
+ public static IReadOnlyList Combine(IReadOnlyList oldValue, IReadOnlyList