Skip to content

Commit c536f49

Browse files
authored
fix(Pulsar): Wait for default namespace (#1539)
1 parent da07184 commit c536f49

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

src/Testcontainers.Pulsar/PulsarBuilder.cs

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ private static IReadOnlyDictionary<string, string> InitAuthenticationEnvVars()
137137
private sealed class WaitUntil : IWaitUntil
138138
{
139139
private readonly HttpWaitStrategy _httpWaitStrategy = new HttpWaitStrategy()
140-
.ForPath("/admin/v2/clusters")
141-
.ForPort(PulsarWebServicePort)
142-
.ForResponseMessageMatching(IsClusterHealthyAsync);
140+
.ForPath("/admin/v2/namespaces/public/default")
141+
.ForPort(PulsarWebServicePort);
143142

144143
private readonly bool _authenticationEnabled;
145144

@@ -181,31 +180,5 @@ private async Task<bool> UntilAsync(PulsarContainer container)
181180
return await _httpWaitStrategy.UntilAsync(container)
182181
.ConfigureAwait(false);
183182
}
184-
185-
/// <summary>
186-
/// Determines whether the cluster is healthy or not.
187-
/// </summary>
188-
/// <param name="response">The HTTP response that contains the cluster information.</param>
189-
/// <returns>A value indicating whether the cluster is healthy or not.</returns>
190-
private static async Task<bool> IsClusterHealthyAsync(HttpResponseMessage response)
191-
{
192-
var jsonString = await response.Content.ReadAsStringAsync()
193-
.ConfigureAwait(false);
194-
195-
try
196-
{
197-
var status = JsonDocument.Parse(jsonString)
198-
.RootElement
199-
.EnumerateArray()
200-
.ElementAt(0)
201-
.GetString();
202-
203-
return "standalone".Equals(status);
204-
}
205-
catch
206-
{
207-
return false;
208-
}
209-
}
210183
}
211184
}

0 commit comments

Comments
 (0)