Skip to content

Commit 013758a

Browse files
committed
chore: Remove unused class WaitTwoSeconds
1 parent 3f82ef4 commit 013758a

File tree

5 files changed

+13
-50
lines changed

5 files changed

+13
-50
lines changed

src/Testcontainers.Db2/Db2Container.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task<ExecResult> ExecScriptAsync(string scriptContent, Cancellation
4242
await CopyAsync(Encoding.Default.GetBytes(scriptContent), scriptFilePath, Unix.FileMode644, ct)
4343
.ConfigureAwait(false);
4444

45-
return await ExecAsync(new [] { "/bin/sh", "-c", db2ShellCommand}, ct)
45+
return await ExecAsync(new[] { "/bin/sh", "-c", db2ShellCommand}, ct)
4646
.ConfigureAwait(false);
4747
}
4848
}

src/Testcontainers.EventHubs/EventHubsBuilder.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected override EventHubsBuilder Init()
139139
.WithPortBinding(EventHubsPort, true)
140140
.WithPortBinding(EventHubsHttpPort, true)
141141
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
142-
request.ForPath("/health").ForPort(EventHubsHttpPort)));
142+
request.ForPort(EventHubsHttpPort).ForPath("/health")));
143143
}
144144

145145
/// <inheritdoc />
@@ -159,22 +159,4 @@ protected override EventHubsBuilder Merge(EventHubsConfiguration oldValue, Event
159159
{
160160
return new EventHubsBuilder(new EventHubsConfiguration(oldValue, newValue));
161161
}
162-
163-
/// <inheritdoc cref="IWaitUntil" />
164-
/// <remarks>
165-
/// This is a workaround to ensure that the wait strategy does not indicate
166-
/// readiness too early:
167-
/// https://github.com/Azure/azure-service-bus-emulator-installer/issues/35#issuecomment-2497164533.
168-
/// </remarks>
169-
private sealed class WaitTwoSeconds : IWaitUntil
170-
{
171-
/// <inheritdoc />
172-
public async Task<bool> UntilAsync(IContainer container)
173-
{
174-
await Task.Delay(TimeSpan.FromSeconds(2))
175-
.ConfigureAwait(false);
176-
177-
return true;
178-
}
179-
}
180162
}

src/Testcontainers.ServiceBus/ServiceBusBuilder.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected override ServiceBusBuilder Init()
120120
.WithPortBinding(ServiceBusHttpPort, true)
121121
.WithEnvironment("SQL_WAIT_INTERVAL", "0")
122122
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
123-
request.ForPath("/health").ForPort(ServiceBusHttpPort)));
123+
request.ForPort(ServiceBusHttpPort).ForPath("/health")));
124124
}
125125

126126
/// <inheritdoc />
@@ -140,22 +140,4 @@ protected override ServiceBusBuilder Merge(ServiceBusConfiguration oldValue, Ser
140140
{
141141
return new ServiceBusBuilder(new ServiceBusConfiguration(oldValue, newValue));
142142
}
143-
144-
/// <inheritdoc cref="IWaitUntil" />
145-
/// <remarks>
146-
/// This is a workaround to ensure that the wait strategy does not indicate
147-
/// readiness too early:
148-
/// https://github.com/Azure/azure-service-bus-emulator-installer/issues/35#issuecomment-2497164533.
149-
/// </remarks>
150-
private sealed class WaitTwoSeconds : IWaitUntil
151-
{
152-
/// <inheritdoc />
153-
public async Task<bool> UntilAsync(IContainer container)
154-
{
155-
await Task.Delay(TimeSpan.FromSeconds(2))
156-
.ConfigureAwait(false);
157-
158-
return true;
159-
}
160-
}
161143
}

src/Testcontainers/Containers/DockerContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ await _client.AttachAsync(_container.ID, _configuration.OutputConsumer, ct)
505505
await _client.StartAsync(_container.ID, ct)
506506
.ConfigureAwait(false);
507507

508-
_ = await CheckReadinessAsync(new [] { portBindingsMapped }, ct)
508+
_ = await CheckReadinessAsync(new[] { portBindingsMapped }, ct)
509509
.ConfigureAwait(false);
510510

511511
Starting?.Invoke(this, EventArgs.Empty);

src/Testcontainers/Images/DockerfileArchive.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace DotNet.Testcontainers.Images
44
using System.Collections.Generic;
55
using System.IO;
66
using System.Linq;
7-
using System.Runtime.InteropServices;
87
using System.Text;
98
using System.Text.RegularExpressions;
109
using System.Threading;
@@ -150,7 +149,7 @@ public async Task<string> Tar(CancellationToken ct = default)
150149
{
151150
var entry = TarEntry.CreateTarEntry(relativeFilePath);
152151
entry.TarHeader.Size = inputStream.Length;
153-
entry.TarHeader.Mode = GetFileMode(absoluteFilePath);
152+
entry.TarHeader.Mode = GetUnixFileMode(absoluteFilePath);
154153

155154
await tarOutputStream.PutNextEntryAsync(entry, ct)
156155
.ConfigureAwait(false);
@@ -188,21 +187,21 @@ private static IEnumerable<string> GetFiles(string directory)
188187
}
189188

190189
/// <summary>
191-
/// Gets the file mode for a given file.
190+
/// Gets the Unix file mode of the file on the path.
192191
/// </summary>
193-
/// <param name="path">The path to the file.</param>
194-
/// <returns>The file mode for the <see cref="TarEntry"/></returns>
195-
private static int GetFileMode(string path)
192+
/// <param name="filePath">The path to the file.</param>
193+
/// <returns>The Unix file mode of the file on the path.</returns>
194+
private static int GetUnixFileMode(string filePath)
196195
{
197196
#if NET7_0_OR_GREATER
198-
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
197+
if (!OperatingSystem.IsWindows())
199198
{
200-
return (int)File.GetUnixFileMode(path);
199+
return (int)File.GetUnixFileMode(filePath);
201200
}
202201
#endif
203202

204-
// Default to 755 for Windows and fallback to 755 for Unix when
205-
// `GetUnixFileMode` is not available.
203+
// Default to 755 for Windows and fall back to 755 for Unix when `GetUnixFileMode`
204+
// is not available.
206205
return (int)Unix.FileMode755;
207206
}
208207
}

0 commit comments

Comments
 (0)