diff --git a/src/Testcontainers/Builders/AbstractBuilder`2.cs b/src/Testcontainers/Builders/AbstractBuilder`2.cs
index dcedd01a0..ce9a32994 100644
--- a/src/Testcontainers/Builders/AbstractBuilder`2.cs
+++ b/src/Testcontainers/Builders/AbstractBuilder`2.cs
@@ -12,14 +12,15 @@
///
/// The builder entity.
/// The resource entity.
+ /// The underlying Docker.DotNet resource entity.
/// The configuration entity.
[PublicAPI]
- public abstract class AbstractBuilder : IAbstractBuilder
- where TBuilderEntity : IAbstractBuilder
- where TConfigurationEntity : IResourceConfiguration
+ public abstract class AbstractBuilder : IAbstractBuilder
+ where TBuilderEntity : IAbstractBuilder
+ where TConfigurationEntity : IResourceConfiguration
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The Docker resource configuration.
protected AbstractBuilder(TConfigurationEntity dockerResourceConfiguration)
@@ -33,43 +34,50 @@ protected AbstractBuilder(TConfigurationEntity dockerResourceConfiguration)
///
protected virtual TConfigurationEntity DockerResourceConfiguration { get; }
- ///
+ ///
public TBuilderEntity WithDockerEndpoint(string endpoint)
{
return this.WithDockerEndpoint(new Uri(endpoint));
}
- ///
+ ///
public TBuilderEntity WithDockerEndpoint(Uri endpoint)
{
return this.WithDockerEndpoint(new DockerEndpointAuthenticationConfiguration(endpoint));
}
- ///
+ ///
public TBuilderEntity WithDockerEndpoint(IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig)
{
- return this.Clone(new ResourceConfiguration(dockerEndpointAuthenticationConfiguration: dockerEndpointAuthConfig));
+ return this.Clone(new ResourceConfiguration(dockerEndpointAuthenticationConfiguration: dockerEndpointAuthConfig));
}
- ///
+ ///
public TBuilderEntity WithCleanUp(bool cleanUp)
{
return this.WithResourceReaperSessionId(TestcontainersSettings.ResourceReaperEnabled && cleanUp ? ResourceReaper.DefaultSessionId : Guid.Empty);
}
- ///
+ ///
public TBuilderEntity WithLabel(string name, string value)
{
return this.WithLabel(new Dictionary { { name, value } });
}
- ///
+ ///
public TBuilderEntity WithLabel(IReadOnlyDictionary labels)
{
- return this.Clone(new ResourceConfiguration(labels: labels));
+ return this.Clone(new ResourceConfiguration(labels: labels));
}
- ///
+ ///
+ public TBuilderEntity WithCreateParameterModifier(Action parameterModifier)
+ {
+ var parameterModifiers = new[] { parameterModifier };
+ return this.Clone(new ResourceConfiguration(parameterModifiers: parameterModifiers));
+ }
+
+ ///
public abstract TResourceEntity Build();
///
@@ -119,7 +127,7 @@ protected virtual TBuilderEntity Init()
/// Thrown when a mandatory Docker resource configuration is not set.
protected virtual void Validate()
{
- _ = Guard.Argument(this.DockerResourceConfiguration.DockerEndpointAuthConfig, nameof(IResourceConfiguration.DockerEndpointAuthConfig))
+ _ = Guard.Argument(this.DockerResourceConfiguration.DockerEndpointAuthConfig, nameof(IResourceConfiguration.DockerEndpointAuthConfig))
.DockerEndpointAuthConfigIsSet();
}
@@ -128,7 +136,7 @@ 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.
diff --git a/src/Testcontainers/Builders/ContainerBuilder.cs b/src/Testcontainers/Builders/ContainerBuilder.cs
index 31b90603f..fbae0aeb9 100644
--- a/src/Testcontainers/Builders/ContainerBuilder.cs
+++ b/src/Testcontainers/Builders/ContainerBuilder.cs
@@ -1,5 +1,6 @@
namespace DotNet.Testcontainers.Builders
{
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Containers;
using JetBrains.Annotations;
@@ -57,15 +58,15 @@ public override IContainer Build()
}
///
- protected override ContainerBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected sealed override ContainerBuilder Init()
{
- return this.Merge(this.DockerResourceConfiguration, new ContainerConfiguration(resourceConfiguration));
+ return base.Init();
}
///
- protected sealed override ContainerBuilder Init()
+ protected override ContainerBuilder Clone(IResourceConfiguration resourceConfiguration)
{
- return base.Init();
+ return this.Merge(this.DockerResourceConfiguration, new ContainerConfiguration(resourceConfiguration));
}
///
diff --git a/src/Testcontainers/Builders/ContainerBuilder`1.cs b/src/Testcontainers/Builders/ContainerBuilder`1.cs
index e426b1caa..21e3c6347 100644
--- a/src/Testcontainers/Builders/ContainerBuilder`1.cs
+++ b/src/Testcontainers/Builders/ContainerBuilder`1.cs
@@ -2,6 +2,7 @@
{
using System;
using System.Reflection;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Containers;
using JetBrains.Annotations;
@@ -71,7 +72,7 @@ protected sealed override ContainerBuilder Init()
}
///
- protected override ContainerBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ContainerBuilder Clone(IResourceConfiguration resourceConfiguration)
{
return this.Merge(this.DockerResourceConfiguration, new ContainerConfiguration(resourceConfiguration));
}
diff --git a/src/Testcontainers/Builders/ContainerBuilder`3.cs b/src/Testcontainers/Builders/ContainerBuilder`3.cs
index a7258843a..edb8022e1 100644
--- a/src/Testcontainers/Builders/ContainerBuilder`3.cs
+++ b/src/Testcontainers/Builders/ContainerBuilder`3.cs
@@ -21,7 +21,7 @@
/// The resource entity.
/// The configuration entity.
[PublicAPI]
- public abstract class ContainerBuilder : AbstractBuilder, IContainerBuilder
+ public abstract class ContainerBuilder : AbstractBuilder, IContainerBuilder
where TBuilderEntity : IContainerBuilder
where TContainerEntity : IContainer
where TConfigurationEntity : IContainerConfiguration
@@ -303,8 +303,7 @@ public TBuilderEntity WithStartupCallback(Func
public TBuilderEntity WithCreateContainerParametersModifier(Action parameterModifier)
{
- var parameterModifiers = new[] { parameterModifier };
- return this.Clone(new ContainerConfiguration(parameterModifiers: parameterModifiers));
+ return this.WithCreateParameterModifier(parameterModifier);
}
public TBuilderEntity WithImage(IDockerImage image)
@@ -327,13 +326,13 @@ public TBuilderEntity WithVolumeMount(IDockerVolume volume, string destination,
return this.WithVolumeMount(new DockerVolume(volume), destination, accessMode);
}
- ///
+ ///
protected override TBuilderEntity Init()
{
return base.Init().WithImagePullPolicy(PullPolicy.Missing).WithOutputConsumer(Consume.DoNotConsumeStdoutAndStderr()).WithWaitStrategy(Wait.ForUnixContainer()).WithStartupCallback((_, ct) => Task.CompletedTask);
}
- ///
+ ///
protected override void Validate()
{
base.Validate();
@@ -460,13 +459,13 @@ public DockerVolume(string name)
public string Name { get; }
///
- public Task CreateAsync(CancellationToken ct)
+ public Task CreateAsync(CancellationToken ct = default)
{
return Task.CompletedTask;
}
///
- public Task DeleteAsync(CancellationToken ct)
+ public Task DeleteAsync(CancellationToken ct = default)
{
return Task.CompletedTask;
}
diff --git a/src/Testcontainers/Builders/IAbstractBuilder`2.cs b/src/Testcontainers/Builders/IAbstractBuilder`2.cs
index 0858970d9..b9d6d7769 100644
--- a/src/Testcontainers/Builders/IAbstractBuilder`2.cs
+++ b/src/Testcontainers/Builders/IAbstractBuilder`2.cs
@@ -11,8 +11,9 @@
///
/// The builder entity.
/// The resource entity.
+ /// The underlying Docker.DotNet resource entity.
[PublicAPI]
- public interface IAbstractBuilder
+ public interface IAbstractBuilder
{
///
/// Sets the Docker API endpoint.
@@ -75,6 +76,14 @@ public interface IAbstractBuilder
[PublicAPI]
TBuilderEntity WithLabel(IReadOnlyDictionary labels);
+ ///
+ /// Allows low level modifications of the Docker.DotNet entity after the builder configuration has been applied. Multiple low level modifications will be executed in order of insertion.
+ ///
+ /// The action that invokes modifying the Docker.DotNet entity instance.
+ /// A configured instance of .
+ [PublicAPI]
+ TBuilderEntity WithCreateParameterModifier(Action parameterModifier);
+
///
/// Builds an instance of with the given resource configuration.
///
diff --git a/src/Testcontainers/Builders/IContainerBuilder`2.cs b/src/Testcontainers/Builders/IContainerBuilder`2.cs
index 0bc0a4db1..2835bcb8e 100644
--- a/src/Testcontainers/Builders/IContainerBuilder`2.cs
+++ b/src/Testcontainers/Builders/IContainerBuilder`2.cs
@@ -18,7 +18,7 @@
/// The builder entity.
/// The resource entity.
[PublicAPI]
- public interface IContainerBuilder : IAbstractBuilder
+ public interface IContainerBuilder : IAbstractBuilder
{
///
/// Sets the module configuration of the container to override custom properties.
@@ -377,9 +377,7 @@ public interface IContainerBuilder : I
///
/// The action that invokes modifying the instance.
/// A configured instance of .
- [PublicAPI]
-
- // TODO: Move this approach to the abstract builder, all resources benefit from a method like this.
+ [Obsolete("Use WithCreateParameterModifier(Action) instead.")]
TBuilderEntity WithCreateContainerParametersModifier(Action parameterModifier);
[Obsolete("Use WithImage(IImage) instead.")]
diff --git a/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs b/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs
index a3c4d9c65..f341070df 100644
--- a/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs
+++ b/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs
@@ -2,8 +2,8 @@
{
using System;
using System.Collections.Generic;
- using System.Globalization;
using System.IO;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Images;
using JetBrains.Annotations;
@@ -25,7 +25,7 @@
///
///
[PublicAPI]
- public class ImageFromDockerfileBuilder : AbstractBuilder, IImageFromDockerfileBuilder
+ public class ImageFromDockerfileBuilder : AbstractBuilder, IImageFromDockerfileBuilder
{
///
/// Initializes a new instance of the class.
@@ -112,7 +112,7 @@ protected sealed override ImageFromDockerfileBuilder Init()
}
///
- protected override ImageFromDockerfileBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override ImageFromDockerfileBuilder Clone(IResourceConfiguration resourceConfiguration)
{
return this.Merge(this.DockerResourceConfiguration, new ImageFromDockerfileConfiguration(resourceConfiguration));
}
diff --git a/src/Testcontainers/Builders/NetworkBuilder.cs b/src/Testcontainers/Builders/NetworkBuilder.cs
index c5b2c8d21..366f92f1e 100644
--- a/src/Testcontainers/Builders/NetworkBuilder.cs
+++ b/src/Testcontainers/Builders/NetworkBuilder.cs
@@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Networks;
using JetBrains.Annotations;
@@ -21,7 +22,7 @@
///
///
[PublicAPI]
- public class NetworkBuilder : AbstractBuilder, INetworkBuilder
+ public class NetworkBuilder : AbstractBuilder, INetworkBuilder
{
///
/// Initializes a new instance of the class.
@@ -88,7 +89,7 @@ protected override void Validate()
}
///
- protected override NetworkBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override NetworkBuilder Clone(IResourceConfiguration resourceConfiguration)
{
return this.Merge(this.DockerResourceConfiguration, new NetworkConfiguration(resourceConfiguration));
}
diff --git a/src/Testcontainers/Builders/VolumeBuilder.cs b/src/Testcontainers/Builders/VolumeBuilder.cs
index 2c067fdbe..a9be76d26 100644
--- a/src/Testcontainers/Builders/VolumeBuilder.cs
+++ b/src/Testcontainers/Builders/VolumeBuilder.cs
@@ -1,6 +1,7 @@
namespace DotNet.Testcontainers.Builders
{
using System;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Volumes;
using JetBrains.Annotations;
@@ -19,7 +20,7 @@
///
///
[PublicAPI]
- public class VolumeBuilder : AbstractBuilder, IVolumeBuilder
+ public class VolumeBuilder : AbstractBuilder, IVolumeBuilder
{
///
/// Initializes a new instance of the class.
@@ -73,7 +74,7 @@ protected override void Validate()
}
///
- protected override VolumeBuilder Clone(IResourceConfiguration resourceConfiguration)
+ protected override VolumeBuilder Clone(IResourceConfiguration resourceConfiguration)
{
return this.Merge(this.DockerResourceConfiguration, new VolumeConfiguration(resourceConfiguration));
}
diff --git a/src/Testcontainers/Configurations/Commons/IResourceConfiguration.cs b/src/Testcontainers/Configurations/Commons/IResourceConfiguration.cs
index 9cd231c0b..cd1e8b380 100644
--- a/src/Testcontainers/Configurations/Commons/IResourceConfiguration.cs
+++ b/src/Testcontainers/Configurations/Commons/IResourceConfiguration.cs
@@ -7,8 +7,9 @@
///
/// A resource configuration.
///
+ /// The underlying Docker.DotNet resource entity.
[PublicAPI]
- public interface IResourceConfiguration
+ public interface IResourceConfiguration
{
///
/// Gets the test session id.
@@ -24,5 +25,10 @@ public interface IResourceConfiguration
/// Gets a list of labels.
///
IReadOnlyDictionary Labels { get; }
+
+ ///
+ /// Gets a list of low level modifications of the Docker.DotNet entity.
+ ///
+ IReadOnlyList> ParameterModifiers { get; }
}
}
diff --git a/src/Testcontainers/Configurations/Commons/ResourceConfiguration.cs b/src/Testcontainers/Configurations/Commons/ResourceConfiguration.cs
index a33dd8f31..da5e34d2f 100644
--- a/src/Testcontainers/Configurations/Commons/ResourceConfiguration.cs
+++ b/src/Testcontainers/Configurations/Commons/ResourceConfiguration.cs
@@ -6,41 +6,45 @@
using DotNet.Testcontainers.Containers;
using JetBrains.Annotations;
- ///
+ ///
[PublicAPI]
- public class ResourceConfiguration : IResourceConfiguration
+ public class ResourceConfiguration : IResourceConfiguration
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The Docker endpoint authentication configuration.
/// The test session id.
+ /// A list of low level modifications of the Docker.DotNet entity.
public ResourceConfiguration(
IDockerEndpointAuthenticationConfiguration dockerEndpointAuthenticationConfiguration = null,
- IReadOnlyDictionary labels = null)
+ IReadOnlyDictionary labels = null,
+ IReadOnlyList> parameterModifiers = null)
{
+ this.SessionId = labels != null && labels.TryGetValue(ResourceReaper.ResourceReaperSessionLabel, out var resourceReaperSessionId) && Guid.TryParseExact(resourceReaperSessionId, "D", out var sessionId) ? sessionId : Guid.Empty;
this.DockerEndpointAuthConfig = dockerEndpointAuthenticationConfiguration;
this.Labels = labels;
- this.SessionId = labels != null && labels.TryGetValue(ResourceReaper.ResourceReaperSessionLabel, out var resourceReaperSessionId) && Guid.TryParseExact(resourceReaperSessionId, "D", out var sessionId) ? sessionId : Guid.Empty;
+ this.ParameterModifiers = parameterModifiers;
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- protected ResourceConfiguration(IResourceConfiguration resourceConfiguration)
- : this(new ResourceConfiguration(), resourceConfiguration)
+ protected ResourceConfiguration(IResourceConfiguration resourceConfiguration)
+ : this(new ResourceConfiguration(), resourceConfiguration)
{
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The old Docker resource configuration.
/// The new Docker resource configuration.
- protected ResourceConfiguration(IResourceConfiguration oldValue, IResourceConfiguration newValue)
+ protected ResourceConfiguration(IResourceConfiguration oldValue, IResourceConfiguration newValue)
: this(
dockerEndpointAuthenticationConfiguration: BuildConfiguration.Combine(oldValue.DockerEndpointAuthConfig, newValue.DockerEndpointAuthConfig),
+ parameterModifiers: BuildConfiguration.Combine(oldValue.ParameterModifiers, newValue.ParameterModifiers),
labels: BuildConfiguration.Combine(oldValue.Labels, newValue.Labels))
{
}
@@ -53,5 +57,8 @@ protected ResourceConfiguration(IResourceConfiguration oldValue, IResourceConfig
///
public IReadOnlyDictionary Labels { get; }
+
+ ///
+ public IReadOnlyList> ParameterModifiers { get; }
}
}
diff --git a/src/Testcontainers/Configurations/Containers/ContainerConfiguration.cs b/src/Testcontainers/Configurations/Containers/ContainerConfiguration.cs
index 460caf1f2..2e96f91e3 100644
--- a/src/Testcontainers/Configurations/Containers/ContainerConfiguration.cs
+++ b/src/Testcontainers/Configurations/Containers/ContainerConfiguration.cs
@@ -13,7 +13,7 @@
///
[PublicAPI]
- public class ContainerConfiguration : ResourceConfiguration, IContainerConfiguration
+ public class ContainerConfiguration : ResourceConfiguration, IContainerConfiguration
{
///
/// Initializes a new instance of the class.
@@ -36,7 +36,6 @@ public class ContainerConfiguration : ResourceConfiguration, IContainerConfigura
/// The output consumer.
/// The wait strategies.
/// The startup callback.
- /// A list of low level modifications of .
/// A value indicating whether Docker removes the container after it exits or not.
/// A value indicating whether the privileged flag is set or not.
public ContainerConfiguration(
@@ -58,7 +57,6 @@ public ContainerConfiguration(
IOutputConsumer outputConsumer = null,
IEnumerable waitStrategies = null,
Func startupCallback = null,
- IReadOnlyList> parameterModifiers = null,
bool? autoRemove = null,
bool? privileged = null)
{
@@ -82,14 +80,13 @@ public ContainerConfiguration(
this.OutputConsumer = outputConsumer;
this.WaitStrategies = waitStrategies;
this.StartupCallback = startupCallback;
- this.ParameterModifiers = parameterModifiers;
}
///
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ContainerConfiguration(IResourceConfiguration resourceConfiguration)
+ public ContainerConfiguration(IResourceConfiguration resourceConfiguration)
: base(resourceConfiguration)
{
}
@@ -129,7 +126,6 @@ public ContainerConfiguration(IContainerConfiguration oldValue, IContainerConfig
this.OutputConsumer = BuildConfiguration.Combine(oldValue.OutputConsumer, newValue.OutputConsumer);
this.WaitStrategies = BuildConfiguration.Combine>(oldValue.WaitStrategies, newValue.WaitStrategies);
this.StartupCallback = BuildConfiguration.Combine(oldValue.StartupCallback, newValue.StartupCallback);
- this.ParameterModifiers = BuildConfiguration.Combine(oldValue.ParameterModifiers, newValue.ParameterModifiers);
this.AutoRemove = (oldValue.AutoRemove.HasValue && oldValue.AutoRemove.Value) || (newValue.AutoRemove.HasValue && newValue.AutoRemove.Value);
this.Privileged = (oldValue.Privileged.HasValue && oldValue.Privileged.Value) || (newValue.Privileged.HasValue && newValue.Privileged.Value);
}
@@ -193,8 +189,5 @@ public ContainerConfiguration(IContainerConfiguration oldValue, IContainerConfig
///
public Func StartupCallback { get; }
-
- ///
- public IReadOnlyList> ParameterModifiers { get; }
}
}
diff --git a/src/Testcontainers/Configurations/Containers/IContainerConfiguration.cs b/src/Testcontainers/Configurations/Containers/IContainerConfiguration.cs
index 0e28ebebe..383616980 100644
--- a/src/Testcontainers/Configurations/Containers/IContainerConfiguration.cs
+++ b/src/Testcontainers/Configurations/Containers/IContainerConfiguration.cs
@@ -14,7 +14,7 @@
/// A container configuration.
///
[PublicAPI]
- public interface IContainerConfiguration : IResourceConfiguration
+ public interface IContainerConfiguration : IResourceConfiguration
{
///
/// Gets a value indicating whether Docker removes the container after it exits or not.
@@ -115,10 +115,5 @@ public interface IContainerConfiguration : IResourceConfiguration
/// Gets the startup callback.
///
Func StartupCallback { get; }
-
- ///
- /// Gets a list of low level modifications of .
- ///
- IReadOnlyList> ParameterModifiers { get; }
}
}
diff --git a/src/Testcontainers/Configurations/Images/IImageFromDockerfileConfiguration.cs b/src/Testcontainers/Configurations/Images/IImageFromDockerfileConfiguration.cs
index fd63ffe35..c387b62c2 100644
--- a/src/Testcontainers/Configurations/Images/IImageFromDockerfileConfiguration.cs
+++ b/src/Testcontainers/Configurations/Images/IImageFromDockerfileConfiguration.cs
@@ -1,6 +1,7 @@
namespace DotNet.Testcontainers.Configurations
{
using System.Collections.Generic;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Images;
using JetBrains.Annotations;
@@ -8,7 +9,7 @@
/// An image configuration.
///
[PublicAPI]
- public interface IImageFromDockerfileConfiguration : IResourceConfiguration
+ public interface IImageFromDockerfileConfiguration : IResourceConfiguration
{
///
/// Gets a value indicating whether Testcontainers removes an existing image or not.
diff --git a/src/Testcontainers/Configurations/Images/ImageFromDockerfileConfiguration.cs b/src/Testcontainers/Configurations/Images/ImageFromDockerfileConfiguration.cs
index b24396ae2..85974bbb2 100644
--- a/src/Testcontainers/Configurations/Images/ImageFromDockerfileConfiguration.cs
+++ b/src/Testcontainers/Configurations/Images/ImageFromDockerfileConfiguration.cs
@@ -1,13 +1,14 @@
namespace DotNet.Testcontainers.Configurations
{
using System.Collections.Generic;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Builders;
using DotNet.Testcontainers.Images;
using JetBrains.Annotations;
///
[PublicAPI]
- internal sealed class ImageFromDockerfileConfiguration : ResourceConfiguration, IImageFromDockerfileConfiguration
+ internal sealed class ImageFromDockerfileConfiguration : ResourceConfiguration, IImageFromDockerfileConfiguration
{
///
/// Initializes a new instance of the class.
@@ -35,7 +36,7 @@ public ImageFromDockerfileConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public ImageFromDockerfileConfiguration(IResourceConfiguration resourceConfiguration)
+ public ImageFromDockerfileConfiguration(IResourceConfiguration resourceConfiguration)
: base(resourceConfiguration)
{
}
diff --git a/src/Testcontainers/Configurations/Networks/INetworkConfiguration.cs b/src/Testcontainers/Configurations/Networks/INetworkConfiguration.cs
index cd82bfa37..094f1ab70 100644
--- a/src/Testcontainers/Configurations/Networks/INetworkConfiguration.cs
+++ b/src/Testcontainers/Configurations/Networks/INetworkConfiguration.cs
@@ -1,13 +1,14 @@
namespace DotNet.Testcontainers.Configurations
{
using System.Collections.Generic;
+ using Docker.DotNet.Models;
using JetBrains.Annotations;
///
/// A network configuration.
///
[PublicAPI]
- public interface INetworkConfiguration : IResourceConfiguration
+ public interface INetworkConfiguration : IResourceConfiguration
{
///
/// Gets the name.
diff --git a/src/Testcontainers/Configurations/Networks/NetworkConfiguration.cs b/src/Testcontainers/Configurations/Networks/NetworkConfiguration.cs
index f95534d95..d46e72ed9 100644
--- a/src/Testcontainers/Configurations/Networks/NetworkConfiguration.cs
+++ b/src/Testcontainers/Configurations/Networks/NetworkConfiguration.cs
@@ -1,12 +1,13 @@
namespace DotNet.Testcontainers.Configurations
{
using System.Collections.Generic;
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Builders;
using JetBrains.Annotations;
///
[PublicAPI]
- internal sealed class NetworkConfiguration : ResourceConfiguration, INetworkConfiguration
+ internal sealed class NetworkConfiguration : ResourceConfiguration, INetworkConfiguration
{
///
/// Initializes a new instance of the class.
@@ -28,7 +29,7 @@ public NetworkConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public NetworkConfiguration(IResourceConfiguration resourceConfiguration)
+ public NetworkConfiguration(IResourceConfiguration resourceConfiguration)
: base(resourceConfiguration)
{
}
diff --git a/src/Testcontainers/Configurations/Volumes/IVolumeConfiguration.cs b/src/Testcontainers/Configurations/Volumes/IVolumeConfiguration.cs
index 2506baa7d..b98837a4c 100644
--- a/src/Testcontainers/Configurations/Volumes/IVolumeConfiguration.cs
+++ b/src/Testcontainers/Configurations/Volumes/IVolumeConfiguration.cs
@@ -1,12 +1,13 @@
namespace DotNet.Testcontainers.Configurations
{
+ using Docker.DotNet.Models;
using JetBrains.Annotations;
///
/// A volume configuration.
///
[PublicAPI]
- public interface IVolumeConfiguration : IResourceConfiguration
+ public interface IVolumeConfiguration : IResourceConfiguration
{
///
/// Gets the name.
diff --git a/src/Testcontainers/Configurations/Volumes/VolumeConfiguration.cs b/src/Testcontainers/Configurations/Volumes/VolumeConfiguration.cs
index 34579642c..a8ee0da0e 100644
--- a/src/Testcontainers/Configurations/Volumes/VolumeConfiguration.cs
+++ b/src/Testcontainers/Configurations/Volumes/VolumeConfiguration.cs
@@ -1,11 +1,12 @@
namespace DotNet.Testcontainers.Configurations
{
+ using Docker.DotNet.Models;
using DotNet.Testcontainers.Builders;
using JetBrains.Annotations;
///
[PublicAPI]
- internal sealed class VolumeConfiguration : ResourceConfiguration, IVolumeConfiguration
+ internal sealed class VolumeConfiguration : ResourceConfiguration, IVolumeConfiguration
{
///
/// Initializes a new instance of the class.
@@ -21,7 +22,7 @@ public VolumeConfiguration(
/// Initializes a new instance of the class.
///
/// The Docker resource configuration.
- public VolumeConfiguration(IResourceConfiguration resourceConfiguration)
+ public VolumeConfiguration(IResourceConfiguration resourceConfiguration)
: base(resourceConfiguration)
{
}
diff --git a/src/Testcontainers/Containers/ResourceReaper.cs b/src/Testcontainers/Containers/ResourceReaper.cs
index 84602bb2f..8eaa6a72e 100644
--- a/src/Testcontainers/Containers/ResourceReaper.cs
+++ b/src/Testcontainers/Containers/ResourceReaper.cs
@@ -83,7 +83,7 @@ private ResourceReaper(Guid sessionId, IDockerEndpointAuthenticationConfiguratio
///
///
/// The default will start either on
- /// or if a is configured with .
+ /// or if a is configured with .
///
[PublicAPI]
public static Guid DefaultSessionId { get; }
diff --git a/src/Testcontainers/Resource.cs b/src/Testcontainers/Resource.cs
index 2544d1495..2a334d44a 100644
--- a/src/Testcontainers/Resource.cs
+++ b/src/Testcontainers/Resource.cs
@@ -13,10 +13,7 @@ public abstract class Resource
/// Checks whether the resources exists or not.
///
/// True if the resource exists; otherwise, false.
- protected virtual bool Exists()
- {
- return true;
- }
+ protected abstract bool Exists();
///
/// Throws an when the resources was not found.
diff --git a/src/Testcontainers/_OBSOLETE_/TestcontainersBuilderAzuriteExtension.cs b/src/Testcontainers/_OBSOLETE_/TestcontainersBuilderAzuriteExtension.cs
index a5ecb5b1f..47204668a 100644
--- a/src/Testcontainers/_OBSOLETE_/TestcontainersBuilderAzuriteExtension.cs
+++ b/src/Testcontainers/_OBSOLETE_/TestcontainersBuilderAzuriteExtension.cs
@@ -1,5 +1,6 @@
namespace DotNet.Testcontainers.Builders
{
+ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -129,7 +130,7 @@ private static string[] GetWorkspaceDirectoryPath()
private static string[] GetDebugModeEnabled(AzuriteTestcontainerConfiguration configuration)
{
var debugLogFilePath = Path.Combine(AzuriteTestcontainerConfiguration.DefaultWorkspaceDirectoryPath, "debug.log");
- return configuration.DebugModeEnabled ? new[] { "--debug", debugLogFilePath } : null;
+ return configuration.DebugModeEnabled ? new[] { "--debug", debugLogFilePath } : Array.Empty();
}
private static string GetSilentModeEnabled(AzuriteTestcontainerConfiguration configuration)