Skip to content

Commit

Permalink
chore: Remove obsolete code (testcontainers#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn authored Mar 26, 2024
1 parent 533a249 commit 53197c8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 46 deletions.
19 changes: 0 additions & 19 deletions src/Testcontainers/Configurations/TestcontainersSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ namespace DotNet.Testcontainers.Configurations
using DotNet.Testcontainers.Containers;
using DotNet.Testcontainers.Images;
using JetBrains.Annotations;
using Microsoft.Extensions.Logging;

/// <summary>
/// This class represents the Testcontainers settings.
/// </summary>
[PublicAPI]
public static class TestcontainersSettings
{
private static readonly ManualResetEventSlim ManualResetEvent = new ManualResetEventSlim(true);

[CanBeNull]
private static readonly IDockerEndpointAuthenticationProvider DockerEndpointAuthProvider
= new IDockerEndpointAuthenticationProvider[]
Expand Down Expand Up @@ -103,29 +100,13 @@ static TestcontainersSettings()
public static string HubImageNamePrefix { get; set; }
= EnvironmentConfiguration.Instance.GetHubImageNamePrefix() ?? PropertiesFileConfiguration.Instance.GetHubImageNamePrefix();

/// <summary>
/// Gets or sets the logger.
/// </summary>
[NotNull]
[Obsolete("Use the builder API WithLogger(ILogger) instead.")]
public static ILogger Logger { get; set; }
= ConsoleLogger.Instance;

/// <summary>
/// Gets or sets the host operating system.
/// </summary>
[NotNull]
public static IOperatingSystem OS { get; set; }
= RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? (IOperatingSystem)new Windows(DockerEndpointAuthConfig) : new Unix(DockerEndpointAuthConfig);

/// <summary>
/// Gets the wait handle that signals settings initialized.
/// </summary>
[NotNull]
[Obsolete("This property is no longer supported.")]
public static WaitHandle SettingsInitialized
=> ManualResetEvent.WaitHandle;

/// <inheritdoc cref="PortForwardingContainer.ExposeHostPortsAsync" />
public static Task ExposeHostPortsAsync(ushort port, CancellationToken ct = default)
=> ExposeHostPortsAsync(new[] { port }, ct);
Expand Down
12 changes: 0 additions & 12 deletions src/Testcontainers/Containers/DockerContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ public DockerContainer(IContainerConfiguration configuration)
_configuration = configuration;
}

/// <summary>
/// Initializes a new instance of the <see cref="DockerContainer" /> class.
/// </summary>
/// <param name="configuration">The container configuration.</param>
/// <param name="logger">The logger.</param>
[Obsolete("Use the constructor DockerContainer(IContainerConfiguration) instead.")]
public DockerContainer(IContainerConfiguration configuration, ILogger logger)
{
_client = new TestcontainersClient(configuration.SessionId, configuration.DockerEndpointAuthConfig, logger);
_configuration = configuration;
}

/// <inheritdoc />
public event EventHandler Creating;

Expand Down
14 changes: 0 additions & 14 deletions src/Testcontainers/Containers/ResourceReaper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,6 @@ private ResourceReaper(Guid sessionId, IDockerEndpointAuthenticationConfiguratio
[PublicAPI]
public Guid SessionId { get; }

/// <summary>
/// Starts and returns the default <see cref="ResourceReaper" /> instance.
/// </summary>
/// <param name="dockerEndpointAuthConfig">The Docker endpoint authentication configuration.</param>
/// <param name="isWindowsEngineEnabled">Determines whether the Windows engine is enabled or not.</param>
/// <param name="ct">The cancellation token to cancel the <see cref="ResourceReaper" /> initialization.</param>
/// <returns>Task that completes when the <see cref="ResourceReaper" /> has been started.</returns>
[PublicAPI]
[Obsolete("Use GetAndStartDefaultAsync(IDockerEndpointAuthenticationConfiguration, ILogger, bool, CancellationToken) instead.")]
public static Task<ResourceReaper> GetAndStartDefaultAsync(IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig, bool isWindowsEngineEnabled = false, CancellationToken ct = default)
{
return GetAndStartDefaultAsync(dockerEndpointAuthConfig, ConsoleLogger.Instance, isWindowsEngineEnabled, ct);
}

/// <summary>
/// Starts and returns the default <see cref="ResourceReaper" /> instance.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public sealed class DefaultResourceReaperTest : IAsyncLifetime
{
public async Task InitializeAsync()
{
var resourceReaper = await ResourceReaper.GetAndStartDefaultAsync(TestcontainersSettings.OS.DockerEndpointAuthConfig)
var resourceReaper = await ResourceReaper.GetAndStartDefaultAsync(TestcontainersSettings.OS.DockerEndpointAuthConfig, ConsoleLogger.Instance)
.ConfigureAwait(false);

await resourceReaper.DisposeAsync()
Expand Down

0 comments on commit 53197c8

Please sign in to comment.