Skip to content

Commit 4f41444

Browse files
authored
fix(ServiceBus): Workaround health API timeout (#1625)
1 parent f56b58b commit 4f41444

3 files changed

Lines changed: 7 additions & 19 deletions

File tree

src/Testcontainers.EventHubs/EventHubsBuilder.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ protected override EventHubsBuilder Init()
169169
.WithPortBinding(EventHubsPort, true)
170170
.WithPortBinding(EventHubsHttpPort, true)
171171
.WithWaitStrategy(Wait.ForUnixContainer()
172-
.AddCustomWaitStrategy(new WorkaroundGhIssue69())
172+
// https://github.com/Azure/azure-event-hubs-emulator-installer/issues/69#issuecomment-3762895979.
173+
.UntilMessageIsLogged("Emulator Service is Successfully Up!")
173174
.UntilHttpRequestIsSucceeded(request =>
174175
request.ForPort(EventHubsHttpPort).ForPath("/health")));
175176
}
@@ -191,19 +192,4 @@ protected override EventHubsBuilder Merge(EventHubsConfiguration oldValue, Event
191192
{
192193
return new EventHubsBuilder(new EventHubsConfiguration(oldValue, newValue));
193194
}
194-
195-
/// <summary>
196-
/// See GH issue: https://github.com/Azure/azure-event-hubs-emulator-installer/issues/69#issuecomment-3762895979.
197-
/// </summary>
198-
private sealed class WorkaroundGhIssue69 : IWaitUntil
199-
{
200-
/// <inheritdoc />
201-
public async Task<bool> UntilAsync(IContainer container)
202-
{
203-
await Task.Delay(TimeSpan.FromSeconds(5))
204-
.ConfigureAwait(false);
205-
206-
return true;
207-
}
208-
}
209195
}

src/Testcontainers.EventHubs/Usings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
global using System.Linq;
66
global using System.Text;
77
global using System.Text.Json;
8-
global using System.Threading.Tasks;
98
global using Docker.DotNet.Models;
109
global using DotNet.Testcontainers;
1110
global using DotNet.Testcontainers.Builders;

src/Testcontainers.ServiceBus/ServiceBusBuilder.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ protected override ServiceBusBuilder Init()
164164
.WithPortBinding(ServiceBusPort, true)
165165
.WithPortBinding(ServiceBusHttpPort, true)
166166
.WithEnvironment("SQL_WAIT_INTERVAL", "0")
167-
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(request =>
168-
request.ForPort(ServiceBusHttpPort).ForPath("/health")));
167+
.WithWaitStrategy(Wait.ForUnixContainer()
168+
// https://github.com/Azure/azure-event-hubs-emulator-installer/issues/69#issuecomment-3762895979.
169+
.UntilMessageIsLogged("Emulator Service is Successfully Up!")
170+
.UntilHttpRequestIsSucceeded(request =>
171+
request.ForPort(ServiceBusHttpPort).ForPath("/health")));
169172
}
170173

171174
/// <inheritdoc />

0 commit comments

Comments
 (0)