Skip to content

Commit 7ecd79e

Browse files
authored
chore: Remove obsolete UntilOperationIsSucceeded wait strategy (#1202)
1 parent a94a1ea commit 7ecd79e

File tree

6 files changed

+23
-128
lines changed

6 files changed

+23
-128
lines changed

src/Testcontainers.Pulsar/PulsarBuilder.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,7 @@ public sealed class PulsarBuilder : ContainerBuilder<PulsarBuilder, PulsarContai
1616

1717
public const string Username = "test-user";
1818

19-
private static readonly IReadOnlyDictionary<string, string> AuthenticationEnvVars;
20-
21-
static PulsarBuilder()
22-
{
23-
const string authenticationPlugin = "org.apache.pulsar.client.impl.auth.AuthenticationToken";
24-
var authenticationEnvVars = new Dictionary<string, string>();
25-
authenticationEnvVars.Add("authenticateOriginalAuthData", "false");
26-
authenticationEnvVars.Add("authenticationEnabled", "true");
27-
authenticationEnvVars.Add("authorizationEnabled", "true");
28-
authenticationEnvVars.Add("authenticationProviders", "org.apache.pulsar.broker.authentication.AuthenticationProviderToken");
29-
authenticationEnvVars.Add("brokerClientAuthenticationPlugin", authenticationPlugin);
30-
authenticationEnvVars.Add("CLIENT_PREFIX_authPlugin", authenticationPlugin);
31-
authenticationEnvVars.Add("PULSAR_PREFIX_authenticationRefreshCheckSeconds", "5");
32-
authenticationEnvVars.Add("PULSAR_PREFIX_tokenSecretKey", "file://" + SecretKeyFilePath);
33-
authenticationEnvVars.Add("superUserRoles", Username);
34-
AuthenticationEnvVars = new ReadOnlyDictionary<string, string>(authenticationEnvVars);
35-
}
19+
private static readonly IReadOnlyDictionary<string, string> AuthenticationEnvVars = InitAuthenticationEnvVars();
3620

3721
/// <summary>
3822
/// Initializes a new instance of the <see cref="PulsarBuilder" /> class.
@@ -126,6 +110,22 @@ protected override PulsarBuilder Merge(PulsarConfiguration oldValue, PulsarConfi
126110
return new PulsarBuilder(new PulsarConfiguration(oldValue, newValue));
127111
}
128112

113+
private static IReadOnlyDictionary<string, string> InitAuthenticationEnvVars()
114+
{
115+
const string authenticationPlugin = "org.apache.pulsar.client.impl.auth.AuthenticationToken";
116+
var authenticationEnvVars = new Dictionary<string, string>();
117+
authenticationEnvVars.Add("authenticateOriginalAuthData", "false");
118+
authenticationEnvVars.Add("authenticationEnabled", "true");
119+
authenticationEnvVars.Add("authorizationEnabled", "true");
120+
authenticationEnvVars.Add("authenticationProviders", "org.apache.pulsar.broker.authentication.AuthenticationProviderToken");
121+
authenticationEnvVars.Add("brokerClientAuthenticationPlugin", authenticationPlugin);
122+
authenticationEnvVars.Add("CLIENT_PREFIX_authPlugin", authenticationPlugin);
123+
authenticationEnvVars.Add("PULSAR_PREFIX_authenticationRefreshCheckSeconds", "5");
124+
authenticationEnvVars.Add("PULSAR_PREFIX_tokenSecretKey", "file://" + SecretKeyFilePath);
125+
authenticationEnvVars.Add("superUserRoles", Username);
126+
return new ReadOnlyDictionary<string, string>(authenticationEnvVars);
127+
}
128+
129129
/// <inheritdoc cref="IWaitUntil" />
130130
private sealed class WaitUntil : IWaitUntil
131131
{

src/Testcontainers/Builders/RootlessUnixEndpointAuthenticationProvider.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace DotNet.Testcontainers.Builders
1111
[PublicAPI]
1212
internal class RootlessUnixEndpointAuthenticationProvider : DockerEndpointAuthenticationProvider
1313
{
14+
private const string DockerSocket = "docker.sock";
15+
1416
/// <summary>
1517
/// Initializes a new instance of the <see cref="RootlessUnixEndpointAuthenticationProvider" /> class.
1618
/// </summary>
@@ -51,17 +53,17 @@ public override IDockerEndpointAuthenticationConfiguration GetAuthConfig()
5153
protected static string GetSocketPathFromEnv()
5254
{
5355
var xdgRuntimeDir = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR");
54-
return string.Join("/", xdgRuntimeDir, "docker.sock");
56+
return string.Join("/", xdgRuntimeDir, DockerSocket);
5557
}
5658

5759
protected static string GetSocketPathFromHomeDesktopDir()
5860
{
59-
return string.Join("/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".docker", "desktop", "docker.sock");
61+
return string.Join("/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".docker", "desktop", DockerSocket);
6062
}
6163

6264
protected static string GetSocketPathFromHomeRunDir()
6365
{
64-
return string.Join("/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".docker", "run", "docker.sock");
66+
return string.Join("/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".docker", "run", DockerSocket);
6567
}
6668

6769
protected static string GetSocketPathFromRunDir()
@@ -78,7 +80,7 @@ protected static string GetSocketPathFromRunDir()
7880
uid = new Linux().GetUid();
7981
}
8082

81-
return string.Join("/", string.Empty, "user", uid, "docker.sock");
83+
return string.Join("/", string.Empty, "user", uid, DockerSocket);
8284
}
8385

8486
/// <summary>

src/Testcontainers/Configurations/WaitStrategies/IWaitForContainerOS.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,6 @@ public interface IWaitForContainerOS
9393
[PublicAPI]
9494
IWaitForContainerOS UntilMessageIsLogged(Regex pattern, Action<IWaitStrategy> waitStrategyModifier = null);
9595

96-
/// <summary>
97-
/// Waits until the operation is completed successfully.
98-
/// </summary>
99-
/// <param name="operation">The operation to be executed.</param>
100-
/// <param name="maxCallCount">The number of attempts before an exception is thrown.</param>
101-
/// <param name="waitStrategyModifier">The wait strategy modifier to cancel the readiness check.</param>
102-
/// <returns>A configured instance of <see cref="IWaitForContainerOS" />.</returns>
103-
/// <exception cref="TimeoutException">Thrown when number of failed operations exceeded <paramref name="maxCallCount" />.</exception>
104-
[PublicAPI]
105-
[Obsolete("Use one of the other wait strategies in combination with the `Action<IWaitStrategy>` argument, and set the number of retries.")]
106-
IWaitForContainerOS UntilOperationIsSucceeded(Func<bool> operation, int maxCallCount, Action<IWaitStrategy> waitStrategyModifier = null);
107-
10896
/// <summary>
10997
/// Waits until the http request is completed successfully.
11098
/// </summary>

src/Testcontainers/Configurations/WaitStrategies/UntilOperationIsSucceeded.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Testcontainers/Configurations/WaitStrategies/WaitForContainerOS.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ public IWaitForContainerOS UntilMessageIsLogged(Regex pattern, Action<IWaitStrat
6868
return AddCustomWaitStrategy(new UntilMessageIsLogged(pattern), waitStrategyModifier);
6969
}
7070

71-
/// <inheritdoc />
72-
public virtual IWaitForContainerOS UntilOperationIsSucceeded(Func<bool> operation, int maxCallCount, Action<IWaitStrategy> waitStrategyModifier = null)
73-
{
74-
return AddCustomWaitStrategy(new UntilOperationIsSucceeded(operation, maxCallCount), waitStrategyModifier);
75-
}
76-
7771
/// <inheritdoc />
7872
public virtual IWaitForContainerOS UntilHttpRequestIsSucceeded(Func<HttpWaitStrategy, HttpWaitStrategy> request, Action<IWaitStrategy> waitStrategyModifier = null)
7973
{

tests/Testcontainers.Tests/Unit/Configurations/WaitUntilOperationIsSucceededTest.cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)